Repository navigation
fix(chat): bind Resume to the displayed goal - #207948
freeqaz-openai wants to merge 2 commits into
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. |
|
Codex review: passed. What this changesThis PR binds fresh Control UI Resume requests to the displayed Goal state and preserves definite rejection outcomes. Example: One client prepares Resume for “Original checklist” while another edits the same Goal to “Edited checklist”.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR repairs a current stale-Resume bug and resolves the previous review finding. No blocking defect was found; it remains a draft. Reviewed head: Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherControl UI sends the displayed Goal digest through the Goal RPC to existing admission and transactional writers, which return either a continuation receipt or a rejection. flowchart TD
A[Displayed Goal] --> B[Resume request and digest]
B --> C[Gateway admission]
C --> D[Transactional Goal writer]
D --> E[Continuation and receipt]
C --> F[Stale request rejection]
D --> F
Technical reviewBest possible solution: Keep the displayed-state precondition in the existing admission and transactional Goal owners while preserving committed-request replay. Do we have a high-confidence way to reproduce the issue? Current-main source permits a delayed Resume after a same-ID objective edit, and the PR reports that exact two-client failure; this review executed no target code. Is this the best way to solve the issue? The patch repairs the existing Goal mutation boundary, handles equal-timestamp edits, and preserves receipt replay without adding another state owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 7a715e060ccf. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +125, Tests +168, Docs +12. Total +305 across 25 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed November 29, 2026, 12:29 AM ET / 05:29 UTC (Revision 2). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
What Problem This Solves
A delayed Resume can start a different task. A second client pauses and edits the objective while the first client's request is in flight. The Goal ID stays the same, so checking the ID alone lets the delayed request start the edited Goal.
User Impact
Control UI requires a snapshot of the displayed Goal for every fresh Resume. If the objective changes, refresh the chat, review the edit, and choose Resume again. This also works with Codex. It previously reported a definite refusal as a retryable outage. A request that already committed still returns its original receipt.
Why This Change Was Made
Admission checks a digest of the displayed Goal before launching a runtime. Otherwise, a rejected Codex attempt can pause an edited, active Goal. The writer repeats the comparison when it commits the continuation. The browser needn't save the objective text for recovery. Its local check distinguishes an active Goal from a newly displayed budget limit. The digest treats the budget projection as active because only the writer owns token accounting. It includes the timestamp, objective, status, budget and status note.
The runtime acknowledgment retains the typed persistence error if dispatch settles without committing. The same run-specific refusal prevents the failure handler from pausing the edited Goal. An unknown SQLite outcome or unreadable receipt remains uncertain. The UI and Gateway ship together. The capability flag and unguarded UI fallback were removed. Previously saved retries retain their original payload. Other clients can send the optional precondition.
Evidence
I compared disposable packaged Gateways with a real Codex CLI 0.172.0, SQLite, two authenticated connections and scripted inference. All builds included the same three separate worker and thread recovery changes. I compared the base, the initial patch, an intermediate fix and this revision. After a Gateway crash, I confirmed the original worker's reply and prepared Resume. A second client edited the same Goal before I sent the request.
53d813afthe request failed with retryableUNAVAILABLEand no reason.d2956248both the active edit and the pause-then-edit returnedINVALID_REQUEST,GOAL_OPERATION_REJECTED,goal-rebound. Each kept its status, revised objective and original last-run ID. In each four-second check there was no new visible user input, lifecycle event or inference.get_goalread the revised objective and it finished in 1.55 seconds. Retrying that confirmed operation returned the same run ID. The four-second replay check observed no new run start or inference.The combined tree was
425af3fe0757463b41cb10389f916d17c0798a53. The other changes were #193024, #206821 and #207617. This trial required explicit Resume after the crash.I also tested an edit after admission. A temporary synchronization point held one request just before dispatch while the second client edited the active Goal. This test used a separate disposable copy of the packaged handler and checked both its original and restored hashes. The writer rejected Resume with
goal-rebound, and the persisted Goal stayed active and unchanged. There was no inference or new visible user input. A fresh, confirmed Resume read the edit and completed, and the subsequent replay made no model call. The timing hook is outside the PR.On the standalone change I ran the following with one worker. Durations include cold setup.
pnpm --dir ui test src/pages/chat/chat-goals.test.ts src/pages/chat/chat-view-goals.test.ts --maxWorkers=1passed 40/40 in 17.76 s.pnpm test src/gateway/server.chat-goal.test.ts --maxWorkers=1 -t 'stale|same completed Goal|refusal|definite|rejects a prepared retry'passed 6 selected cases in 203.05 s. The filter excluded 67 cases. The checks include an equal-timestamp edit, Codex approval and replay.pnpm test src/gateway/session-lifecycle-state.worker.test.ts src/gateway/session-lifecycle-state.test.ts src/gateway/session-lifecycle-persistence-owner.test.ts --maxWorkers=1passed 61/61 in 66.66 s.git diff --checkpassed. Session projection and storage suites passed 44/44 on the earlier head. Removing the UI status comparison made the budget-limit regression fail.An edit after admission can still produce a failed-run record and a chat error. The edited Goal retains its status. The guard cannot detect a return to identical compared state or freeze token usage in flight. Text commands are unchanged. There is no new storage, automatic restart, permission or protocol version.