Repository navigation
refactor(studio): move the workspace's verdict state onto VerdictLedger - #2323
Merged
kantord merged 1 commit intoOct 15, 2026
Merged
Conversation
peppescg
approved these changes
Oct 15, 2026
peppescg
left a comment
Contributor
There was a problem hiding this comment.
Thanks Daniel. One ledger per surface means the Escape and button predicates can't disagree, and the two new tests fail on the old workspace as described.
Nit:
apps/web/src/features/chat/chat-workspace.tsx:2446:stopRun'sfinallystill clearscontrolPendingwithout checking the session, so a cancel started in session A that settles after a switch can release B's pending state mid-verdict, the same case your new test guards for verdicts. Capturingtarget.sessionIdand guarding withif (viewedSessionId.current === target.sessionId)would close it. Fine as a follow-up.
kantord
force-pushed
the
studio-followups/13-verdict-ledger
branch
6 times, most recently
from
October 15, 2026 13:00
924b44b to
89541d6
Compare
kantord
force-pushed
the
studio-followups/13-verdict-ledger
branch
from
October 15, 2026 13:26
89541d6 to
dde4722
Compare
The workspace kept four Sets and two epochs for ordinary and plan verdicts; it now reads one VerdictLedger like the side panel, with one approvalDisabled and approvalUncertain shared by the buttons, the detail panel, and Escape. Parity with the panel: a plan verdict blocked by an in-flight or uncertain verdict returns silently instead of calling the ask stale; a verdict only clears controlPending when its session is still viewed, and a session switch resets it. Adds settledAskKey(runId, askId) for the run/ask settled keys. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
kantord
force-pushed
the
studio-followups/13-verdict-ledger
branch
from
October 15, 2026 14:01
dde4722 to
9b788aa
Compare
Merged
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The workspace now reads one
VerdictLedger, like the side panel, instead of four Sets and two epochs. Escape and the verdict buttons read the same predicate, so they cannot disagree.Part of #2303 ("Tiny follow-up fixes"); it does not close it. This is PR 13 of 14 in a stack of draft PRs, reviewed and merged in order.
What changed
approvalDisabled,approvalUncertainandretainUncertainApprovalsread the ledger.controlPendingis reset in the session-switch effect.settledAskKey(runId, askId)inchat-state.ts, used at the 5 workspace sites and 2 reducer sites (the remaining\u0000keys are authorization keys and are left alone).verdict-ledger.tsis updated.Behavior changes
Documented parity fixes with the side panel: (1) a plan verdict blocked by an in-flight or uncertain verdict, or by identity, returns silently instead of showing the "stale" error; (2)
setControlPending(false)after a verdict is guarded by "session still viewed"; (3) the workspace recordsacknowledge()in the ledger (bookkeeping, no test can observe it). Two edges become stricter: a stream retract or approval event now resets the ledger for the whole ask (also dropping an in-flight phase, as in the side panel), and the plan card's disabled state includes the identity checks (its buttons were already hidden in that case).Verification
Biome, typecheck, the full Studio test suite and
pnpm generated:checkpass on this branch, run on the assembled stack. The full Playwright suite passes on the stack tip (122 passed, 30 skipped, 0 failed, includingchat-approvalagainst a realmecatedbuild). Two new tests fail on the pre-change workspace: a racing plan double-click on workspace and side panel sends one POST and shows no "stale" text; a session switch with held verdicts enables the new session's asks, and the old verdict settling does not release the new session's pending state. The cross-session scenario is covered by happy-dom only; the Playwright spec does not switch sessions mid-verdict.Not included
Removing
settledAskKeysfrom the workspace: stream settle events reset the ledger to idle, so without it a replayedpermission.askwould bring back a ghost card. The shared hook (next PR).Fully or partially written by an AI agent.
🤖 Generated with Claude Code