Repository navigation
fix: session creation targets the wrong Gateway after admission - #130686
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 27, 2026, 12:25 AM ET / 04:25 UTC. ClawSweeper reviewWhat this changesThe PR binds agent-triggered session creation to the Gateway that admitted the run and rejects the call if that Gateway is replaced before dispatch or result settlement. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessNo blocking correctness finding: the branch repairs a current-main Gateway-affinity gap, but this maintainer-owned, protected PR should remain open for human review and exact-head CI completion. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — step 1 Assertions:
How this fits togetherBuilt-in agent tools can make Gateway requests in process. An admitted run supplies the intended Gateway binding, which session creation uses to create and return a child session safely. flowchart LR
A[Admitted agent run] --> B[Captured Gateway binding]
B --> C[Session creation tool]
C --> D{Binding still current?}
D -->|yes| E[In-process Gateway dispatch]
D -->|no| F[Reject unavailable Gateway]
E --> G[Session creation result]
Decision needed
Why: The PR changes an authority-sensitive routing boundary and carries the protected maintainer label, so final acceptance requires explicit human judgment. Before merge
Agent review detailsSecurityNone. PR surfaceSource +12, Tests +153. Total +165 across 2 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: Retain the creation-specific use of the canonical admitted-Gateway binder, then land only after exact-head CI confirms the focused regression and changed gate. Do we have a high-confidence way to reproduce the issue? Yes, source reproducible: current main dispatches this creation path without an admitted resolver, and the dispatcher otherwise selects its ambient context. The focused branch regression encodes the two-Gateway scenario, but was not executed in this read-only review. Is this the best way to solve the issue? Yes. The patch extends the existing binding and settlement-revalidation path while preserving the specialized trusted-creation fallback; moving this decision into the generic dispatcher would broaden unrelated request owners. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 5e193d50ad8b. LabelsLabel changes:
Label 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
|
|
Fixed: Agent-created sessions now stay bound to the Gateway that admitted the run and fail closed after replacement. |
…-retirement-v13 * origin/main: (243 commits) fix: preserve Gateway error reasons in text logs (#130645) refactor(video): deduplicate generation contracts (#130635) fix(agents): preserve direct-message sender identity (#124548) fix(agents): preserve silent reply after settled tools (#130675) fix(talk): preserve replacement speech when an old utterance is canceled (#130687) fix(browser): preserve literal names and formatter-owned snapshot refs (#130599) fix(auth): reset only the profile replaced by a successful login (#124014) fix: bind session creation to admitted Gateway (#130686) refactor(qa-lab): reuse model reference splitter (#130317) docs(gateway): clarify independent HTTP endpoint switches (#130690) fix(ui): Control UI smooth scrolling ignores the reduced-motion preference (#130428) refactor(lmstudio): remove unreachable catalog merge (#130689) fix(crabbox): restore cloud machine CPU and RAM (#130684) fix(secrets): compare proxy bearer tokens directly (#127054) fix(matrix): show recovery key availability in text status (#128051) fix(ios): restore approval settings navigation and remove duplicate shell state (#130651) refactor(agents): use fixed tool-loop defaults directly (#130681) refactor(qa-lab): share process tree metric reader (#130419) refactor(models): simplify prepared owner access (#130683) fix(parallels): main install and update smoke cannot complete (#130658) ...
Session creation now remains bound to the Gateway that admitted the agent run and fails closed if that Gateway is replaced before dispatch or completion.
Follow-up to #130112
What Problem This Solves
Fixes an issue where an agent creating a session could dispatch
sessions.createthrough a different in-process Gateway when the ambient Gateway changed after
the agent run was admitted.
Why This Change Was Made
Session creation now uses the same admitted-instance binding and settlement
revalidation as the other in-process Gateway tool paths. The request stays on
the Gateway that admitted the caller or fails closed if that Gateway is replaced
before dispatch or before the asynchronous result settles.
The transport fallback, signed visible-spawn policy, timeout and abort handling,
least-privilege scopes, trusted creation provenance, and model-authored request
parameters retain their existing boundaries.
User Impact
Agent-created sessions remain attached to the Gateway that owns the admitted
run. A retained tool cannot silently create the session through another active
Gateway after replacement.
Evidence
a87fb08e70e3e562c1056da6cf25372b6c64a383because session creation omittedthe admitted resolver and selected the ambient replacement Gateway.
153cc87b6f23a887e4e34c7edaed87900cb543e8.tbx_01m10qc1d1je4yk56m8vtyvdm5,https://github.com/openclaw/openclaw/actions/runs/33039301825.
FETCH_HEADto equalthe exact candidate, and verified that the published and synced trees both
equal
fff54b4d61c1d752df84d054bfe74ff361405bbbbefore testing.src/agents/tools/in-process-gateway.test.tspasses 13/13.core, coreTestscheck:changedplan passes, includingproduction and test types, formatting, oxlint, import cycles, and repository
guards.
replacement rejection before dispatch, and revalidation after both fulfilled
and rejected asynchronous completion.
test-audit obligations satisfied, and found the resolver-forwarding repair and
corrected regression sound.
origin/mainate87fcb0850697e747e1c73f414aabe4bd6155531has no intervening changes in either scoped file.
+22/-10(net+12). Tests:+153/-0.in refactor(sessions): canonical lineage model — creation provenance, fork ancestry, generation chain, typed row contract #111861 on July 23, 2026; fix: dashboard tools target the wrong Gateway after admission #130112 made the admitted resolver available to
this path but did not forward it through creation dispatch.
Visual proof is not applicable because this changes backend Gateway ownership
without changing rendered UI. The two-Gateway dispatch regression is the direct
behavioral proof.