Repository navigation
feat(trajectory): record native tool events and structured delegation origin - #119267
IsaiahStapleton wants to merge 41 commits into
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed August 8, 2026, 5:52 PM ET / 21:52 UTC. ClawSweeper reviewWhat this changesRecords native tool lifecycle events and structured delegation origin in trajectory storage, with exact-receipt steering settlement across native and Codex runtimes. Regression provenancePossible regression — probable (reviewed change; failure trace). No predecessor PR is attributed. Merge readiness⛔ Blocked until real behavior proof is added - 7 items remain This PR remains necessary because current main still omits native tool trajectory rows and structured receiver origin. Keep it open, but block merge until it restores the existing providerReplay exclusion and supplies current-head real behavior proof plus the required direct Codex contract inspection. Priority: P1 Review scores
Verification
How this fits togetherAgent runs emit tool and prompt events into SQLite-backed trajectories for export and diagnosis. Delegated input moves through steering and transcript commit before its receiver origin is recorded and sanitized. flowchart LR
A[Delegated session message] --> B[Steering receipt]
B --> C[Transcript commit]
C --> D[Trajectory recorder]
E[Native tool lifecycle] --> D
D --> F[Provenance sanitizer]
F --> G[SQLite trajectory events]
G --> H[Trajectory export]
Before merge
Findings
Agent review detailsSecurityNeeds attention: The patch regresses the established exclusion of private provider replay state from exported trajectory data. PR surfaceSource +375, Tests +2534, Docs +8. Total +2917 across 54 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: 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: Restore providerReplay omission in the canonical projection with export and runtime regressions, then provide redacted exact-head delegation/export proof after independently checking the sibling Codex contract. Do we have a high-confidence way to reproduce the issue? Yes. Current source proves native events are not trajectory-recorded and receiver prompts lack origin; the proposed export leak is reproducible from the changed sanitizer and export call path. Is this the best way to solve the issue? No. The recorder and exact-receipt approach fit the owner boundaries, but replacing the shared sanitizer without preserving providerReplay omission regresses the established private-state boundary. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 909509a5db8d. LabelsLabel changes:
Label justifications:
EvidenceSecurity concerns:
What 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 (19 earlier review cycles; latest 8 shown)
|
|
Addressed the latest ClawSweeper schema-v1 compatibility recommendation in 62b01f81bb4:
Verification on the pushed head:
I also rechecked the direct Codex contract at sibling Codex 6a828ca26f3e: MCP and dynamic tool-call protocol items carry The PR body now records this compatibility decision and labels the existing two-agent production run accurately as predecessor-head ( |
|
Explicitly reran the native two-agent |
62b01f8 to
21d3ed0
Compare
|
Addressed ClawSweeper's exact-head behavior-proof request on
The PR body now contains the redacted exact-head rows, timestamps, runtime identities, and digest. |
vincentkoc
left a comment
There was a problem hiding this comment.
The trajectory direction is sound, but this head is not merge-ready. In addition to the existing ClawSweeper finding about oversized Codex prompt-origin truncation, four boundaries still need repair:
- Scope routing-key preservation to validated provenance.
- Carry provenance through active steering and commit.
- Separate approval presentation from terminal telemetry.
- Preserve tool identity and outcome during compaction.
Please add one adversarial regression per boundary, rerun the focused Codex trajectory plus native tool, queue, and trajectory-runtime tests, then request exact-head re-review.
Codex contract checked at 6a828ca26f3e: codex-rs/app-server-protocol/src/protocol/v2/item.rs:307-338,1545-1552 and codex-rs/app-server/src/bespoke_event_handling.rs:991-1014. MCP and dynamic arguments are unrestricted JsonValue forwarded unchanged.
| @@ -260,7 +261,7 @@ function sanitizeValue(value: unknown, depth = 0, key = ""): unknown { | |||
| return value; | |||
| } | |||
| if (typeof value === "string") { | |||
| if (SENSITIVE_FIELD_RE.test(key)) { | |||
| if (SENSITIVE_FIELD_RE.test(key) && !NON_SECRET_IDENTIFIER_FIELDS.has(key)) { | |||
There was a problem hiding this comment.
P1: This exemption is global by key, so it also applies to untrusted Codex dynamic/MCP arguments. A credential stored under sessionKey or sourceSessionKey will bypass redaction and persist to trajectory storage.
Please remove the key-only allowlist and preserve routing identity only at validated producer-owned provenance paths. Add tests proving trusted origin survives while these keys inside arbitrary tool arguments remain redacted.
| @@ -117,6 +120,9 @@ export async function submitEmbeddedAttemptPrompt(input: { | |||
| systemPrompt: input.systemPrompt, | |||
| messages: activeSession.messages, | |||
| imagesCount: input.images.length, | |||
| // Delegated turns carry their sender identity as a recorded fact so | |||
| // consumers join sender to receiver instead of parsing the prose prefix. | |||
| ...(attempt.inputProvenance ? { origin: attempt.inputProvenance } : {}), | |||
There was a problem hiding this comment.
P2: This covers newly submitted attempts, but active-run sessions_send delivery bypasses this function: the queue carries annotated text without typed InputProvenance, and no new prompt.submitted event records the receiver leg.
Please carry provenance through the active-run queue into the user-message/transcript commit and record it only after successful steering. Add coverage proving accepted timeoutSeconds: 0 delivery records structured origin while rejected or timed-out steering does not.
| }); | ||
| ctx.params.trajectoryRecorder?.recordEvent("tool.result", { | ||
| ...toolResultEventData, | ||
| success: !isToolError, |
There was a problem hiding this comment.
P2: isToolError is deliberately cleared to preserve the actionable approval UI, but it is not the terminal outcome: approval-unavailable is classified and emitted as blocked. This therefore persists success: true for a command that did not execute.
Please derive trajectory outcome from observerIsError or the shared failure classifier while leaving presentation behavior unchanged. Add a regression asserting isError: true, success: false, and a blocked command item.
| }, | ||
| data: toolResultEventData, | ||
| }); | ||
| ctx.params.trajectoryRecorder?.recordEvent("tool.result", { |
There was a problem hiding this comment.
P2: A multi-block result can remain above 256 KiB after sanitization. The compact fallback then drops name, toolCallId, isError, and success, leaving parallel tool.result rows uncorrelatable.
Please preserve bounded tool identity and outcome fields during compaction while dropping the oversized payload. Add a 33-near-cap-block regression proving the compact row retains its call identity and terminal outcome.
db2d8db to
74e4be9
Compare
vincentkoc
left a comment
There was a problem hiding this comment.
Approving exact head 39153a66ddc671e6cef5eaed66cc2926548de572; this supersedes my approval of the prior head.
The final CI cleanup is mechanical and net-negative: six paths, +16/-36, removing the unused steering identity file/export, typing the receipt callbacks, fixing the optional/result return contracts, and deleting five stale test fixture fields.
Exact-head proof: 52 focused tests passed; remote pnpm tsgo:prod and pnpm check:test-types passed; git diff --check, targeted formatting, signature verification, TruffleHog, and structured autoreview all passed with no actionable finding. Hosted CI is rerunning the remaining dependency/format/extension-boundary gates.
The prior AWS 1,017-test trajectory/steering/telemetry suite remains applicable because this commit changes only compile hygiene and dead declarations.
|
@clawsweeper re-review |
|
🦞👀 Command router queued. I will update this comment with the next step. |
vincentkoc
left a comment
There was a problem hiding this comment.
Approving exact head 6f5608dae0865dc05a1d64c3e092bcdba94ffb1e; this supersedes my approval of the prior head.
The final commit is lint-only across four existing files. Focused oxlint is clean, 76 tests passed, formatting and git diff --check passed, the commit signature is valid, and exact-head structured autoreview returned no actionable finding. No runtime contract changed.
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
…0807 * origin/main: fix(qa): honor Crabbox SSH fallback ports (openclaw#120539) refactor(core): adopt normalization-core leaf helpers across production (openclaw#120350) fix(release): scope upgrade plugin credentials (openclaw#120666) fix(ai): preserve long Responses sessions after server compaction (openclaw#120457) fix(test): keep fork E2E setup builds observable (openclaw#120653) fix(cloud-workers): retain provider operation ownership (openclaw#120661) docs: runners plan — one placement model for sessions, devices, and cloud (openclaw#120657) refactor(cli): inline state migration policy (openclaw#120641) feat(update): scheduled update campaigns with countdown, dev-channel auto-update, and Updates settings page (openclaw#120506) chore(i18n): refresh native locales (openclaw#120614) fix(ci): retry transient artifact API reads (openclaw#120654) fix(clawrouter): honor advertised reasoning efforts (openclaw#120631) fix(infra): unify env-truthiness, missing-path, realpath, and abort-sleep semantics (openclaw#120359) fix(maintainers): parse merge comment URL structurally (openclaw#120649) fix(ui): label only operator-pinned runtimes in model picker rows (openclaw#120646) docs(agents): replace exact-head re-review gate with 12-hour review window # Conflicts: # src/agents/payload-redaction.ts
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Maintainer direction: Maintainers attempted a same-branch narrow rewrite against current
The original issue only requires native Do not continue expanding this PR. No author action is requested. Leave the branch unchanged while maintainers decide a fresh minimal replacement from current Direct upstream Codex evidence was checked for unrestricted |
|
This assigned pull request has been automatically marked as stale after being open for 27 days. |
|
Closing due to inactivity. |
Fixes #119266.
This is part 2 of the trajectory observability series. Part 1 was #116220 (fixing #116219), which stopped oversized events from destroying prompts. This PR makes sessions_send delegation a first-class, structured fact in the runtime trajectory.
What Problem This Solves
Inter-session delegation is invisible in native-runner trajectories. The Codex harness already records sessions_send like any bridged dynamic tool (tool.call/tool.result from the app-server recorder), and cloud-worker runs get tool rows from the gateway live-event projection, but the native embedded runner never wires its tool lifecycle into the trajectory recorder, for any tool and regardless of model provider (the measured instance below runs openai/gpt-5.5 fleet-wide and still records zero native-runner tool events). On the receiver side, the sender identity arrives only as a prose prefix packed into the prompt.submitted prompt string.
Measured on a live 2026.7.1 instance (262 trajectory files, 7,349 events, 2026-06-19 to 2026-08-03):
[Inter-session message], 21[Subagent Context], 2OpenClaw delivery metadata);data.originexists on 0 of 683, so consumers must regex the prose.Also verified on clean single-purpose instances of 2026.7.1-2 (latest stable) and 2026.7.2-beta.7, including a controlled A/B on the same 2026.7.1-2 instance, same model (openai/gpt-5.6), same spawn-plus-send prompt: under the Codex runtime the sender persists tool.call/tool.result for sessions_send; under the native runtime (forced via the per-model agentRuntime override) the sender persists zero tool events even though the child session was spawned and the message delivered, and the receiver's persisted prompt.submitted carries only the prose prefix with data keys exactly [prompt, systemPrompt, messages, imagesCount] and no origin. Receiver prompt.submitted is prose-only on both versions (structured provenance appears only buried inside the Codex recorder's model.completed messagesSnapshot), and the beta's move of trajectory storage to the trajectory_runtime_events sqlite table changes neither behavior, so the gap is present up through the current beta. Mixed runtimes on one instance are normal, not exotic: OpenAI-provider models route to the Codex runtime implicitly and fall to the native runtime under explicit or transport-derived overrides, so the measured fleet runs both side by side.
Why This Change Was Made
One shared schema decision: the delegation identity recorded on the receiver comes from the attempt's normalized
InputProvenanceinsrc/sessions/input-provenance.ts({kind, originSessionId?, sourceSessionKey?, sourceChannel?, sourceTool?}). The persisted transcript user message already stamps this vocabulary asprovenance, and the prose prefix is projected from it, so reusing the type gives one vocabulary across runtime events, transcript provenance, and prose. Native recording receives that producer-owned typed value directly. Codex recording validates the provenance kind and projects only those canonical fields through a dedicatedrecordPromptSubmittedmethod; arbitrary tool arguments namedsessionKeyorsourceSessionKeystill redact. Consumers join legs via receiverorigin.sourceSessionKeyplusorigin.sourceTool === "sessions_send"against the sender trajectory envelope.feat(agents): record native tool.call/tool.result trajectory events: threads the attempt's existing trajectory recorder through the embedded subscription params and records, athandleToolExecutionStart/handleToolExecutionEnd, the sanitized tool payload (same sanitizers as the live stream and the cloud-worker projection), addingsuccess: !isErroron results; commit 3 below settles the persisted arguments field so all three producers share one persisted shape.feat(trajectory): record structured origin on receiver prompt.submitted:submitEmbeddedAttemptPromptadds...(attempt.inputProvenance ? { origin: attempt.inputProvenance } : {})to the recorded payload. The key is omitted entirely for provenance-free turns (ordinary chat and channel prompts), so those rows keep their exact bytes; turns that already carry provenance today (inter-session sends, voice transcripts, ACP turns, internal_system producers) additively gain the oneoriginkey.fix(trajectory): persist canonical tool-call arguments across producers: the trajectory export consumes tool-call arguments only viadata.arguments(markInvokedSkills, src/trajectory/export.ts), which the Codex recorder already writes; the new native writer and the pre-existing cloud-worker projection persisted the live-streamargsfield instead. Both producers now persist canonicalargumentswhile the live tool streams keep theirargscontract untouched. Regression tests pin the persisted shape in both producers and prove export skill detection consumes a native-shaped row.fix(trajectory): keep worker args additive in schema v1(addresses the current ClawSweeper P1 using its recommended compatibility shape): worker trajectory rows retain the already-persisteddata.argsfield and add canonicaldata.argumentswith the same sanitized value. Existing schema-v1 readers continue to work, export sees the canonical field, and the live worker event remains unchanged.fix(trajectory): record origin for Codex receivers: threads optional normalizedInputProvenanceinto Codex-harnessprompt.submittedrows, so receiver provenance does not disappear when model routing selects Codex instead of the native harness. The origin key remains absent for ordinary turns.fix(trajectory): preserve Codex session routing keys: introduced a global routing-key exemption after an intermediate mixed-runtime proof exposed a sanitizer false positive. Maintainer review correctly identified that unrestricted Codex MCP and dynamic arguments make a global exemption unsafe; commit 7 removes it and replaces it with a producer-owned provenance boundary.fix(trajectory): preserve trusted delegation facts: addresses all five current review boundaries. Codex now records prompt provenance only through a dedicated method that validates the kind and projects canonical fields, preserves that trustedoriginthrough oversized prompt compaction, and redacts routing-shaped keys in arbitrary tool arguments. Active nativesessions_sendsteering carries typed provenance onto the queued user message and recordsprompt.submittedonly after transcript commit; acceptedtimeoutSeconds: 0is covered, while rejected and timed-out steering record no prompt fact. Approval-unavailable remains actionable in live presentation but persists terminalisError: trueandsuccess: falseplus a blocked command item. Oversized nativetool.resultcompaction preserves boundedname,toolCallId,isError, andsuccess, including the requested 33-block regression.fix(agents): correlate queued steering receipts: rebases onto current main including fix: steering reaches active runs across agent harnesses #119594 and replaces rendered-text correlation with the exactAgentMessagereceipt returned by queue admission. Transcript commit waits formessage_end.message === receipt, cancellation removes only that receipt through the publicAgentSessionboundary, and one receipt-bearing queue structure keeps model and UI state aligned. Concurrent identical-text regressions prove the first exact commit resolves only its own waiter, a timeout cancels only its own sibling, and an unconfirmed accepted send records no receiver prompt fact.Compatibility position on the worker field change: schema version 1 is now additive. Worker rows written after this change contain both
data.argsfor existing readers and canonicaldata.argumentsfor trajectory export. The values come from the same sanitized object, so the compatibility field does not bypass redaction. Historical 7.2-beta rows remainargs-only and are not rewritten; this PR does not add a storage migration. The live worker stream still exposes only its existingargscontract.Deliberately not taken:
{sourceSession, isUser}: those are prose-projection names, and an adapter that only renames fields was rejected in favor of the canonical type.Explicitly unchanged: model-visible prompts are byte-identical (prompt assembly and
annotateInterSessionPromptTextuntouched;src/sessions/input-provenance.tsis byte-identical base to head). Ordinary schema-v1 rows are unchanged for existing consumers, and there is no schema-v2.No double recording, verified against a direct
../codexcheckout per the repo gate: harness selection is exclusive per attempt (src/agents/harness/selection.ts:498-531); only the builtin openclaw harness runs the native runner (src/agents/harness/builtin-openclaw.ts:75), and the sole production caller ofsubscribeEmbeddedAgentSession, which ownshandleToolExecutionStart/End, is the native attempt's stream prepare (src/agents/embedded-agent-runner/run/attempt-stream-prepare.ts:246,263), so Codex app-server runs never reach the seam this PR instruments; grep confirms extensions/codex imports neither the embedded runner nor the subscription handlers. Codex runs record tool events through their own projector because the Codex app-server emits every tool invocation as protocol items with arguments: the item/started, item/completed, and item/tool/call methods are declared in codex-rs/app-server-protocol/src/protocol/common.rs:1710,1713,1564 with ThreadItem::McpToolCall and ThreadItem::DynamicToolCall carryingarguments: JsonValue(codex-rs/app-server-protocol/src/protocol/v2/item.rs:307-332), emitted from codex-rs/app-server/src/bespoke_event_handling.rs:979-1018 (inspected at openai/codex 6a828ca26f3e). That upstream contract, already persisted withargumentsby extensions/codex/src/app-server/event-projector-tool-transcript.ts:382-416, is the parity target this PR brings to the native runner. The inspection is reproducible withgit clone https://github.com/openai/codex && git checkout 6a828ca26f3eif the automated reviewer's sandbox cannot clone it. One honest caveat: the guarantee is structural per attempt (disjoint harnesses), not a runtime guard; a codex-to-builtin harness fallback (selection.ts:373-381) is a native run recording once via the native seam, which is correct single recording.Maintainer exact-head owner-boundary note (
39ab57dbc39670e3c6e43b91c0303bc8dc91e902)The shipped solution keeps each fact at its owner. Queue/turn owners confirm steering admission and transcript commit;
packages/agent-corecarries opaque per-execution state across the bundled-plugin boundary;sessions_sendrecords the destination only inside that state; the trajectory recorder consumes it into a bounded recorder-local target registry and persists pseudonymous source/target hashes; export pre-scans provenance, retains sanitized runtime telemetry, and fails closed or omits transcript-derived projections when safe disclosure cannot be proved. Canonical transcript/model-result objects and model-visible bytes are unchanged.The final repair walks sensitive ancestry leaf-to-root, so descendants of
key,session,signature,token, andauthorizationredact before SQLite or export. Diagnostic codes remain visible only outside a sensitive ancestor (src/trajectory/provenance-sanitization.ts:89-141,src/trajectory/provenance-sanitization.persistence.test.ts:64-131).There is no SQLite schema/version change and no public Codex/OpenClaw wire-protocol change. The
agent-coresubpath is explicitly private-local-only (scripts/lib/plugin-sdk-private-local-only-subpaths.json:8), ships runtime JavaScript without a types export (package.json:48,1424-1426), and is excluded from the typed/documented public API and baseline (scripts/lib/plugin-sdk-entries.mjs:19-36,116-148,src/plugin-sdk/api-baseline.ts:12,187-190). The new private-state symbols are consumed through that runtime-only subpath by the official Codex plugin (extensions/codex/src/app-server/dynamic-tools.ts:6-12,624-648,682-684); this is a private host/plugin ABI, not a third-party SDK contract.Current whole-PR split from the live 63-file diff: production
+1938/-777(net+1161), tests+4628/-202(net+4426), docs+9. Final commit: production+17/-2, tests+286/-1. The production growth is justified by cross-runtime trajectory parity, exact steering receipts, the private execution-state owner boundary, path-aware security redaction, fail-closed export behavior, and bounded native/Codex/worker/SQLite/export proof.User Impact
Fleet observability consumers can join delegation chains structurally (sender tool.call to receiver
origin) instead of regexing prose out of prompt strings. Existing consumers keep identical behavior: provenance-free rows are byte-unchanged, and rows for provenance-carrying turns only add one optional key to an already-opendatarecord.Maintainer exact-head impact note
Recorder sanitization operates on projected copies. Canonical transcript state, model/tool result objects, and model-visible prompt bytes retain their existing semantics and bytes; sanitized runtime telemetry remains available, including tool identity/outcome, pseudonymous source/target joins, model completion data, and bounded diagnostics.
Residual boundary: trusted target substitutions live only for the lifetime of the trajectory recorder and are learned only from trusted completed tool-result state. A later recorder cannot recover an earlier raw target from its hash. Therefore, when a canonical runtime
tool.resultcarries a target hash, export deliberately omits transcript-derived events and session-branch entries while retaining sanitized runtime events and supplemental telemetry. The tradeoff is less transcript-derived diagnostic context in that bundle in exchange for preventing the authoritative transcript from reintroducing the raw target.Predecessor Seam-Level Real Behavior Proof
This historical
a625948a3c5proof is retained to show the original two production seams in isolation. Both legs rancreateTrajectoryRuntimeRecorderbacked by its queued-file-writer sink, the realhandleToolExecutionStart/Endseam, and the realsubmitEmbeddedAttemptPromptfed bynormalizeInputProvenanceandannotateInterSessionPromptText; they flushed to trajectory JSONL and were parsed back before asserting, with no recorder or prompt-assembly mocks. It is not the current-head proof. The operator-gateway and oversized-recorder sections below are the authoritative exact-head evidence.{ "proof": "sessions_send delegation observability, PR 2 real-behavior proof", "repo": "<redacted-absolute-path>", "branch": "feat/sessions-send-delegation", "head": "a625948a3c5 (feat(trajectory): record structured origin on receiver prompt.submitted) on 6500b45e4f9 on base 12beeb7b294", "method": "REAL run: production factories createTrajectoryRuntimeRecorder + getQueuedFileWriter (the recorder's own file sink), real native-runner handler seam handleToolExecutionStart/End with recorder on ctx.params.trajectoryRecorder, real submitEmbeddedAttemptPrompt, real normalizeInputProvenance + annotateInterSessionPromptText; all events flushed to JSONL on disk and parsed back before asserting; no recorder or prompt-assembly mocks", "commands": [ "<focused real-behavior proof command; absolute paths and scratch identifier redacted>", "node scripts/run-vitest.mjs src/trajectory/runtime.test.ts", "git status --porcelain && git diff --quiet 12beeb7b294..HEAD -- src/sessions/input-provenance.ts" ], "senderLeg": { "trajectoryFile": "<scratchpad>/proof-out/sender.trajectory.jsonl (1170 bytes on disk)", "persistedRowTypes": ["tool.call", "tool.result"], "persistedToolCallRow": { "traceSchema": "openclaw-trajectory", "schemaVersion": 1, "traceId": "<redacted-trace-id>", "source": "runtime", "type": "tool.call", "ts": "2026-08-04T06:01:20.566Z", "seq": 1, "sourceSeq": 1, "sessionId": "<redacted-session-id>", "sessionKey": "<redacted-session-key>", "runId": "<redacted-run-id>", "workspaceDir": "<redacted-absolute-path>", "provider": "anthropic", "modelId": "claude-test", "data": { "phase": "start", "name": "sessions_send", "toolCallId": "<redacted-tool-call-id>", "args": { "sessionKey": "<redacted-session-key>", "message": "<redacted-prompt>" } } }, "persistedToolResultRow": { "traceSchema": "openclaw-trajectory", "schemaVersion": 1, "traceId": "<redacted-trace-id>", "source": "runtime", "type": "tool.result", "ts": "2026-08-04T06:01:20.569Z", "seq": 2, "sourceSeq": 2, "sessionId": "<redacted-session-id>", "sessionKey": "<redacted-session-key>", "runId": "<redacted-run-id>", "data": { "phase": "result", "name": "sessions_send", "toolCallId": "<redacted-tool-call-id>", "meta": "<redacted-session-key>", "isError": false, "result": { "content": [{ "type": "text", "text": "<redacted-result-text>" }] }, "success": true } }, "checks": { "toolCallEnvelopeSchemaV1": true, "toolCallNameIsSessionsSend": true, "toolCallArgsMatchInvocation": true, "persistedToolCallDataEqualsLiveToolStreamData": true, "persistedToolResultDataEqualsLiveDataPlusSuccess": true, "toolResultSuccessTrue": true } }, "receiverLeg": { "trajectoryFile": "<scratchpad>/proof-out/receiver-delegated.trajectory.jsonl (1051 bytes on disk)", "persistedPromptSubmittedRow": { "traceSchema": "openclaw-trajectory", "schemaVersion": 1, "traceId": "<redacted-trace-id>", "source": "runtime", "type": "prompt.submitted", "ts": "2026-08-04T06:01:20.585Z", "seq": 1, "sourceSeq": 1, "sessionId": "<redacted-session-id>", "sessionKey": "<redacted-session-key>", "runId": "<redacted-run-id>", "data": { "prompt": "<redacted-model-visible-prompt; byte identity covered by sha256 below>", "systemPrompt": "<redacted-system-prompt>", "messages": [], "imagesCount": 0, "origin": { "kind": "inter_session", "originSessionId": "<redacted-origin-session-id>", "sourceSessionKey": "<redacted-session-key>", "sourceChannel": "discord", "sourceTool": "sessions_send" } } }, "checks": { "originEqualsNormalizedInputProvenanceVerbatim": true, "originKindInterSession": true, "originJoinsToSenderSessionKey": true, "originSourceToolSessionsSend": true }, "modelVisibleByteIdentity": { "annotatedPromptBytes": 385, "persistedDataPromptBytes": 385, "promptPassedToActiveSessionBytes": 385, "sha256AllFourStages": "d1d00eb2c3974eb73ee628d3defd5a4fddd095229ad972c7c95b535bf3bc1784", "stages": ["annotateInterSessionPromptText output", "persisted data.prompt parsed from JSONL", "prompt passed to promptActiveSession", "onFinalPromptText"], "allStagesByteIdentical": true, "promptAssemblyModuleIdenticalBaseToHead": "git diff --quiet 12beeb7b294..HEAD -- src/sessions/input-provenance.ts exits 0" } }, "controlLeg_ordinaryUserTurn": { "trajectoryFile": "<scratchpad>/proof-out/receiver-control.trajectory.jsonl (520 bytes on disk)", "persistedDataKeys": ["prompt", "systemPrompt", "messages", "imagesCount"], "checks": { "dataKeysExactlyPreChangeSet": true, "rawPersistedLineContainsNoOriginKey": true } }, "repoCleanAfterProof": "git status --porcelain empty; branch diff vs base touches only the 9 recorder-side files of the two commits", "result": "PROOF PASSED: all checks true" }After-fix full-path proof: two real agents through an operator-deployed gateway
Exact-head binding: this proof was freshly rerun on 2026-08-06 after verifying the local branch and GitHub PR head were both
6a8e944b13ca120e35594bba70aef4aad188f207. The deployment artifact was bound to digestsha256:42a93a548edf470b42237763908cc1269262be4473c0d402320b5bece3fb9608; host, credential, and harness internals are intentionally omitted. The sender used the native runtime and the receiver used Codex. The sanitized rows below were parsed back from persisted SQLitetrajectory_runtime_eventstables. They prove a fresh native-to-Codexsessions_sendwithtimeoutSeconds: 0, canonical sender arguments, successful terminal outcome, unchanged receiver prompt bytes, and structured receiver origin.{ "proof": "exact-head mixed-runtime sessions_send delegation through the production gateway path", "runtimeBinding": { "head": "6a8e944b13ca120e35594bba70aef4aad188f207", "base": "9c2dbf6500f16cafc6c68edbc3144b9acf06fe56", "reportedVersion": "OpenClaw 2026.7.2 (6a8e944)", "imageDigest": "sha256:42a93a548edf470b42237763908cc1269262be4473c0d402320b5bece3fb9608", "sender": { "runtime": "native" }, "receiver": { "runtime": "codex" } }, "senderToolCall": { "traceSchema": "openclaw-trajectory", "schemaVersion": 1, "source": "runtime", "type": "tool.call", "ts": "2026-08-06T18:26:50.249Z", "seq": 6, "sessionKey": "<redacted-session-key>", "runId": "<redacted-run-id>", "data": { "phase": "start", "name": "sessions_send", "toolCallId": "<redacted>", "arguments": { "sessionKey": "<redacted-session-key>", "message": "<redacted-prompt>", "timeoutSeconds": 0 } } }, "senderToolResult": { "type": "tool.result", "ts": "2026-08-06T18:26:50.400Z", "seq": 7, "sessionKey": "<redacted-session-key>", "runId": "<redacted-run-id>", "data": { "phase": "result", "name": "sessions_send", "toolCallId": "<redacted>", "isError": false, "success": true } }, "codexReceiverPromptSubmitted": { "type": "prompt.submitted", "ts": "2026-08-06T18:26:51.191Z", "seq": 3, "sessionKey": "<redacted-session-key>", "runId": "<redacted-run-id>", "data": { "threadId": "<redacted-thread-id>", "turnId": "<redacted-turn-id>", "promptTail": "<redacted-model-visible-prompt>", "imagesCount": 0, "origin": { "kind": "inter_session", "sourceSessionKey": "<redacted-session-key>", "sourceChannel": "webchat", "sourceTool": "sessions_send" } } }, "checks": { "exactHead": true, "freshRerun": true, "activeSteeringTimeoutZero": true, "nativeCanonicalArguments": true, "nativeTerminalOutcome": true, "codexReceiverOrigin": true, "promptEnvelopeUnchanged": true, "arbitraryCodexRoutingKeysRedactedByTests": true, "trustedCodexOriginSurvivesOversizeByFocusedRecorderTest": true, "realModelsViaProxy": true, "storageParsedBackFromSqlite": true } }Exact-head oversized Codex persistence proof
The overflow boundary was also exercised outside Vitest on the exact
6a8e944b13ca120e35594bba70aef4aad188f207checkout. The productioncreateCodexTrajectoryRecorderwrote through the productioncreateTrajectoryRuntimeRecorderandgetQueuedFileWritersink to a real JSONL file, using multibyte canonical prompt and provenance fields large enough to make the pre-compaction Codex event 360,610 bytes. Parsing the persisted line back from disk produced the redacted summary below. The 180,714-byte persisted row is below the 262,144-byte cap, drops the prompt payload, and retains the trusted canonical origin with UTF-16-safe bounded strings.{ "head": "6a8e944b13ca120e35594bba70aef4aad188f207", "persistedBytes": 180714, "type": "prompt.submitted", "data": { "truncated": true, "originalBytes": 360610, "limitBytes": 262144, "reason": "trajectory-event-size-limit", "droppedFields": ["threadId", "turnId", "prompt", "imagesCount"], "origin": { "kind": "inter_session", "sourceSessionKey": "<redacted-session-key>", "originSessionIdChars": 20001, "sourceChannelChars": 20001, "sourceToolChars": 20001, "endsUtf16Safely": true }, "promptPresent": false } }Evidence
node scripts/run-vitest.mjs src/gateway/worker-environments/live-event-projection.test.ts src/trajectory/export.test.tspassed 44 tests. The worker regression pins equal sanitizedargsandargumentsvalues and proves the raw credential is absent; the export regression pins skill detection from canonicalarguments.6a828ca26f3e:codex-rs/app-server-protocol/src/protocol/v2/item.rs:307-338,1545-1552defines unrestrictedJsonValuearguments for MCP and dynamic tool calls, andcodex-rs/app-server/src/bespoke_event_handling.rs:991-1014forwards them unchanged. That is why routing-shaped keys cannot be globally exempted from sanitization. This PR does not change the upstream protocol contract.sessions_send, prompt-submit, trajectory-runtime, exact duplicate-receipt commit/cancellation, and receiver-origin boundary regressions. The focused overflow exercise above separately persisted and parsed the production Codex recorder path outside Vitest.pnpm tsgo:core: pass, no diagnostics.pnpm check:test-types: pass, no diagnostics.node scripts/run-oxlint.mjsandpnpm exec oxfmt --checkon all changed files: pass.git diff --check origin/main...HEAD: clean.sessionKeyorsourceSessionKeyredact, while validated producer-owned prompt provenance projects only canonical fields and survives genuine over-256-KiB Codex compaction; accepted active-runsessions_sendwithtimeoutSeconds: 0carries provenance onto the committed user message and recordsprompt.submittedonly after commit, while runtime rejection and transcript timeout record none; approval-unavailable remains actionable to the UI but persistsisError: true,success: false, and a blocked command item; a 33-block near-cap tool result compacts below the limit while preservingname,toolCallId,isError, andsuccess; native and worker sender rows retain their documented canonical and compatibility fields; export skill detection consumes canonicalarguments.datais an open record (maintainer resolution on fix(trajectory): preserve prompts in oversized events #116220), and the export validatorisRuntimeTrajectoryEventinsrc/trajectory/export.tschecks only the envelope, so rows with and withoutoriginboth validate. The proof's control leg shows an ordinary prompt.submitted row persists exactly the pre-change keys[prompt, systemPrompt, messages, imagesCount]with nooriginkey in the raw line. The transcript-sideprovenancefield on persisted user messages is unchanged;data.originmakes the runtime stream self-contained using the same field names.Maintainer exact-head evidence (
39ab57dbc39670e3c6e43b91c0303bc8dc91e902)142adjacent tests; the independent lane passed374tests.1tool call and1tool result; the Codex receiver persisted2prompts with1canonical origin. Every SQLite row and export artifact was clean, includingmodel.completed; canonical transcript bytes were unchanged. All16archive attacks and5nested sensitive-ancestor attacks were rejected. Verifier SHA-256baa7d9ca65e5696b68bc5dc454b49f87fab77f72347bc835067aa2f5fcc124d1; archive SHA-256a7ea6fd9a9f1f9dc717d687f6d137917445b039ddc0423f510c08855e6067e4c; attestation SHA-25690211d90fdbe55dcf8a72c1c1149b908af659eb4ce3df119886dda9c31440d01.1/1successful; all120check runs terminal with85success,34skipped,1neutral,0failing, and0pending. Principal runs: CI 31193092331, Security High 31193092388, Dependency Guard 31193092822, Critical Quality 31193094194, and Security Sensitive Guard 31193089048. Required gate:openclaw/ci-gatejob 92918845313.bb1af235ea2822d7a40f75ef52e4d6a2cde84da2. MCP/dynamic items and requests carry unrestrictedJsonValuearguments (../codex/codex-rs/app-server-protocol/src/protocol/v2/item.rs:308-338,1537-1552) and app-server forwards cloned dynamic arguments unchanged into the host request (../codex/codex-rs/app-server/src/bespoke_event_handling.rs:985-1011).turn/steerrequires an expected active turn ID and returns the accepted ID (../codex/codex-rs/app-server-protocol/src/protocol/v2/turn.rs:175-204); the processor rejects absent, mismatched, or non-steerable turns (../codex/codex-rs/app-server/src/request_processors/turn_processor.rs:920-1026), while core atomically checks and queues accepted input before returning that active ID (../codex/codex-rs/core/src/session/mod.rs:3938-4017).