Repository navigation
fix(agents): restore system-agent delegation in channel turns - #128084
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 23, 2026, 1:33 AM ET / 05:33 UTC. ClawSweeper reviewWhat this changesThe PR stops isolated system-agent inference probes from inheriting a channel turn’s plugin-runtime generation and adds focused regression plus ephemeral-Gateway QA coverage. Regression provenancePossible regression — probable (reviewed change; failure trace). No predecessor PR is attributed. Merge readinessKeep open: current main still unconditionally inherits the ambient generation, while this PR narrowly excludes it only for isolated read-only probes. No blocking patch defect found; exact-head CI and maintainer review remain before merge. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: FAIL (partial) — step 2 Assertions:
How this fits togetherChannel turns run an embedded agent under the runtime generation admitted by the Gateway. First-use system-agent delegation launches a separate read-only inference probe whose result returns through the delegate tool to the channel reply. flowchart LR
A[Channel turn] --> B[Admitted runtime generation]
B --> C[Delegate tool]
C --> D[Isolated inference probe]
D --> E[Read-only runtime snapshot]
E --> F[System-agent result]
F --> G[Channel reply]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +11, Tests +64, Other +120. Total +195 across 5 files. View PR surface stats
Review metrics
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 generation distinction at the embedded-runner owner, with the focused guard regression and ephemeral-Gateway channel scenario protecting isolated probes without weakening ordinary admitted-generation propagation. Do we have a high-confidence way to reproduce the issue? Yes: current main’s unconditional ambient fallback and the isolated caller/identity guard establish the failure path, while the focused regression constructs the distinct snapshots that trigger it. Is this the best way to solve the issue? Yes: the embedded runner owns ambient generation inheritance, and this condition preserves explicit generations plus normal nested runs while isolating only read-only probes. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against f5553a8fee0e. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
…aw#128084) * fix(agents): isolate probe runtime generation * test(qa): prove channel system-agent delegation --------- Co-authored-by: VACInc <[email protected]> Co-authored-by: RoboClaw <[email protected]>
Closes #128074
Summary
High Level TLDR
Fresh setup-inference probes launched from a channel turn inherited that turn's admitted plugin generation. The probe's intentionally isolated runtime snapshot then failed the generation guard before the delegate tool could reach the system agent. Isolated read-only runs now start without an ambient generation while ordinary nested runs and explicit generations retain their existing behavior.
Root Cause
runEmbeddedAgentfell back to the ambientAsyncLocalStorageplugin generation for every nested run. Channel reply execution establishes that scope, while setup inference intentionally acquires a separate read-only runtime snapshot. The existing owner guard correctly rejects metadata from a different snapshot, so the inherited generation made the probe fail at the runner boundary.The focused pre-patch regression test reproduces the exact guard failure. Redacted live runtime records also showed delegate calls terminating at this guard before the patch.
Scope
Verification
node scripts/run-vitest.mjs src/agents/embedded-agent-runner/run.prepared-harness-source-delivery.integration.test.ts --testNamePattern='starts an isolated probe outside its caller'failed withprepared model runtime replaced the admitted plugin generation.node scripts/run-vitest.mjs src/agents/embedded-agent-runner/run.prepared-harness-source-delivery.integration.test.ts— 11 passed.pnpm check:changed— passed.pnpm build— passed.autoreview --mode local— no accepted/actionable findings.Real behavior proof
I rebuilt and restarted the managed Gateway using the patched live checkout. The resulting embedded-agent bundle contains the isolated-read-only generation boundary, and the Gateway health check succeeded with the channel stack loaded. No external channel message was injected for this change, so the focused integration reproduction is the direct before/after proof.
What was not tested
pnpm test:changedrun was interrupted after its first two successful suite groups; it is not claimed as complete.What Problem This Solves
Fixes an issue where users delegating to a system agent from a channel conversation could receive no delegate result when setup inference started an isolated probe.
Why This Change Was Made
The embedded runner owns the generation inheritance rule. Making isolated-read-only runs opt out there preserves the admission guard and avoids caller-specific scope workarounds.
User Impact
Delegated system-agent inference can complete from channel turns instead of failing before the delegate reaches the system agent.
Evidence
The regression test fails on the previous behavior at the same guard reported in the issue and passes with the patch. The exact candidate also passed changed-file checks, the focused integration suite, a production build, and local automated review.