Skip to content

feat(tasks): read/unread state for pull requests in the PR list - #38158

Open
EwenQuim wants to merge 1 commit into
stablyai:mainfrom
EwenQuim:feat/pr-read-unread-state
Open

EwenQuim wants to merge 1 commit into
stablyai:mainfrom
EwenQuim:feat/pr-read-unread-state

Conversation

@EwenQuim

@EwenQuim EwenQuim commented Nov 4, 2026 •

Copy link
Copy Markdown

ELI5

The PR list tells you a lot about each PR but never whether anything on it is new to you. This adds the read/unread idea Orca already has for agents and workspaces to the PR list: a PR you have opened is read, and it turns unread again the moment it gets a new comment, review, push, or failing check.

What Changed

Before: every PR row looked equally important. The only way to tell what moved was to read the relative timestamp and remember what it said last time, which stops working past a handful of PRs.

After:

  • A PR row shows a dot beside its title while it has activity you have not looked at, and the row's number-pill label reads "… Add application screenshot to README #12, unread" so the state is not color-only.
  • Opening a PR (click, Enter or Space) marks it read.
  • The row menu gains Mark read / Mark unread, mirroring the workspace row actions.
  • Any later change re-raises it: a comment, review, head push (all move updatedAt) or a check run going red.

Mechanism: a PR is read while a stored mark still matches its row. The mark is a small fingerprint, { version, checks, state }:

  • version is the row's updatedAt in epoch ms, so the ordinary "something happened" signal re-raises without any new polling.
  • checks only carries a failed run (failure:<failed>:<cancelled>). Checks move without touching updatedAt, so without it a red CI would not raise a row; and a run settling to success deliberately does not raise, or green CI would light up every row it touched.
  • state re-raises on close/merge/reopen.

Marks live on the shared persisted UI state next to the agent read state (acknowledgedAgentsByPaneKey and friends), so they persist across restart and inherit the same per-host scoping. The map is bounded at 500 entries, dropping oldest-first, so it cannot grow with every repo ever opened.

Not painting everything unread on upgrade: the first list a client sees is adopted as already read. The adoption only stamps PRs with no mark at all, so a PR whose mark went stale while the app was closed is never re-adopted and keeps its unread state.

Why

The repo already solved this problem twice for other objects, and the vocabulary (Mark read / Mark unread, dots, read state in the shared UI state) already exists; this reuses it rather than inventing a parallel notification system.

The alternative I rejected was reusing GitHub's own notification/thread state. That is per-account server state, it is not available for GitLab/Bitbucket rows in the same list, and it would make "read" mean something different from what it means everywhere else in Orca. A local, row-derived fingerprint needs no new API calls at all.

This is deliberately not the per-file "Viewed" work in #6739. That one is a review-progress marker inside one PR whose auto-reset keys off a diff identity; this is PR-as-a-whole at list level. They are independent layers and do not conflict.

Linked Issue

Fixes #38152 (the feature request this implements; filed by the same contributor).

Visual Proof

I could not capture before/after media from this environment: it is a headless clone with no display, and the repo rules forbid stealing monitor focus or revealing test windows. I did not want to fabricate a screenshot or a GIF of a state I never rendered. Please treat this as the one open item; the diff is small and the before state is simply "no dot, no menu entry".

What to look at, in the Tasks view with PRs selected:

  1. PR rows with no mark show the dot before the title; the pill's accessible name ends in ", unread".
  2. Click one: the dot clears. Reopen the list: it stays cleared (persisted).
  3. Mark one unread from the row menu: dot returns without touching the PR.
  4. While a row is read, let a check go red (or comment on the PR): the dot returns on the next refresh, with no untick.

Testing

  • I manually tested these changes locally
  • Automated tests added, or explained why not below
  • Every added test fails without this change and avoids the test anti-patterns

Honest scoping of the checkboxes: everything below is automated verification. I did not run the Electron app (headless environment, and the repo forbids agent-launched visible windows), so the interaction pass above is unverified by me.

  • pnpm tc:web and pnpm tc:node: pass
  • pnpm test on the touched suites: 29 pass across 7 files
  • pnpm exec oxlint / oxfmt --check on touched files: clean
  • verify:localization-catalog: pass (4 new keys)
  • pnpm check:changed: passes

I confirmed the new tests are load-bearing: reverting isPRRead to "always read" fails 3 of them.

