Skip to content

fix(gateway): child runs reject their own transcript access - #168285

Open
jaxonparrott wants to merge 1 commit into
openclaw:mainfrom
jaxonparrott:codex/independent-run-transcript-context
Open

jaxonparrott wants to merge 1 commit into
openclaw:mainfrom
jaxonparrott:codex/independent-run-transcript-context

Conversation

@jaxonparrott

@jaxonparrott jaxonparrott commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: an independently launched agent run can reject its own transcript access when an in-process parent launches it while holding another session's writer claim.

User Impact

Child runs can prepare and access their own transcripts whether they start immediately or wait behind a busy session. Parent writer fences, stale-owner checks, and target-bound write guards remain enforced.

Why This Change Was Made

Clear only the caller's transcript-write context at the shared independent-turn entry point using the existing native helper. Keep all request, admission, authorization, lifecycle, and commit assertions intact. The new run acquires its own transcript owner through the existing flow; no new state or permission is introduced.

Evidence

The regression uses the existing agent-handler fixture and synthetic sessions to check idle child admission, queued child admission, and preservation of stale parent and captured post-commit guards.

Before extraction, a separate source-qualified checkout demonstrated all three regressions failing on the original entry point, then passing with this fix. Its complete agent-handler suite passed 393 tests, and related transcript/compaction/spawn/follow-up suites passed 125 tests. Those broader totals belong to that source checkout, not this upstream PR head.

Current upstream-head qualification is recorded below. No provider call, live handoff, deployment, or external delivery is claimed by these unit tests. Package builds and production mutations were outside this contribution's scope.

On official main 6d3f75a1baa71ea5f51db7150ba1eb2d6f067be1, isolated Railway qualification ran pnpm test src/gateway/server-methods/agent.test.ts --maxWorkers=1 -t 'foreign transcript owner': 3/3 passed (399 unrelated cases skipped), 235.32 seconds runner time and 236.654 seconds wall time, including 107.053 seconds cold worker preparation. Afterward, the redundant default <void> type argument was removed for current typed-lint rules; emitted behavior is unchanged. This timing includes the existing suite's import/startup cost; the queued and stale-parent cases themselves took 45 ms and 31 ms.

Formatting and git diff --check pass. Fresh independent source review found no blocking findings. The cold worker compiler reported upstream MDX/HAST module-directive and plugin-timing diagnostics; these are recorded separately from regression assertions and changed-file lint. Exact-head upstream CI completed: all applicable jobs succeeded, including test shards, production/test types, lint, and architecture checks; the aggregate CI gate reports success.

Final changed-file native typed lint passes with zero warnings/errors (264 rules, 38.8 seconds). Reviewed head: ec053c41edfc1ef4188a0a3c732e887e529b38f9. All three final source SHA-256 hashes match the isolated Railway source. No cumulative fork changes accompany this three-file contribution.

The exact-head CI gate is green. ClawSweeper review found no definite correctness defect or concrete bypass, but retains a security/proof hold until a real Gateway parent launches idle and queued children that access/persist their own transcripts, with final-effect rejection of a revoked caller before input commit and a replaced child writer before append. The existing mocked-handler proof does not satisfy that requested runtime composition, and no such proof is claimed here.

@clawsweeper

clawsweeper Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: M labels Oct 10, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 10, 2026
@clawsweeper

clawsweeper Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

This PR starts independent Gateway agent turns outside the caller’s transcript-write context.

Example: A run owning agent:main:dashboard:parent launches child-session in agent:main:main.

  • Before: The child inherits parent-run’s writer context and can reject its own transcript access with SessionTranscriptWriterClaimReboundError.
  • After: The child starts without the parent’s transcript context and acquires its own writer through the existing execution flow.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The focused repair has clear product value and no definite correctness finding, but required runtime proof is absent and authority composition remains unqualified; persisted formats and schemas are unchanged.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦐 gold shrimp (3/6) Security review found an item that needs attention.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: An independently launched child can fail before using its own transcript because it inherits its parent’s writer context.
Reason: The patch repairs the stated independent-turn contract at its shared owner without adding options, public API, or competing state.

Merge readiness

⛔ Blocked before merge - 3 items remain

Keep open: this PR provides a focused repair for inherited transcript ownership that current main still permits, with no definite introduced correctness defect found.

Priority: P2
Reviewed head: ec053c41edfc1ef4188a0a3c732e887e529b38f9

Before merge

  • Add real behavior proof - Authority-chain proof required: the full body and discussion supply mocked-handler qualification, not actual child transcript I/O. Provide redacted logs or terminal output from a Gateway parent launching idle and queued children that access and persist their own transcripts, plus rejection of a revoked caller before input commit and a replaced child writer before append. Preserve already-accepted work’s custody contract and redact IPs, API keys, phone numbers, and non-public endpoints. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve security review attention item - No concrete bypass was found; the remaining authority uncertainty is tracked in the merge risk.
  • Resolve merge risk - Before merge, establish that clearing ambient transcript and CLI-history authority preserves the final-effect rejection of revoked callers and replaced child writers.

