Repository navigation
fix: let first chats wait for agent startup before authorization - #200510
Conversation
Co-authored-by: RomneyDa <[email protected]>
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
|
Codex review: needs maintainer review before merge. What this changesThis PR waits for agent startup before capturing chat session authority while preserving the cancellation exception. Example: Send “Start a new conversation.” to agent:main:first-turn while main’s database is starting.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR addresses a source-supported first-chat startup failure with a focused change, and no actionable introduced defect was found. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherGateway chat admission turns an authenticated chat.send request into retained session authority before preparing and dispatching agent work. flowchart TD
A[Authenticated chat request] --> B[Resolve session target]
B --> C[Join startup readiness]
C --> D[Capture session facts]
D --> E[Authorize session access]
E --> F[Prepare and dispatch chat]
B --> G[Cancellation exception]
G --> D
Technical reviewBest possible solution: Join the existing readiness owner before capturing session authority, preserve cancellation and final checks, and qualify the corrected first-chat flow. Do we have a high-confidence way to reproduce the issue? Current-main source exposes the capture-before-startup ordering, and the added deterministic regression exercises real cold registration; the reported base failure was not independently executed in this read-only review. Is this the best way to solve the issue? The patch repairs the ordering at the existing authorization boundary without weakening identity checks or adding another state owner, and every introduced hunk serves that repair. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 6747b1ec5ae3. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +25, Tests +52. Total +77 across 3 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. LabelsLabel 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 Reviewed November 17, 2026, 4:14 AM ET / 09:14 UTC. |
…0510) Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit e10285f)
…0510) Wait for the existing startup owner before capturing chat authorization facts, while keeping ordinary and sanitized stop commands independent of startup. Recheck invocation authority after the wait. Release adaptation: use waitForAgentDatabaseWriteAdmission, the signed baseline input-preparation contract, rather than importing the later input-recovery stack from #187822. Remove only newer recovery fields from test fixtures. No schema, persisted state, permission, or recovery contract is added. Self-review: the existing startup owner retains completion and timeout custody; existing authorization cleanup and currency checks remain in force. Companion audit through c8d5cf5 found no later required repair; sibling assessments absent. (cherry picked from commit e10285f) Co-authored-by: RomneyDa <[email protected]>
…nclaw#200510) Co-authored-by: RomneyDa <[email protected]>
What Problem This Solves
A first chat sent while its agent database is starting can fail with “session changed before chat.send” before reaching the provider. Session authorization captures an absent database, then ordinary chat preparation joins startup and observes the database registration as an unrelated change.
User Impact
First messages join the existing startup readiness boundary before capturing session authority.
/stopremains usable without waiting for startup. No configuration loading, database schema, registry acceptance, permissions, or revocation rules change.Why This Change Was Made
Join the existing input-readiness owner before capturing chat session facts, and recheck the invocation afterward. Keep the later preparation guard. Cancellation uses the existing message sanitizer and abort parser; suppressed commands and goal inputs still join readiness.
This is a new, isolated correction on main, not a revival of closed #200474. It includes none of that PR’s receipt-sharing or actor-acquisition changes. The earlier receipt experiments did not clear the original failure.
Evidence
4c61c20fb1a7e0e98c994ec48b16284f2dd8ce0a: cold registration fails withSESSION_MUTATION_AUTHORIZATION_CHANGED; absent/admitted controls pass (1 failed, 2 passed). The barrier invokes the actual startup cold-open operation through the readiness observation, without sleeps./stopduring pending startup, sanitized stop text, command suppression, and goal intent. The initial all-chat wait was rejected by this regression before publication.git diff --check, and 12 GiBpnpm tsgo:corepass.Not yet release-qualified: hosted CI, verified merge, release backport, and a fresh exact-candidate FRV remain outstanding.