Repository navigation
Conversation
…when they began, not by a stamp the host may leave stale A host `done` can arrive with an `updatedAt` hours older than the mirrored `working` it ends while carrying the current turn's `stateStartedAt`. The mirror kept whichever row had the newer `updatedAt`, so the client showed `working` until the next turn. Between two rows from the same host, a state change with a newer `stateStartedAt` now wins; a client-owned pane still keeps its fence. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
e1fe34a to
3cfe6b6
Compare
|
Withdrawing this draft after comparing it against the existing host-side fix in #29538 and the related proposals #25205 and #20692. The decisive regression is in this PR: the current host's trailing-Muse-spinner scenario publishes a valid I ran the existing host regression fixture, then replayed its projected timestamps through the renderer's real snapshot/store test harness. Current main and the merge conditions proposed in #25205 and #20692 pass that case; this branch fails it. This is automated fixture evidence, not a live paired-app capture, and does not claim either complete PR has been validated. The reproducible rows, comparison results, and a regression test are contributed directly to #25205 here: #25205 (comment) Thank you to the authors of the existing reports and fixes. Keeping a competing implementation with this regression would add review work without a demonstrated benefit. The earlier passing tests in this PR did not cover this valid host projection, so they were insufficient evidence for its ordering assumption. |
ELI5
A paired client can keep showing an agent as working after the host reports that it has finished. This small change lets the client follow the host's newer state even when that state's last-update timestamp is older, and prevents a repeated earlier state from bringing the spinner back.
What Changed
Extend the existing host snapshot arbitration in
buildMirroredAgentStatusPatch. When two mirrored rows have different states and different state-start times, compare their state-start times in both directions. Keep the existing last-update comparison for ties and same-state updates, and preserve the existing client-ownership fence.The regression tests cover completion with an older last-update timestamp, replay of the preceding working state, acceptance of the next turn, rejection of an older completion with either an older or newer last-update timestamp, and preservation of client-owned working state.
Why
The existing separation between host snapshots and client-owned status provides the foundation for this fix. A host completion can retain an old
updatedAt, so that timestamp alone cannot order these transitions. Using the state-start times already present in the host rows keeps this adjustment local to the existing arbitration, without changing the host's published data or the client-ownership policy. Comparing in both directions also prevents an older working row from undoing an accepted completion.Linked Issue
Addresses #25136 for the case where the host's completion reaches the client but loses the timestamp comparison. This PR does not claim to resolve the separate orphaned-title or hidden-window synchronization cases described in that report, and deliberately does not close the entire issue.
Visual Proof
Pending before/after capture of the rendered client. This is a behavior change, so visual proof is not marked N/A. Opening as a draft until that requirement is satisfied.
The deterministic regression reproduces
working → done → replayed earlier working: before the correction the final state isworking; after it the final state staysdone, with no sort-epoch change. A subsequent new turn is accepted. These assertions supplement, rather than replace, the required visual evidence.Testing
Validated locally on Linux, with
ORCA_BACKGROUND_LAUNCH=1:pnpm tc:webpassed.pnpm run check:code-quality:changedpassed.git diff --checkpassed.Reproduce the focused test run:
ORCA_BACKGROUND_LAUNCH=1 pnpm test src/renderer/src/runtime/web-session-tabs-sync-remote-status-title-flap.test.ts src/renderer/src/runtime/web-session-tabs-sync-agent-status.test.ts src/renderer/src/runtime/web-session-tabs-sync-remote-main-agent-verdict.test.ts src/renderer/src/runtime/web-session-tabs-sync-unverifiable-host.test.tsx src/renderer/src/runtime/web-session-tabs-sync-agent-handoff.test.tsNo manual macOS, Windows, live SSH, or rendered Electron verification was performed for this revision. Full lint, all typecheck projects, the full test suite, and build are left to CI; they are not claimed as local passes.
AI Disclosure
Prepared with OpenAI Codex (GPT-6), including code review, implementation, regression tests, and this PR description.
Review
AI-assisted self-review: this extends the existing arbitration rather than adding a second status store. The host remains the source of mirrored status; live client ownership keeps its existing precedence. There are no new IPC fields or protocol changes, so older peers continue to use the existing row shape. The change is provider-neutral and introduces no OS calls, path assumptions, git-provider logic, or worktree-only dependencies; folder workspaces use the same path. Remote/SSH behavior is covered by simulated host snapshots, not a live connection test. Mobile and other status readers are unchanged and have not been manually verified. The per-row comparison remains constant-time. No new data access, network exposure, or credentials are introduced. Visual correctness still needs the before/after verification noted above.
Agent skill upstream boundary
Notes
Rebased onto
origin/mainatdc735050b3c6. The scope is limited to host-mirrored transitions with distinct state-start times; same-state updates and equal timestamps retain the existing behavior.Related work and remaining evidence
Thank you to the authors of the existing reports and fixes in this area. This draft should be evaluated alongside:
Our controlled tests establish the client behavior when state-start ordering and last-update ordering disagree. They do not establish that a current host still produces those rows after #29538, or that this is the cause of every report in #25136. A captured current-host/client reproduction (or a concrete older-peer compatibility case), plus the required visual evidence, remains necessary before presenting this draft as ready. If the host-side correction already covers the observed case, this additional client change may be unnecessary. No implementation from these PRs has been copied into this branch.
Author
GitHub: @Fede654. X/Twitter: @FedeB6209.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)