Findings

None.

Tests

  • Missing end-to-end proof: Missing an actual parent-to-child run reaching transcript access and persistence with idle/queued success and final-effect authority rejection; baseline failures are reported only for a separate source-qualified checkout.
Agent review details

How this fits together

The Gateway turn service receives prepared requests and caller authority, then owns session admission, dispatch, completion, and cleanup.

flowchart TD
A[Parent agent tool] --> B[Gateway request authorization]
B --> C[Independent turn service]
C --> D[Session and input admission]
D --> E[Child runtime and transcript owner]
E --> F[Transcript storage]
E --> G[Completion and cleanup]
Loading

Technical review

Best possible solution:

Keep isolation at the shared independent-turn owner while preserving caller admission, acceptance transfer, and child-owned transcript fencing.

Do we have a high-confidence way to reproduce the issue?

Source shows captured caller context reaching independent dispatch and foreign-target rejection during transcript preparation; no current-main runtime reproduction was executed, and related reports include both failures and a successful narrower scenario.

Is this the best way to solve the issue?

The existing isolation helper at the shared turn owner addresses context leakage coherently without duplicating policy or removing explicit admission assertions.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against f207a608131a.

Merge-risk options

Maintainer options:

  1. Qualify isolation through the real owners (recommended)
    Record successful independent child execution and forbidden final effects through actual admission and transcript persistence owners.
  2. Pause pending authority evidence
    Retain the focused contribution without merging until the changed authority composition is qualified.

Provenance checked

  • Shared independent-turn entry changes intended behavior with a stated reason (0b1fc0e: The service extraction centralized transport-free admission, dispatch, settlement, and cleanup while conservatively preserving behavior.)
  • Transcript writer isolation keeps the original intent (c9b346e: Durable writer claims reject stale run-owned writes inside storage transactions; the PR changes context propagation while retaining that purpose.)

Testing

Proof path: in-process harness.

Security

Needs attention: No concrete bypass was found; the remaining authority uncertainty is tracked in the merge risk.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 0b1fc0e adds src/gateway/agent-turn/agent-turn-service.ts:43 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 0b1fc0e27990; files: src/gateway/agent-turn/agent-turn-service.ts)
  • Vincent Koc: Raw commit 7a168d3 adds src/gateway/agent-turn/agent-turn-service.ts:39 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 7a168d3d4bdd; files: src/gateway/agent-turn/agent-turn-service.ts)

PR surface

Source +6, Tests +216. Total +222 across 3 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 1 7 1 +6
Tests 2 216 0 +216
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 223 1 +222

Review metrics

Metric Value Why it matters
Production versus test growth Production +7/-1; tests and support +216/-0 A small shared-boundary repair gains distinct idle, queued, and stale-parent regressions without introducing production test seams.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: A bounded ownership failure can interrupt independently launched agent runs; no broad runtime outage is established.
  • merge-risk: 🚨 security-boundary: The change clears authority-bearing transcript and CLI-writer context across a session boundary whose final effects remain unqualified.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add final-effect proof for the revoked caller before input commit and the reassigned child writer before transcript I/O, alongside successful real child execution.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only; repair and merge need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-10T06:42:48.912Z sha ec053c4 :: needs real behavior proof before merge. :: none

Reviewed October 10, 2026, 2:51 AM ET / 06:51 UTC (Revision 2).

@jaxonparrott

Copy link
Copy Markdown
Contributor Author

Live downstream evidence (2026-10-10): the selected fork fa05b48 containing this fix is now deployed via Bramwell-Inc/jarvis#1509, merge ccd0f503f0c5c0768c279ea7187c6e507ffe3186, Railway deployment a54739b6-85cb-4580-9a55-2fab5540ef7c. Installed source, package integrity and build ID were verified.

A real GPT parent launched three configured Claude children (Opus/Sonnet). Each performed a real file-read, persisted exactly one final response and reached done. The parent yielded, received native completion settlement, automatically resumed and returned all three results. Neither parent nor children used history polling, retries, manual recovery or manual completion messages. This verifies actual provider-backed idle child persistence and automatic handoff on that selected fork, not on this exact upstream head.

Queued and negative-boundary qualifications remain separate. A synthetic native CLI queued fixture failed with cli_live_session_changed on both the prior 938 package and fa05; this is not a clean queued pass. A real same-parent explicit followup check instead rejected before admission with "Followup has no retained original caller policy." Its original child still completed and woke the parent normally. That separate native authority propagation path is being traced; no permissions were weakened or send replayed.

A reset canceled a held synthetic CLI child and left replacement storage unchanged, but did not observe the requested delayed stale-writer append rejection. Revoked-caller-before-commit proof also remains unclaimed. These receipts therefore do not remove the remaining runtime-composition review boundary.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: M status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant