Skip to content

fix(sidebar): accept final answers after skipped finishes - #1802

Merged
devswha merged 1 commit into
mainfrom
fix/done-dot-repeat-finish
Oct 24, 2026
Merged

devswha merged 1 commit into
mainfrom
fix/done-dot-repeat-finish

Conversation

@devswha

@devswha devswha commented Oct 24, 2026

Copy link
Copy Markdown
Owner

Fixes #1693. Picks up 78093f11e from the local branch fix/done-dot-skipped-finish (never pushed, no PR) unchanged, on a branch from the latest main. Authorship is kept.

Summary

  • src/lib/panePresentation.ts ConversationFinishEvidence.accept: two branches refused a finish when finishes had been skipped while no browser showed the pane (id > known.id + 1), or when the saved previous finish carried no answer (read in Terminal). Instead they stored a baseline and waited for a different answer, which an agent at rest never writes, so the DONE dot stayed for good. Both branches are gone: the final answer in front of the reader is bound to the current finish. These guards stay:
    • a stale lower id;
    • the same answer as the previous finish;
    • an answer not newer than the previous finish's answer;
    • a cached response (conversation === before).
  • src/lib/panePresentation.test.ts:
    • finish 10 after finish 4 is accepted on the first fresh read that shows a newer answer;
    • finishes 5 and 10 after a saved finish 4 with no answer proof are accepted.
    • The existing skipped-scope case now expects the skipped finish to be accepted, so a later, different answer for the same finish is refused.
  • changelog.d/done-dot-skipped-finish.md.

One trade-off is kept: a fresh read whose transcript lags behind herdr can bind an earlier final answer to the newest finish. This is the assumption the existing next-id path (id === known.id + 1) already makes. Here it replaces a dot that could never clear.

The pane that is also herdr's focused pane (the issue's server-side CompletionTracker.seen() note) is not changed here. Its dot clears through this client path once a browser shows the pane.

Design precedent