The 13 cases sit at the one layer that owns the rule (pr-read-state.ts, pure functions): re-raise on update / failing check / merge, no read-raise on a check settling to success, bounded writes, and adoption never re-adopting a stale mark. No component tests: those would only assert markup classes.

Risk

Level: Low

  • Persisted state: one new optional field in the shared UI state. Older builds ignore unknown fields; a malformed or hand-edited value is dropped per entry by the sanitizer rather than trusted, and missing marks simply read as unread. Backing out is a plain revert; the orphaned field is inert, so a revert does not need a migration.
  • The riskiest part is the re-raise signal being too broad or too narrow. Too broad and the dot becomes noise (why a run settling to success is excluded); too narrow and a PR stays falsely read after real activity. updatedAt is the provider's own activity version, so it is the right proxy, but a provider that bumps it on unrelated churn would raise more often. If it misbehaves, users see dots they consider stale, not lost data.
  • Cross-platform / SSH: no platform-specific code, no new IPC, no filesystem or path logic. Marks ride the existing persisted-UI sync, and the key carries the producing host (repoHostId) plus the owner/repo slug, so same-id twins across repos and hosts cannot share a mark.
  • Mobile: the field is additive and optional; mobile ignores it and nothing there renders the dot.
  • Performance: no new requests and no polling. Evaluation is one record lookup plus a Date.parse per visible row; Date.parse of an already-parsed string is cheap and the row count is one page. The mark map is bounded at 500.

AI Disclosure

Authored with Mistral Vibe (Mistral AI's CLI agent): it explored the repo, wrote the implementation and tests, and ran the verification above. The feature request in #38152 was filed by the same agent. All checks listed under Testing were executed and their output read; the unrun Electron interaction pass is called out explicitly rather than claimed.

Review

## Review is kept in template order. What I reviewed before opening this:

  • Cross-platform: no platform-specific code, no shell/path logic, no keyboard accelerators. The dot, the label and the menu item are renderer-only and reuse existing tokens and the DropdownMenuItem primitive.
  • Remote / SSH / paired hosts: marks are keyed by the producing host (repoHostId) plus the owner/repo slug, so a same-id repo on another host cannot share or inherit a mark. State rides the existing persisted-UI sync path, which already carries the agent read maps over SSH; no new IPC or RPC method.
  • Mobile / web clients: the field is optional and additive on the shared UI state. Clients that do not render the dot ignore it; a client that writes other UI fields cannot blank it, because persistence diffs per field.
  • Folder workspaces: untouched. The rule operates on PR rows, not workspaces, and makes no worktree assumption.
  • Performance: no new requests, no polling, no timers. Evaluation is one record lookup plus a Date.parse per visible row (one page), memoized nowhere because it is cheaper than the memo. The mark map is bounded at 500 entries so persistence writes stay small.
  • Security: no user-controlled input reaches the key, no new attack surface, and persisted values are shape-validated per entry on hydration so a hand-edited file cannot inject arbitrary objects.
  • Correctness of the re-raise rule: the property I care most about is that read never becomes permanent silence. Covered by tests for a new updatedAt, a check going red, and merge/reopen.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Provider neutrality: the module is named prReadKey/PRReadMark rather than GitHub-specific, and the mark is derived from fields the provider row already exposes (updatedAt, checksSummary, state). The row menu is wired on the GitHub rows only because that is the list that exists today; the state and rule are not GitHub-only.
  • Scope call: the read state stays local to the PR list. It deliberately does not feed the macOS Dock badge or the Activity view. That keeps the first step small and reversible; wiring it into the badge is a follow-up once the dot's signal is trusted.
  • Security: no user input reaches the key, no new IPC surface, and persisted values are shape-validated on hydration.
  • Refs Mark files as viewed during review #6739, which motivated the design but is not superseded by this.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I stated the risk: what could break, for whom, and how to back it out
  • Before/after screenshots or videos attached, or N/A with reason — not attached: headless environment, see Visual Proof
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred) — lint/typecheck/test run locally; pnpm build not run locally, left to CI

The in-app PR list shows state, review, checks and merge readiness, but
nothing answers "what changed since I last looked". Agents and workspaces
already have unread state (sidebar dots, Dock badge, Mark read/unread,
`orca worktree set --unread/--read`); PRs had no equivalent.

