Repository navigation
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review blockedAutomated review did not run, so no review verdict was produced. Reason: The input-safety check could not safely complete for this revision. ClawSweeper will not retry this unchanged revision. Next step: No contributor action is requested. Maintainers should inspect the linked workflow run. |
Retain unfinished agent inspections under the Gateway lifetime instead of turning a foreground timeout into a fatal startup error. Keep the agent degraded until inspection and guarded credential, session, and model preparation complete; cancel and join that work during shutdown. Preserve caller cancellation, propagate failures until background handoff, and keep inherited auth snapshots within their selected state directory. Thanks to @desksk for the report and offline integrity timings. Refs #150574, #141918, #142179, #150444.
|
Codex review: blocked before merge. Reviewed September 17, 2026, 2:51 AM ET / 06:51 UTC (Revision 2). ClawSweeper reviewWhat this changesLet Gateway serve healthy agents while slow database checks continue, then restore deferred agents after credential, session, and model preparation. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness⛔ Blocked before merge - 5 items remain The fix remains necessary on current main, but the previously reported custom-store startup failure is still present. The branch contains useful, coherent work and should remain open for correction. Priority: P1 Review scores
Verification
How this fits togetherGateway startup checks configured and registered agent databases before admitting their sessions. This change transfers unfinished checks to the Gateway lifetime while keeping affected agents unavailable until preparation succeeds. flowchart TD
A[Configured and registered databases] --> B[Two inspection slots]
B --> C{Foreground deadline exceeded}
C -->|No| D[Healthy agents serve]
C -->|Yes| E[Agent remains degraded]
E --> F[Background inspection and guarded preparation]
F -->|Success| G[Agent becomes available]
F -->|Failure or shutdown| E
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +884, Tests +910, Docs +37, Other 0. Total +1831 across 36 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the existing scheduler and guarded recovery owners, reconcile queued paths with registered ownership before handoff, and establish retained-state upgrade safety. Do we have a high-confidence way to reproduce the issue? Yes, from source: configure a registered custom SQLite store and let both active inspections exceed their foreground deadlines while its ownerless duplicate remains queued. The handoff throws before Gateway starts; this review did not execute that scenario. Is this the best way to solve the issue? Not yet. Retaining work under the existing Gateway lifetime is a suitable approach, but queued ownership must be reconciled before deferral and the changed upgrade path still needs evidence. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 14ff4df9dfca. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
f77c274 to
f0b5c56
Compare
|
Superseded by #150755. GitHub did not refresh this PR's recorded head after the branch force-push, and reopening failed because the recorded head commit was no longer on the branch. The replacement PR was created from the same branch at |
Closes #150574.
Related: #141918, #142179, #150444, #150564.
What Problem This Solves
Fixes Gateway startup aborting when an agent database inspection exceeds its wait budget without finding corruption.
Thanks to @desksk for the report and offline integrity timings that distinguished slow storage contention from database damage.
User Impact
The Gateway starts and serves healthy agents while an unfinished agent remains degraded with its reason and Doctor guidance. Its inspection continues in the background. The agent becomes available only after its credentials, sessions, and models are prepared. Genuine corruption leaves that agent degraded; shutdown cancels and joins retained work.
Shared-state database failures retain their existing behavior. There are no new configuration options, CLI flags, environment variables, dependencies, or SQLite schema changes.
Why This Change Was Made
At this PR's baseline, two fleet-preflight slots and a 635-second allowance for a 267.5 MiB database without sidecars are already on main but unreleased. The reporter's installed 2026.9.4 still has the older budget and concurrency. This PR fixes the remaining fatal timeout path; it preserves that scheduler, budget formula, and supervisor policy.
The existing inspection scheduler now separates its foreground wait from native worker cancellation. Startup transfers unfinished inspections to the Gateway lifetime and records agent admission refusals. Recovery uses the existing secrets, session, and model owners under current file, roster, configuration, and publication authority before clearing a refusal. Caller cancellation still cancels the native readers, and failed inspections remain foreground errors until their background handoff succeeds.
The Gateway startup owner composes this admission lifetime with the Linux spawn broker from #150564. Broker readiness precedes core startup. Admission remains registered in the existing Gateway lifetime-sidecar registry; the outer broker cleanup also joins that same admission if core cleanup fails before reaching its sidecars. Deferred preparation re-enters only the captured broker context, preserving its private database-preparation authority.
Evidence
Gateway failed to start: SQLite schema inspection timed out after 0.001 seconds. The original database bytes were unchanged./healthz: healthy agents serve while a slow agent is refused, preparation completes before recovery, corruption stays agent-local, queued peers recover independently, and shutdown joins native work.healthz=200while the slow agent isagent-database-inspection-pending; readmission clears only after credential/session/model preparation, and a command spawned during preparation has the broker as its parent. Removing the broker-context capture fails this parent-process assertion.pnpm install --frozen-lockfile,pnpm check:changed, andpnpm buildpassed on the composed candidate. No lint substitute or baseline edit was needed.--mode branch --base origin/main --max-priority P1returnedscoped-cleanon the committed head.Proof uses isolated state directories and free ports with deterministic native-child pauses and the existing budget seam. It does not claim a physical slow-volume benchmark or a shipped-driver respawn reproduction.
Ownership and line-count tradeoff
Production: +1,092 / −198 (net +894, 26 files). Tests: +1,113 / −18 (net +1,095, 9 changed files). Docs: net +37. Generated Swift protocol: +2 / −2 (net 0).
Production growth owns the previously missing transfer from CLI preflight to Gateway lifetime, agent-specific pending admission and cancellation, and guarded recovery through existing credential/session/model preparation. It also prevents an unavailable inherited auth store from taking healthy agents down. The existing scheduler remains the concurrency owner. The broker composition adds 10 net production lines, reuses the same idempotent admission stop operation, and removes the reused-scope early return that skipped failure cleanup; it adds no parallel work registry.