This follows T3 Code. A thread there shows an unseen completion while its latest run completed after the last visit (hasUnseenCompletion in Sidebar.logic.ts#L716-L725). Opening the thread moves its visit watermark up to the thread's latest update (ThreadVisitWatermark.tsx#L29-L68), so one visit clears every run that finished while away, however many there were. Ovis has no visit timestamp to compare herdr's finish ids with, so it keeps its own proof: the reader has the transcript's newest final answer in front. That proof now covers every finish up to the current one.

Verification

  • With only src/lib/panePresentation.ts back at main, four tests fail: the two new cases (three runs) and the flipped skipped-scope expectation. They pass with this change.
  • src/lib/panePresentation.test.ts, src/lib/sidebarActivity.hook.test.ts, src/lib/seenFinishes.test.ts: 73/73.
  • bun run check fast.

Bind the final answer in front to the current finish instead of storing a lower baseline that cannot advance while the agent rests. Preserve stale ID, prior answer, and cached response guards, and cover skipped finishes and saved finishes without answer proofs.

Fixes #1693
@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between ceb4978 and 8f41c48.

Files selected for processing: 3
  • changelog.d/done-dot-skipped-finish.md
  • src/lib/panePresentation.test.ts
  • src/lib/panePresentation.ts

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

📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • Opening a finished chat now clears its DONE indicator when multiple turns finished while you were away, or when the previous finish was read in Terminal without a saved answer.
    • Newer finished responses are now recognized when earlier finish IDs were skipped, while older finishes and conflicting answers remain rejected.

The finish-evidence logic now allows a later finish ID to bind to the transcript’s final answer after existing proof checks. Tests cover skipped IDs and answer comparisons. A changelog entry describes clearing the DONE dot when opening a finished chat.

Changes: Finish evidence

Layer / File(s) Summary
Accept later finish evidence
src/lib/panePresentation.ts, src/lib/panePresentation.test.ts, changelog.d/done-dot-skipped-finish.md
The acceptance logic no longer rejects later finish IDs through the removed branches. Tests cover skipped IDs, answer comparisons, and saved finish evidence. The changelog describes the DONE-dot behavior.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: Low · up to 8f41c

In a timing-dependent skipped-finish case, the DONE dot can clear before the latest answer arrives and stay cleared. This is a bounded risk rather than a merge blocker.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: accepting final answers after skipped finishes.
Description check Passed The description explains the problem, resulting behavior, design trade-off, linked issue, and validation results. It uses Summary and Verification headings instead of the template's Change and Validat…
Linked Issues check Passed Issue #1693 requires the web UI to accept a newer finish after multiple unseen finishes. ConversationFinishEvidence.accept now binds the current final answer to the current finish without the skippe…
Out of Scope Changes check Passed The source change directly implements #1693. The test changes verify the new acceptance behavior and retained rejection guards. The changelog entry documents the same fix. No unrelated change is shown…
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. (1 skipped: 1 …
Full details: Description check

Explanation

The description explains the problem, resulting behavior, design trade-off, linked issue, and validation results. It uses Summary and Verification headings instead of the template's Change and Validation headings, but it provides the required information.

Full details: Linked Issues check

Explanation

Issue #1693 requires the web UI to accept a newer finish after multiple unseen finishes. ConversationFinishEvidence.accept now binds the current final answer to the current finish without the skipped-ID and missing-answer baseline refusals. The tests cover finish 10 after finish 4, finish IDs 5 and 10 after an answer-less saved finish, stale IDs, and repeated answers. The focused-pane server limitation is explicitly outside this client change and does not block the requested browser path.

Full details: Out of Scope Changes check

Explanation

The source change directly implements #1693. The test changes verify the new acceptance behavior and retained rejection guards. The changelog entry documents the same fix. No unrelated change is shown.

Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. (1 skipped: 1 unsupported.)

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Comment @coderabbitai help to get the list of available commands.

@devswha

devswha commented Oct 24, 2026

Copy link
Copy Markdown
Owner Author

Merge pass: a gate reviewer on a different model than the author's approved this, with high confidence for the scoped fix.

Checks: 73 tests across panePresentation, sidebarActivity.hook and seenFinishes pass, and so does the typecheck. A control run on main's implementation, in memory, reproduced the four expected failures.

Trade-off accepted. The reviewer confirmed it is real:

  • When finishes were skipped, an intermediate answer can acknowledge the newest finish (for example 10). The sidebar then clears before that finish's own answer appears, and the real answer is later refused for that already-bound id.
  • The old skipped-scope expectation guarded exactly this case, but it also caused Sidebar: a pane that finished more than once unseen can never be marked read #1693's DONE dot that never cleared.
  • How often this happens is unknown. With skipped ids there are more intermediate answers that can be picked up than on the next-id path, which takes the same risk.

The PR accepts this deliberately: a dot that may clear a little early is better than one that never clears. Cached-response guards still hold, and Terminal's separate presentation gate is unchanged.

Not run: browser QA. The persistence probe drove the real sidebar hook with simulated Chat presentation.

All required checks are green and no review thread is open.

@devswha
devswha merged commit cf09f70 into main Oct 24, 2026
9 checks passed
@devswha
devswha deleted the fix/done-dot-repeat-finish branch October 24, 2026 03:41
devswha added a commit that referenced this pull request Oct 28, 2026
…in (#2136)

## Change

Part of #1430 (DONE dot accuracy follow-ups from #1342): fixes item 4,
and maps every other item to where main already stands.

Codex dates the last assistant turn again when its `task_complete` lands
(`server/codex.ts` sets `end_ts`), and the answer fingerprint the DONE
dot is proved with includes that time. If the chat read finish N once
before the pane counted as presented (scrolled away from the end,
covered by a sheet, a retained hidden renderer) and `task_complete` then
moved `end_ts`, every later read of the same finish compared the whole
fingerprint and was refused. The dot stayed until the next finish.

- `src/lib/panePresentation.ts` `ConversationFinishEvidence.accept`: for
the same finish id, an answer whose proof identity (source, history,
turn start and final text) equals the known answer still proves the
finish when only its completion time moved, provided the turn has a
native start time. The next-finish comparison already ignored the time
this way. Without a start time (`ts: null`, e.g. OpenCode without
`time.created`) two replies with the same text are indistinguishable, so
only an exact match counts there, as before. A different answer for the
same finish is still refused.
- `src/lib/panePresentation.test.ts`: a Codex answer accepted at
`end_ts` 00:00:05 and read again at 00:00:06 is still accepted for
finish 3, and another answer is not; with `ts: null`, an older reply
with the same text is not taken for the current finish.
- `changelog.d/done-dot-codex-late-completion.md`.

## Where the rest of #1430 stands on main

| Item | State |
| --- | --- |
| 1. Recovery joiner acknowledges the previous answer | Fixed by #1472
(`output-recovering` frame) |
| 2. A fresh response carrying the previous answer clears a newer finish
with no baseline | Not changed: this is the trade-off #1802 kept ("a
fresh read whose transcript lags behind herdr can bind an earlier final
answer to the newest finish"). While the agent works, a final answer on
screen can be the previous turn's or this turn's, written just before
herdr reports done. Refusing it would bring back a dot that never
clears. |
| 3. Dot never clears after skipped finishes / a Terminal read | Fixed
by #1802 (#1693) |
| 4. Codex completion metadata invalidates the proof | **Fixed here** |
| 5. Agents without native completion evidence keep DONE in Chat |
Documented, conservative; unchanged |
| Stale readiness comment, demo fakes the old order | Fixed by #1472 |
| Page-wide mutation observer | Gone: the observer now watches only the
chat scroller (`ChatView.tsx`) |

Still open from the smaller notes (filed as a follow-up, not changed
here): `Finishes.status()` stats the herdr socket on every status frame;
`clientSnapshot()` reads again without a bound when the epoch changes
mid-read; the phone's masked password field hides during recovery; no
browser regression for the masked-prompt detection during recovery.

## Verification

- `bun test src/lib/panePresentation.test.ts`: the new case fails with
only `panePresentation.ts` at main ("Expected: true, Received: false" on
the second read) and passes with the change.
- `src/lib/panePresentation.test.ts`,
`src/lib/sidebarActivity.hook.test.ts`, `src/lib/seenFinishes.test.ts`:
74 pass, 0 fail.
- The `ts: null` case fails on the first commit's implementation (21
pass, 1 fail) and passes on the second.
- `src/lib/panePresentation.test.ts`,
`src/lib/sidebarActivity.hook.test.ts`, `src/lib/seenFinishes.test.ts`
at the head: 75 pass, 0 fail.
- `dori heavy … bun run check run --build bun
scripts/sidebar-activity-demo-regression.ts`: 44 PASS, exit 0.
- `bun run check fast`: workflow syntax, generated files, typecheck,
build ok; unit tests 7,874 pass, 0 fail at the head (bbe4100).

## Reviews

- omo-native-code-reviewer: APPROVE, no CRITICAL/HIGH/MEDIUM. Its LOW-1
(`ts: null`) is fixed in the second commit; LOW-2 (the remembered answer
keeps the pre-`task_complete` fingerprint) was checked to leave the next
finish correct; LOW-3 is style.
- Codex Sol 6.1 Fast xhigh: BLOCK on the first commit with one MEDIUM
(the same `ts: null` case, reproduced); PASS on the second commit.
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.

Sidebar: a pane that finished more than once unseen can never be marked read

1 participant