A PR is read while a stored mark still matches its row: the row's
`updatedAt` (comments, reviews, head pushes) plus the failed-check signal.
Any difference re-raises it, so marking read never silences a PR. Opening a
row marks it read; the row menu flips either way. Marks live on the shared
UI state next to the agent read state, so they persist and follow the same
per-host scoping the list already uses; the map is bounded at 500 entries.

The first list a client sees is adopted as already read, so upgrading does
not paint every existing PR unread (a stale mark is never re-adopted, so
activity that arrived while the app was closed stays unread).

Fixes stablyai#38152
@coderabbitai

coderabbitai Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Walkthrough

The change adds persisted PR read marks with activity-based read status, including updates to PR state and failed checks. The GitHub work-item list shows unread indicators, marks PRs read when opened, and provides read/unread menu actions. The first non-empty filtered list is adopted as read. The marks are validated during hydration and included in UI persistence.

Severity of issue fixed: Medium

Merge Risk: Moderate · up to 9f915

The PR list can mark new or deliberately unread PRs as read after a restart or return to the tasks view, which undermines the feature. Issue rows can also use up the stored read marks, and the checks pill does not mark a PR read. The unread state is not announced to screen readers. Fix the adoption behavior before merging.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Linked Issues check Warning Directly linked issue #38152 is active (state: open). Its coding requirements are assessed below.

Implemented at head 9f915e9:
- Unread indicator with accessible label: PRUnreadDot in `pr-read-affo…
Add an Unread filter option to the PR list. The filter must show only PR rows where isPRRead(prReadMarks, item) is false. Connect it to the existing list filter control in the Tasks view, with a localized label. Add a test for the filte…
Passed Passed checks: 4 passed
Check name Status Explanation
Out of Scope Changes check Passed All changed files relate to the PR read-state feature in #38152:
- Core rule and tests: pr-read-state.ts, pr-read-state.test.ts, and src/shared/github/pr-read-mark.ts.
- Store wiring: `ui-slice-…
Docstring Coverage Passed Docstring coverage is 83.33% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentati…
Title check Passed The title clearly and concisely describes the main change: adding read/unread state for pull requests in the PR list.
Description check Passed The description covers the required sections and explains the user impact, implementation, rationale, testing, risk, compatibility, and rollback approach. It explicitly documents that visual proof and…
Full details: Out of Scope Changes check

Explanation

All changed files relate to the PR read-state feature in #38152:

  • Core rule and tests: pr-read-state.ts, pr-read-state.test.ts, and src/shared/github/pr-read-mark.ts.
  • Store wiring: ui-slice-contract-core.ts, ui-slice.ts, ui-slice-pr-read-actions.ts, ui-slice-hydration-sanitizers.ts, ui-slice-hydration-values.ts, persisted-ui-write-baseline.ts, and use-persisted-ui-writer.ts. These carry prReadMarks through the store, hydration, and the persisted write path.
  • Persistence and sync: persisted-ui-state-types.ts, client-ui-params.ts, and wsl-move-ui-dispositions.ts. The disposition entry classifies the new persisted field. The issue requires persistence in shared UI state.
  • UI: Rows.tsx, pr-read-affordances.tsx, and use-task-page-github-list-projection.ts. These render the dot, labels, row actions, and first-list adoption.
  • Localization: en.json adds four keys for the new labels and actions.

The PR description states that the Dock badge and Activity view are excluded. This matches the issue's suggested first-step scope. No change in the diff touches those surfaces. No unrelated change was found.

Full details: Docstring Coverage

Explanation

Docstring coverage is 83.33% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 12 functions across 16 files. (1 skipped: 1 unsupported.)

Full details: Description check

Explanation

The description covers the required sections and explains the user impact, implementation, rationale, testing, risk, compatibility, and rollback approach. It explicitly documents that visual proof and the local build were not completed.

Full details: Linked Issues check

Explanation

Directly linked issue #38152 is active (state: open). Its coding requirements are assessed below.

Implemented at head 9f915e9:

  • Unread indicator with accessible label: PRUnreadDot in pr-read-affordances.tsx is rendered in Rows.tsx. githubWorkItemPillLabel appends ", unread" to the pill label, so the state is not color-only.
  • Mark read on open: markPROpened runs on click, Enter, and Space in Rows.tsx.
  • Per-row Mark read / Mark unread: PRReadMenuItem is added to the PR row menu, backed by markPRsRead and markPRsUnread.
  • Re-raise on change: prActivityMark uses updatedAt as version. It also records failed check runs (checks) and PR state. isPRRead returns false when any of these differ from the stored mark. A check run settling to success does not re-raise.
  • Persistence and scoping: prReadMarks is stored in the persisted UI state. prReadKey includes host, repository identity, and provider ID. Hydration is validated by PRReadMarksSchema. Marks are bounded at 500 entries.
  • Automated tests: pr-read-state.test.ts covers the key separation, re-raise rules, bounded writes, and adoption.

