Repository navigation
fix(gateway): parent prompt cache misses when a subagent settles - #195378
AmoghAtreya wants to merge 16 commits into
Conversation
Announce, settle, and steer turns dropped the personal skill library from the deferred tool directory, so the parent prompt cache missed. Record the session listing and refuse those turns at execution instead. Co-authored-by: Cursor <[email protected]>
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
|
Codex review: needs real behavior proof before merge. What this changesPersist skill-library presentation in session entries and restore it for background turns while refusing personal-library execution without an admitted grant. Example: A parent conversation receives a spawned child's completion after the Gateway restarts.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 3 items remain This PR provides durable skill-library presentation that current main lacks; no actionable source defect was found. Reviewed head: Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherGateway turn preparation combines session-owned presentation facts with the current execution grant, then supplies tool definitions and guarded invocations to agent runtimes. flowchart TD
A[Human or completion turn] --> B[Gateway turn preparation]
C[Session entry owner] --> B
D[Admitted turn grant] --> B
B --> E[Stable tool definition]
E --> F[Execution gate]
F --> G[Personal skill library]
Technical reviewBest possible solution: Keep bounded presentation facts under the existing session owner and retain admitted grants as the sole authority for personal-library execution. Do we have a high-confidence way to reproduce the issue? Current-main source shows that Gateway authoring preparation returns no capability without a grant and stores no durable presentation; the original cached-directory mechanism was separately addressed by #197835, so the remaining reproducible boundary is presentation across completion and restart. Is this the best way to solve the issue? Using the existing session field store and execution gate fits the documented presentation-versus-authority contract without introducing another persistent owner or restoring the retired CLI helper. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against c44c610d3262. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +263, Tests +400, Docs +7, Other +1. Total +671 across 21 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes: No label changes. Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall readiness starts with the lower of the proof and patch scores. It is capped at 3/6 if the fix is partial, the change offers little benefit, a product decision is still open, or the PR reverses an earlier decision without saying why. ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (11 earlier review cycles; latest 8 shown)
Reviewed November 26, 2026, 10:09 PM ET / November 27, 2026, 03:09 UTC (Revision 12). |
…essions Admitted session entries are frozen, so writing the prompt listing onto them failed the turn. Keep the listing in the process map and the session patch, and ship the new module in the PR wrapper inventory. Co-authored-by: Cursor <[email protected]>
The fixture only had a session id, which shares no field with the listing parameter, so the gateway test typecheck rejected it. Co-authored-by: Cursor <[email protected]>
Human turns were writing the new listing onto the caller's session entry, including frozen cache rows. Persist it through the session owner and read the committed row instead. Co-authored-by: Cursor <[email protected]>
A sessionKey-only cache could erase or revive a listing after the store changed. Settle turns now follow the row that store published. Co-authored-by: Cursor <[email protected]>
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Thanks for porting this onto the latest I’m holding off on pushing any new commits so we don’t reset the |
Closes #195328
What Problem This Solves
A subagent completion must retain the parent conversation’s skill-library presentation while losing the human requester’s execution authority. Reconstructing that presentation only from a live grant or process memory leaves the Gateway without a durable record after restart.
User Impact
Conversations retain their skill-library tool shape across human and completion turns, including a listing recorded by the first chat. Personal-library calls still require a current human requester. Ordinary unsandboxed Workshop access remains available; sandbox and expired-authority restrictions remain enforced.
This changes security-sensitive authority handling. Fresh maintainer security approval is required on the final head before merge.
Why This Change Was Made
The existing session entry owns two bounded presentation facts (
multipleProfilesanddefaultTarget). The Gateway reads them through the session worker and commits them through the canonical session writer. First-chat creation records them atomically with the new session row; an earlier patch-only write had no row to update.The conflict port uses current main’s shared
src/agents/stable-skill-authoring.tsfor CLI and embedded runs. It preserves main’sexpired: truesemantics, transcript-followup expiry, and abort/cron/native-app lifecycle behavior. It does not restore the removed CLI-only helper. Current main’s turn-local deferred directory remains separate from the cached system directory.Original contributor work and ancestry by @AmoghAtreya are preserved. The maintainer updates port that work to the current owners and cover first-chat persistence. Release-note context: keep skill-library presentation stable without granting background personal-library access. There is no new config/default or SQLite schema version; the optional field uses the existing session
entry_jsonstore.Evidence
Reviewed and tested head:
a4d57cb71504a4d19b0070e29c398763b9e24017.Frozen main baseline:
cf9a9839e03ba76b526d9f61fe453e3ccc8a93a9.All execution used sanitized AWS machines with no instance profile, Tailscale, credential hydration, or forwarded secrets. Contributor code was not executed locally.
[email protected]created a real session; candidatedoctor --fix --non-interactiveexited 0; the stored entry remained byte-identical and retained its session ID and label; the candidate Gateway listed it after restart. The new optional field was absent in the stable row. This proof covers that session row, not an old transcript fixture.Retained failure and follow-up
The Gateway behavior assertions passed, but its suite failed during teardown with
shutdown step failed (gateway close): Plugin openai is retiring. A separate fresh machine at frozen main reproduced the same failure and stack (src/plugins/plugin-instance.ts:793→src/gateway/server-shutdown.ts:210). No checkout, HOME, or compiler cache was shared between the two heads. This is a named follow-up for Gateway/OpenAI plugin retirement after restart; it is not reported as a green suite or used to waive security/review gates.Main also refused the internal call using its existing expired-grant message. The baseline’s different refusal text is not evidence of a cache regression. The port preserves that existing boundary while adding durable Gateway presentation.
Exact proof receipts and review scope
{"head":"a4d57cb71504a4d19b0070e29c398763b9e24017","gateway":{"parentRequests":7,"stablePrefixAssertions":"passed","firstHumanListing":true,"internalPersonalRefused":true,"restartHumanPersonalAllowed":true,"suiteTeardown":"failed; matching isolated-main signature"},"stableUpgrade":{"baseline":"2026.11.2","doctorExit":0,"sessionIdPreserved":true,"entryBytesPreserved":true,"candidateGatewayListsSession":true,"entrySha256":"107d5cb655e5cce9fd2bb1428338b99ddcfccd6c00842193a7ce96e542bc6829"}}The first upgrade attempt stopped before session creation because the disposable fixture used a noncanonical device-identity path. It was corrected to the existing
client/credentials.sqlitecontract; only the upgrade proof was rerun on the unchanged candidate and its already completed build.Scope reviewed: Gateway dispatch/session creation → prepared authoring → worker-owned session facts → tool construction/invocation; shared CLI/embedded helper; transcript followup; plugin-tool and Workshop siblings; session parser/reserved slots; relevant history and current main. Direct Codex dependency inspection covered
codex-rs/protocol/src/dynamic_tools.rs:13,codex-rs/app-server/src/dynamic_tools.rs:16,codex-rs/app-server/src/request_processors/thread_processor.rs:1100, andcodex-rs/app-server/src/bespoke_event_handling.rs:810in the sibling source checkout. This is source-contract evidence, not a Codex runtime test claim.Production: +229/-20 (net +209). Tests: +383/-7 (net +376). The production growth provides durable presentation ownership, guarded persistence, and first-chat atomic creation; it does not add another runtime store or restore the obsolete helper.
Terminal hosted CI and native preparation
security-fastand all seven secondary workflows passed. CI is not green.ownerAfter: falsebut observetrueatsrc/gateway/server-methods/agent.visitor-access.test-utils.ts:331. Scheduled main has the same cases and signature: https://github.com/openclaw/openclaw/actions/runs/44473223458/job/135388122124.d83ebd85a06290210097ee316176477baef9e257has ordered parentsde0920200cf1bae667d1e8b75be66ba8060f4de5and the reviewed PR head. Its reconstructed tree matches; its introduced patch is byte-identical to the frozen-main candidate patch. The failed aggregate is accounted for by that Visitor shard.github_pendingevidence; no new push was needed. Fresh Claw review reports no actionable findings or remaining code rank-up move: fix(gateway): parent prompt cache misses when a subagent settles #195378 (comment).Fresh human maintainer security approval on
a4d57cb71504a4d19b0070e29c398763b9e24017remains mandatory. The inherited-CI evidence does not supply that approval. No merge has been requested.