Repository navigation
fix: resume sessions with trusted runtime plugins absent at startup - #132804
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: found issues before merge. Reviewed August 29, 2026, 8:48 PM ET / August 30, 2026, 00:48 UTC. ClawSweeper reviewWhat this changesThe branch prepares trusted plugins selected by persisted sessions before execution, carries the resulting lease through Gateway, reply, embedded-agent, and cron paths, and routes cancellation through a dedicated lazy handler. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessKeep this PR open for maintainer review. The runtime-owner and lazy-cancellation changes are coherent and covered by focused boundary tests, but the branch still edits the release-owned changelog without independently verifiable release-owner approval, and current-main source could not be fetched for a final behavior comparison. Priority: P1 Review scores
Verification
How this fits togetherGateway and scheduled agent runs resolve a model and its trusted plugin owners before executing under a prepared lease. A chat cancellation request is dispatched by Gateway and should reach the cancellation owner without loading unrelated chat workflows. flowchart LR
A[Persisted session or cron job] --> B[Model and plugin selection]
B --> C[Prepared runtime lease]
C --> D[Gateway, reply, and cron execution]
E[chat.abort request] --> F[Lazy cancellation handler]
F --> G[Active run cancellation]
Decision needed
Why: The repository policy reserves changelog generation to the release process, while the PR body asserts an exception that could not be independently confirmed from the available discussion. Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +61, Tests +913, Docs +3. Total +977 across 48 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the single prepared-lease flow and dedicated cancellation handler, remove the release-owned changelog entries, and complete an exact-current-main compatibility check before merge. Do we have a high-confidence way to reproduce the issue? Yes, source provides a high-confidence boundary scenario: a persisted selected runtime absent from the configured startup registry must be acquired before execution, while disabled or untrusted owners must remain rejected. This review did not execute the scenario because the checkout is read-only. Is this the best way to solve the issue? Yes for the runtime and cancellation changes: selected owners are prepared at the lifecycle boundary and cancellation no longer imports unrelated chat workflows. The remaining changelog addition is not the repository’s normal release-note path. Full review comments:
Overall correctness: patch is correct AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 88c17a49b1cc. 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 (5 earlier review cycles)
|
30720b6 to
900f14c
Compare
900f14c to
8b56ea1
Compare
|
@clawsweeper re-review The configured owner now prepares the canonical subagent fallback chain before admission, addressing the remaining fallback-owner finding. Acceptance testing also exposed a cold cancellation delay; The PR body records the exact preintegration Linux tree (8/8 real Gateway E2Es), fresh rebased-head integration proof (128 passed, 7 existing skips), clean P0–P2 review, and the named zero-output cancellation classification follow-up. The initial cold-test oracle failure is disclosed separately from the final passing proof. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Carry the lease-selected immutable generation through Gateway, channel, embedded, and cron execution. Reuse only matching imported owners, preserve published metadata and inbound registries, and keep nested authority tied to the exact open parent lease. Consolidate cron preparation and execution on one selected lease using the same per-agent configuration projection, and remove the duplicate late acquisition and redundant scope wrapper.
6227604 to
b5038f7
Compare
|
Current-main compatibility closeout: a temporary, uncommitted merge of PR head This is focused local merge-result proof, separate from the green exact-PR-head hosted CI and earlier preintegration Linux build/E2Es. Existing Vitest 4.1.11 lacks main's newly added CLI argument-validation hunk; no package versions changed, the valid test arguments were unchanged, and dependencies were not reconciled. No new source changes or PR push were needed for this check. |
…penclaw#132804) * fix(agents): prepare selected runtime generations before admission Carry the lease-selected immutable generation through Gateway, channel, embedded, and cron execution. Reuse only matching imported owners, preserve published metadata and inbound registries, and keep nested authority tied to the exact open parent lease. Consolidate cron preparation and execution on one selected lease using the same per-agent configuration projection, and remove the duplicate late acquisition and redundant scope wrapper. * fix(agents): prepare configured subagent fallback owners * fix(gateway): dispatch cancellation through its lazy owner * test: repair runtime owner integration fixtures * test(qa): assert Matrix proxy cleanup by owner
What this fixes
A resumed session could select a trusted runtime harness absent from Gateway startup and fail before execution. The same ownership gap affects selected providers and fallbacks in replies and scheduled turns. Prepare those owners before admission freezes the selected generation, then carry that exact lease through execution and cleanup. Concurrent selections remain isolated; nested work can borrow only owners already contained in an open, matching parent lease. Published inbound registry metadata stays unchanged.
Cron now acquires one lease during preparation using the executor’s per-agent configuration projection. The duplicate late acquisition and obsolete generation-scope wrapper are removed. Explicitly disabled or untrusted plugins remain unavailable.
The configured runtime owner also inventories the canonical subagent primary/fallback chain alongside ordinary configured candidates. Automatic subagent sessions can choose that separate chain after admission; ordinary fallbacks already worked. Execution policy still narrows user overrides and locked selections, and the strict borrowed-generation guard is unchanged. Copying session policy into outer admission would use stale state after queue waits.
Acceptance testing exposed another owner-boundary defect: the first
chat.abortloaded unrelated chat history/send workflows before reaching cancellation. It now lazily dispatches directly to the existing abort handler. The old chat-map entry and single-use service wrapper are deleted; wire method, permissions, descriptor order, profile gate, and cancellation policy are unchanged. The auth-refresh fixture now captures the actual selected lease before ACK, proves it survives refresh, and proves the next lease is newer. It also records first-frame receipt directly and drains every RPC listener.Evidence
78e0c984952c3717cbb52a461a4a58cef6e4af70. Complete tracked bytes/paths/modes were guarded through install, build, and tests; both build-stamp checks remained unchanged. The owned lease stopped after completion. The subsequent preintegration commit differed only by one changelog bullet.check:changedpassed structural, formatting, all three unused-export scans, production/test types, lint, and ownership guards. The final test-only oracle correction also passed focused lint and E2E typechecking.5b532a78ee1f697aeb484104f0aa980501b8fc1bincorporates known shutdown/clipboard repairs. Among PR-touched paths, only changelog context and inherited pending-work dispatch code changed. Fresh integration proof at8b56ea1875ecb07f76053f07130eb1c48b46f777: 128 passed, 7 existing skips across 10 files, covering generation/fallback, auth refresh, lazy dispatch, suspension/node shutdown, config snapshots, registry diagnostics, state binding, and WAL. Dependency versions and lockfile are unchanged. Upstream state/bootstrap changes mean the retained Linux build is explicitly preintegration evidence, not a built test of this rebased head; exact-head hosted CI remains required before landing.622760472cc6471f983458c06cb7e0c74ca6b073removes the full policy mock, uses canonical lazy handler dispatch in the fixture, and combines identical pre-connect/health returns (net −3 production lines). 188 tests passed across 7 files, including the full 136-case chat suite in its original order and all 8 static-startup cases. The fixture now observes a refresh failure before waiting for hook entry: the same broken-mock error surfaced in 85 ms, instead of timing out at 120 seconds. Assertions and timeouts are unchanged. Canonical changed-file gates and a fresh Codex P0–P2 review passed on the final repair.622760472cc6471f983458c06cb7e0c74ca6b073. One justified refresh onto pinned main4db43443acc1f636550d39fccb3017340cc42c78resolves that conflict atb5038f732006a54f69ea24b06c546999340f92fc: all 45 non-changelog PR files retain identical blobs and modes, and the 46-path PR scope is unchanged. Fresh focused integration proof passed 185 tests across 6 files in 78.71s, covering auth ordering, prepared reply metadata and prompt bytes, configured/subagent fallback, WebSocket abort authorization, and pending-node lifecycle. Fresh Codex P0–P2 review found no actionable integration defects. The prior Linux proof remains preintegration; exact-head hosted CI is still required.454f371c1d3922c8135439e95548e0af15709227replaces that global availability check with the fixture’s recorded fulfillment of the real proxy stop, and deletes the unused helper. A deterministic competing listener reproduces the old falseEADDRINUSEafter confirmed owner closure. Negative controls prove that omitted cleanup still fails the closure assertion and unjoined cleanup still fails the existing ordering assertion. The full canonical QA shard passed 228 files, 3,127 tests, 3 platform skips on the final patch (279.37s Vitest; 286.34s wrapper). The local macOS private-QA artifact build completed in 4m39.5s before this two-file test-only patch; production bytes are unchanged. Scoped canonical checks, including extension-test types and lint, and fresh Codex P0–P2 review passed. This increment changes zero production lines and removes 12 net test/support lines. Final exact-head hosted CI passed on454f371c1d3922c8135439e95548e0af15709227: 176 successful jobs, 15 skipped, zero failures, attempt 1. The retained Linux proof remains explicitly preintegration evidence.thread.rs:330–415andthread_processor.rs:3519–3710. The original failure precedes native thread resumption. Final Codex P0–P2 review and independent integration-owner audit found no actionable defects.Review closeout and follow-up
ClawSweeper’s latest completed review found the runtime and cancellation repairs correct. Its changelog-removal rank-up move is intentionally skipped: the maintainer explicitly requested these user-facing release-verification fixes in the changelog. All existing main entries are preserved. Its exact-head CI requirement is satisfied by run 33283439682; the production-growth justification is below. The reported persistent-data heuristic points at
src/cron/isolated-agent/run.test-harness.ts: that diff replaces Vitest registry mocks with prepared-lease snapshots and a mocked release function; it does not change a store or schema.Named follow-up: zero-output cancellation is reclassified as blocked failure. Existing runtime owners record zero-output abort as blocked recovery state, and canonical terminal projection prioritizes blocked. The first cold test run passed 7/8 because its expected undispatched timeout contract was wrong. The corrected test requires the precise existing
error/failed/abortedresult, nestedaborted/blockedmetadata, no runtime error, and provider closure. No global terminal-precedence change or permissive multi-status assertion is included here.Production: +299/−201, net +98; tests/support: +1231/−355, net +876; changelog: +3. Production growth supplies immutable selected-generation ownership and configured candidate inventory. The final incremental fallback repair is net +12; direct cancellation routing is net −4. Duplicate execution-policy paths and wrappers were removed. This PR adds or changes zero config, environment, schema, protocol, or migration surfaces.