Unmet requirement:

  • The issue requests an Unread filter so the PR list can be narrowed. The objectives and the PR description state that this filter is not added. The changed-file set has no filter logic. The diff of use-task-page-github-list-projection.ts adds only the adoption effect and no filter.

The linked issue objectives are otherwise met by the code above. The Unread filter is the only concrete gap.

Resolution

Add an Unread filter option to the PR list. The filter must show only PR rows where isPRRead(prReadMarks, item) is false. Connect it to the existing list filter control in the Tasks view, with a localized label. Add a test for the filter predicate. If the maintainers decide the filter is out of scope for this PR, record that decision on #38152 and split the filter into a follow-up issue. Then this check can pass on the remaining requirements.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4d6cdc92-2dea-4cc2-a7dc-1009982cea6b
Commits

Reviewing files that changed from the base of the PR and between c866025 and 9f915e9.

Files selected for processing: 17
  • src/renderer/src/app-shell/use-persisted-ui-writer.ts
  • src/renderer/src/components/task-page/github/Rows.tsx
  • src/renderer/src/components/task-page/github/pr-read-affordances.tsx
  • src/renderer/src/components/task-page/github/use-task-page-github-list-projection.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/store/slices/persisted-ui-write-baseline.ts
  • src/renderer/src/store/slices/pr-read-state.test.ts
  • src/renderer/src/store/slices/pr-read-state.ts
  • src/renderer/src/store/slices/ui.ts
  • src/renderer/src/store/slices/ui/ui-slice-contract-core.ts
  • src/renderer/src/store/slices/ui/ui-slice-hydration-sanitizers.ts
  • src/renderer/src/store/slices/ui/ui-slice-hydration-values.ts
  • src/renderer/src/store/slices/ui/ui-slice-pr-read-actions.ts
  • src/shared/github/pr-read-mark.ts
  • src/shared/persisted-ui-state-types.ts
  • src/shared/rpc-contract/client-ui-params.ts
  • src/shared/wsl-move/wsl-move-ui-dispositions.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.


/** Opening a PR is reading it; the mark still re-raises once the row moves past it. */
export function markPROpened(item: GitHubWorkItem): void {
useAppStore.getState().markPRsRead([item])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor · Functional Correctness · Quick win

Restrict markPROpened to PRs.

TaskPageGitHubRows calls this helper when an issue row opens. The store accepts the issue and persists a read mark for it. After enough issue opens, those marks can displace PR marks from the 500-entry limit. Check item.type before calling markPRsRead. (raw.githubusercontent.com)

number: item.number
})
}
aria-label={githubWorkItemPillLabel(item, isUnreadPR)}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor · Functional Correctness · Quick win

Supported by static analysis

Script executed:

sed -n '60,170p' src/renderer/src/components/task-page/github/Rows.tsx
cat src/renderer/src/components/task-page/github/pr-read-affordances.tsx
git diff 2724b031660d948d7627f8f342b186aa54514752 HEAD -- src/renderer/src/components/task-page/github/Rows.tsx | head -150

Repository: stablyai/orca

Length of output: 12484


Script executed:

sed -n '145,350p' src/renderer/src/components/task-page/github/Rows.tsx
rg -n -F --glob '*.tsx' -e 'PRUnreadDot' -e 'githubWorkItemPillLabel' -e 'aria-label' src/renderer/src/components/task-page/github

Repository: stablyai/orca

Length of output: 11949


Include the unread state in the row's accessible name.

The row is a div with role="button, and its accessible name comes from its content. The aria-label on the generic number-pill span does not add “unread” to that name. The unread dot is also hidden from screen readers. Add localized screen-reader text inside the row, or provide a complete accessible label on the row itself.

tabIndex={0}
onClick={() => openGitHubDetailPage(item)}
onClick={() => {
markPROpened(item)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor · Functional Correctness · Quick win

Mark a PR read when its checks detail opens.

PRChecksCell stops click propagation and calls openGitHubDetailPage(item, 'checks') through its onOpen callback. That path bypasses this row handler, so opening a PR through its checks pill leaves it unread. Mark the PR in the shared detail-opening path, or mark it in the checks callback. (raw.githubusercontent.com)

Comment on lines +156 to +162
const adoptedPRsRef = useRef(false)
useEffect(() => {
if (adoptedPRsRef.current || filteredWorkItems.length === 0) {
return
}
adoptedPRsRef.current = true
useAppStore.getState().adoptPRsAsRead(filteredWorkItems)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Major · Functional Correctness · Heavy lift

Supported by static analysis

Script executed:

sed -n '130,175p' src/renderer/src/components/task-page/github/use-task-page-github-list-projection.ts
rg -n 'useTaskPageGitHubListProjection' src --glob '!*.test.*'

Repository: stablyai/orca

Length of output: 3027


Script executed:

rg -n -F -e 'adoptPRsAsRead' -e 'markPRUnread' -e 'markPRsUnread' -e 'Mark unread' -e 'prReadMarks' -- src/renderer/src | head -n 80
ast-grep run --lang typescript --pattern 'adoptPRsAsRead: $$$' src/renderer/src 2>/dev/null | head -n 120
rg -n -F -- 'useTaskPageGitHubListProjection(stage23)' -e 'stage23' src/renderer/src/components/task-page/TaskPage.tsx | head -n 40
sed -n '55,75p' src/renderer/src/components/task-page/TaskPage.tsx

Repository: stablyai/orca

Length of output: 5200


Script executed:

rg -n -F -e 'function adoptablePRs' -e 'function markPRRowsRead' -e 'function clearPRRowsRead' -e 'const adoptablePRs' -e 'const markPRRowsRead' -e 'const clearPRRowsRead' -- src/renderer/src || test "$?" -eq 1
sed -n '1,60p' src/renderer/src/store/slices/ui/ui-slice-pr-read-actions.ts
rg -n -F -e '<TaskPage' -e 'TaskPage' -- src/renderer/src --glob '!*.test.*' | head -n 40

Repository: stablyai/orca

Length of output: 7039


Script executed:

sed -n '1,120p' src/renderer/src/store/slices/pr-read-state.ts

Repository: stablyai/orca

Length of output: 3640


Make PR adoption run once, and persist that boundary.

adoptedPRsRef resets each time useTaskPageGitHubListProjection mounts. TaskPage mounts only while the tasks view is active, and a relaunch also mounts it again. On each mount, the first non-empty list goes to adoptPRsAsRead, which marks every row that has no mark.

Marking a PR unread removes its mark. The next mount then marks that PR read again. A PR that arrives while the app is closed, or while another view is open, also has no mark, so the next mount marks it read before the user sees it as unread.

An explicit unread marker fixes only PRs the user marked unread. It does not fix PRs that were never marked. Persist a one-time adoption boundary in the shared UI state, so adoption does not run again on later mounts or relaunches. Choose the boundary's scope deliberately, for example per host and repository, to match how the marks are scoped.

Comment on lines +100 to +101
for (const key of keys) {
delete next[key]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Major · Functional Correctness · Heavy lift

Preserve an explicit Mark unread action across list visits.

markPRsUnread calls clearPRRowsRead, which deletes the PR’s only mark. When the list mounts again, its first-list adoption treats that PR as never marked and marks it read. The same reversal occurs after a restart because persistence stores the deletion. Persist an explicit unread state, and exclude it from adoption. (raw.githubusercontent.com)

Comment on lines +29 to +31
const unmarked = adoptablePRs(get().prReadMarks, items)
if (unmarked.length > 0) {
set((s) => ({ prReadMarks: markPRRowsRead(s.prReadMarks, unmarked) }))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Major · Functional Correctness · Quick win

Adopt only an initial PR list.

If the first nonempty list contains issues, this action stores issue marks in prReadMarks. The list hook also sets its one-time adoption flag for that issue list. If the user then switches to PRs in the same mounted list, the first PR list is not adopted and existing PRs appear unread. Gate the hook’s one-time adoption on the PR list, and reject non-PR rows in this action. (raw.githubusercontent.com)

@EwenQuim EwenQuim changed the title Read/unread state for pull requests in the PR list feat(tasks): read/unread state for pull requests in the PR list Nov 4, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Read/unread state for pull requests in the in-app PR list

1 participant