Skip to content

feat(trajectory): record native tool events and structured delegation origin - #119267

Closed
IsaiahStapleton wants to merge 41 commits into
openclaw:mainfrom
IsaiahStapleton:feat/native-tool-events-origin
Closed

IsaiahStapleton wants to merge 41 commits into
openclaw:mainfrom
IsaiahStapleton:feat/native-tool-events-origin

Conversation

@IsaiahStapleton

@IsaiahStapleton IsaiahStapleton commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

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):

  • 0 of 1,489 tool.call events name sessions_send, despite 25 same-instance inter-session deliveries whose receiver envelopes name it as sourceTool. 25 deliveries, 0 sender-side records.
  • 48 of 683 prompt.submitted events carry a prose delivery envelope (25 [Inter-session message], 21 [Subagent Context], 2 OpenClaw delivery metadata); data.origin exists on 0 of 683, so consumers must regex the prose.
  • Prose matching already fails on real data: the delivery-metadata marker sits mid-prompt after a workspace-context preamble, so prefix heuristics miss it, and the same prose is duplicated into context.compiled, model.completed, trace.metadata, and trace.artifacts payloads, so naive grep counts overcount roughly 10x.
  • Joining the 25 receiver envelopes to sender-side turn windows: 21 fall inside an active sender turn and 2 more within 13 seconds of sender activity, so at least 21 and likely 23 of 25 were in-turn tool calls that commit 1 would have recorded; the remaining 2 are consistent with the detached announce/follow-up flows named below as follow-up work.
  • Recording cost, estimated from the same corpus: existing tool.call rows average 1.2 KB and tool.result rows 4.6 KB; had the instance's 474 native-runner prompts recorded tools at the Codex sessions' observed rate (7.5 calls per prompt), that is roughly 21 MB against a 163 MB corpus. Both recorders bound strings and total event size; focused regressions pin trusted origin retention through the native and Codex oversize paths and pin native tool-result identity and outcome through compaction.

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 InputProvenance in src/sessions/input-provenance.ts ({kind, originSessionId?, sourceSessionKey?, sourceChannel?, sourceTool?}). The persisted transcript user message already stamps this vocabulary as provenance, 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 dedicated recordPromptSubmitted method; arbitrary tool arguments named sessionKey or sourceSessionKey still redact. Consumers join legs via receiver origin.sourceSessionKey plus origin.sourceTool === "sessions_send" against the sender trajectory envelope.

  • Commit 1, feat(agents): record native tool.call/tool.result trajectory events: threads the attempt's existing trajectory recorder through the embedded subscription params and records, at handleToolExecutionStart/handleToolExecutionEnd, the sanitized tool payload (same sanitizers as the live stream and the cloud-worker projection), adding success: !isError on results; commit 3 below settles the persisted arguments field so all three producers share one persisted shape.
  • Commit 2, feat(trajectory): record structured origin on receiver prompt.submitted: submitEmbeddedAttemptPrompt adds ...(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 one origin key.
  • Commit 3, fix(trajectory): persist canonical tool-call arguments across producers: the trajectory export consumes tool-call arguments only via data.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-stream args field instead. Both producers now persist canonical arguments while the live tool streams keep their args contract untouched. Regression tests pin the persisted shape in both producers and prove export skill detection consumes a native-shaped row.
  • Commit 4, 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-persisted data.args field and add canonical data.arguments with the same sanitized value. Existing schema-v1 readers continue to work, export sees the canonical field, and the live worker event remains unchanged.
  • Commit 5, fix(trajectory): record origin for Codex receivers: threads optional normalized InputProvenance into Codex-harness prompt.submitted rows, so receiver provenance does not disappear when model routing selects Codex instead of the native harness. The origin key remains absent for ordinary turns.
  • Commit 6, 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.
  • Commit 7, 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 trusted origin through oversized prompt compaction, and redacts routing-shaped keys in arbitrary tool arguments. Active native sessions_send steering carries typed provenance onto the queued user message and records prompt.submitted only after transcript commit; accepted timeoutSeconds: 0 is covered, while rejected and timed-out steering record no prompt fact. Approval-unavailable remains actionable in live presentation but persists terminal isError: true and success: false plus a blocked command item. Oversized native tool.result compaction preserves bounded name, toolCallId, isError, and success, including the requested 33-block regression.
  • Commit 8, 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 exact AgentMessage receipt returned by queue admission. Transcript commit waits for message_end.message === receipt, cancellation removes only that receipt through the public AgentSession boundary, 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.args for existing readers and canonical data.arguments for trajectory export. The values come from the same sanitized object, so the compatibility field does not bypass redaction. Historical 7.2-beta rows remain args-only and are not rewritten; this PR does not add a storage migration. The live worker stream still exposes only its existing args contract.

Deliberately not taken:

  • Filtering the sender recording to sessions_send only. In the native runner no tool records events, so a filter would special-case one tool and leave native runs permanently divergent from the Codex and worker recorders; recording all tools closes the measured sessions_send gap as a consequence of restoring parity.
  • A renamed origin envelope such as {sourceSession, isUser}: those are prose-projection names, and an adapter that only renames fields was rejected in favor of the canonical type.
  • Subagent depth on origin, and sender-side events for the detached A2A follow-up/announce flows (those run outside any tool loop and are not tool invocations): named follow-ups, each a separate schema decision.

Explicitly unchanged: model-visible prompts are byte-identical (prompt assembly and annotateInterSessionPromptText untouched; src/sessions/input-provenance.ts is 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 ../codex checkout 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 of subscribeEmbeddedAgentSession, which owns handleToolExecutionStart/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 carrying arguments: 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 with arguments by 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 with git clone https://github.com/openai/codex && git checkout 6a828ca26f3e if 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-core carries opaque per-execution state across the bundled-plugin boundary; sessions_send records 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, and authorization redact 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-core subpath 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-open data record.

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.result carries 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 a625948a3c5 proof is retained to show the original two production seams in isolation. Both legs ran createTrajectoryRuntimeRecorder backed by its queued-file-writer sink, the real handleToolExecutionStart/End seam, and the real submitEmbeddedAttemptPrompt fed by normalizeInputProvenance and annotateInterSessionPromptText; 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 digest sha256: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 SQLite trajectory_runtime_events tables. They prove a fresh native-to-Codex sessions_send with timeoutSeconds: 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 6a8e944b13ca120e35594bba70aef4aad188f207 checkout. The production createCodexTrajectoryRecorder wrote through the production createTrajectoryRuntimeRecorder and getQueuedFileWriter sink 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

  • Compatibility/export proof: node scripts/run-vitest.mjs src/gateway/worker-environments/live-event-projection.test.ts src/trajectory/export.test.ts passed 44 tests. The worker regression pins equal sanitized args and arguments values and proves the raw credential is absent; the export regression pins skill detection from canonical arguments.
  • Direct Codex contract check at sibling Codex 6a828ca26f3e: codex-rs/app-server-protocol/src/protocol/v2/item.rs:307-338,1545-1552 defines unrestricted JsonValue arguments for MCP and dynamic tool calls, and codex-rs/app-server/src/bespoke_event_handling.rs:991-1014 forwards them unchanged. That is why routing-shaped keys cannot be globally exempted from sanitization. This PR does not change the upstream protocol contract.
  • Post-rebase exact-head verification ran 554 tests across 14 changed-surface test files and seven Vitest shards: all passed. This includes the Codex trajectory/projector, native tool, queue, AgentSession SDK, 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.mjs and pnpm exec oxfmt --check on all changed files: pass. git diff --check origin/main...HEAD: clean.
  • Regression tests pin: arbitrary Codex tool arguments named sessionKey or sourceSessionKey redact, while validated producer-owned prompt provenance projects only canonical fields and survives genuine over-256-KiB Codex compaction; accepted active-run sessions_send with timeoutSeconds: 0 carries provenance onto the committed user message and records prompt.submitted only after commit, while runtime rejection and transcript timeout record none; approval-unavailable remains actionable to the UI but persists isError: true, success: false, and a blocked command item; a 33-block near-cap tool result compacts below the limit while preserving name, toolCallId, isError, and success; native and worker sender rows retain their documented canonical and compatibility fields; export skill detection consumes canonical arguments.
  • Compatibility of the changed row shape: schema-v1 data is an open record (maintainer resolution on fix(trajectory): preserve prompts in oversized events #116220), and the export validator isRuntimeTrajectoryEvent in src/trajectory/export.ts checks only the envelope, so rows with and without origin both validate. The proof's control leg shows an ordinary prompt.submitted row persists exactly the pre-change keys [prompt, systemPrompt, messages, imagesCount] with no origin key in the raw line. The transcript-side provenance field on persisted user messages is unchanged; data.origin makes the runtime stream self-contained using the same field names.

Maintainer exact-head evidence (39ab57dbc39670e3c6e43b91c0303bc8dc91e902)

  • Binding and source review: live PR head matched the full SHA, the maintainer checkout was clean, and independent final source review reported no findings. The executor lane passed 142 adjacent tests; the independent lane passed 374 tests.
  • Local v4 behavior proof: sender persisted exactly 1 tool call and 1 tool result; the Codex receiver persisted 2 prompts with 1 canonical origin. Every SQLite row and export artifact was clean, including model.completed; canonical transcript bytes were unchanged. All 16 archive attacks and 5 nested sensitive-ancestor attacks were rejected. Verifier SHA-256 baa7d9ca65e5696b68bc5dc454b49f87fab77f72347bc835067aa2f5fcc124d1; archive SHA-256 a7ea6fd9a9f1f9dc717d687f6d137917445b039ddc0423f510c08855e6067e4c; attestation SHA-256 90211d90fdbe55dcf8a72c1c1149b908af659eb4ce3df119886dda9c31440d01.
  • Hosted exact-head CI: required checks 1/1 successful; all 120 check runs terminal with 85 success, 34 skipped, 1 neutral, 0 failing, and 0 pending. Principal runs: CI 31193092331, Security High 31193092388, Dependency Guard 31193092822, Critical Quality 31193094194, and Security Sensitive Guard 31193089048. Required gate: openclaw/ci-gate job 92918845313.
  • ClawSweeper continuity: rev 17 run 31193099518 and durable comment 5181149066 reviewed this exact SHA. The prior sensitive-ancestor P1 is fixed; the remaining SDK move is owner-resolved as the private runtime-only ABI described above.
  • Direct Codex contract inspection: personally rechecked sibling Codex at bb1af235ea2822d7a40f75ef52e4d6a2cde84da2. MCP/dynamic items and requests carry unrestricted JsonValue arguments (../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/steer requires 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).
  • Remote scope: AWS/Linux remote proof is not claimed. The optional ignored harness stopped before remote execution and all task leases were released; this is a proof-availability limitation, not a product failure.

@IsaiahStapleton
IsaiahStapleton marked this pull request as ready for review August 4, 2026 15:16
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: M labels Aug 4, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Aug 4, 2026
@clawsweeper

clawsweeper Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 8, 2026, 5:52 PM ET / 21:52 UTC.

ClawSweeper review

What this changes

Records native tool lifecycle events and structured delegation origin in trajectory storage, with exact-receipt steering settlement across native and Codex runtimes.

Regression provenance

Possible 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
Reviewed head: 8fcef4127b91d70f69ac8929d21eaaddcc0ab4df

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The PR has a focused repair direction, but a P1 export-boundary regression and missing current-head proof block readiness.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: Earlier reported captures predate the current head; add redacted exact-head runtime and export evidence after the repair, without private endpoints, keys, or identifiers. 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.
Patch quality 🦐 gold shrimp (3/6) Security review found an item that needs attention.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: Earlier reported captures predate the current head; add redacted exact-head runtime and export evidence after the repair, without private endpoints, keys, or identifiers. 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.
Evidence reviewed 5 items Current-main gap: Current main emits native tool lifecycle events only to the live stream, without a trajectory recorder call.
Current-main receiver path: Current main records prompt submission without a structured origin field.
Replay-state regression: The new projection omits routing fields but no longer omits providerReplay, while current main's diagnostic sanitizer explicitly does.
Findings 1 actionable finding [P1] Keep providerReplay out of trajectory data
Security Needs attention Private replay state can reach exports: The replacement sanitizer does not omit providerReplay although current main does, and trajectory export passes transcript messages through it.

How this fits together

Agent 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]
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: Earlier reported captures predate the current head; add redacted exact-head runtime and export evidence after the repair, without private endpoints, keys, or identifiers. 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.
  • Keep providerReplay out of trajectory data (P1) - The new common projection no longer omits providerReplay, unlike the current diagnostic sanitizer. Since transcript messages and tool arguments are passed through this projection for export, private replay state can be written to trajectory artifacts. Restore the generic omission and cover runtime and export paths.
  • Resolve security concern: Private replay state can reach exports - The replacement sanitizer does not omit providerReplay although current main does, and trajectory export passes transcript messages through it.
  • Resolve merge risk (P1) - providerReplay is internal transcript replay state and would now reach trajectory exports, weakening the established privacy boundary.
  • Resolve merge risk (P1) - The required direct Codex app-server source inspection is unavailable in this review environment.
  • Resolve merge risk (P1) - The latest head lacks independently inspectable after-fix runtime and export proof.
  • Complete next step (P2) - A concrete P1 projection repair is needed, followed by contributor-owned current-head proof and a direct Codex contract check.

Findings

  • [P1] Keep providerReplay out of trajectory data — src/trajectory/provenance-sanitization.ts:251-264
  • [medium] Private replay state can reach exports — src/trajectory/provenance-sanitization.ts:251
Agent review details

Security

Needs attention: The patch regresses the established exclusion of private provider replay state from exported trajectory data.

PR surface

Source +375, Tests +2534, Docs +8. Total +2917 across 54 files.

View PR surface stats
Area Files Added Removed Net
Source 30 1593 1218 +375
Tests 23 2994 460 +2534
Docs 1 8 0 +8
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 54 4595 1678 +2917

Review metrics

Metric Value Why it matters
Production versus test delta production +1601/-1218; tests +2994/-460 The production growth serves recorder ownership, receipt lifecycle, and persistence-boundary hardening, so the remaining export leak needs correction before merge.

Stored data model

Persistent data-model change detected: database schema: extensions/codex/src/app-server/trajectory.test.ts, durable storage schema: src/gateway/worker-environments/live-event-projection.test.ts, durable storage schema: src/gateway/worker-environments/live-event-projection.ts, serialized state: src/agents/sessions/agent-session-base.ts, serialized state: src/agents/sessions/agent-session-prompting.ts, serialized state: src/agents/sessions/agent-session-steering.test.ts, and 16 more. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #119266
Summary: This PR is the open candidate repair for the native delegation observability gap.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Restore replay-state exclusion (recommended)
    Omit providerReplay at the shared trajectory projection boundary and add export/runtime regressions before merging.
  2. Pause for contract evidence
    Pause merge until the direct Codex source contract and exact-head behavior proof are available.

Technical review

Best 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:

  • [P1] Keep providerReplay out of trajectory data — src/trajectory/provenance-sanitization.ts:251-264
    The new common projection no longer omits providerReplay, unlike the current diagnostic sanitizer. Since transcript messages and tool arguments are passed through this projection for export, private replay state can be written to trajectory artifacts. Restore the generic omission and cover runtime and export paths.
    Confidence: 0.98

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 909509a5db8d.

Labels

Label changes:

  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp. Replaced prior rating: 🦐 gold shrimp.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🦪 silver shellfish, so this older rating label is no longer current.

Label justifications:

  • P1: The patch can export private replay state and affects active delegated-session behavior.
  • merge-risk: 🚨 session-state: Exact steering receipts determine which queued message may settle and record receiver provenance.
  • merge-risk: 🚨 security-boundary: The new common sanitizer drops the existing providerReplay exclusion before persistence and export.
  • merge-risk: 🚨 compatibility: The PR changes schema-v1 trajectory producer and export behavior across runtimes.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp. Replaced prior rating: 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: Earlier reported captures predate the current head; add redacted exact-head runtime and export evidence after the repair, without private endpoints, keys, or identifiers. 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.

Evidence

Security concerns:

  • [medium] Private replay state can reach exports — src/trajectory/provenance-sanitization.ts:251
    The replacement sanitizer does not omit providerReplay although current main does, and trajectory export passes transcript messages through it.
    Confidence: 0.98

What I checked:

Likely related people:

  • vincentkoc: Recent commits and maintainer discussion own the trajectory sanitizer and steering-receipt repair series. (role: recent area contributor; confidence: high; commits: 21f236bb6033, 8fcef4127b91; files: src/trajectory/provenance-sanitization.ts, src/agents/sessions/agent-session-steering.ts)
  • Peter Steinberger: Recent current-main history covers the same trajectory export and steering surfaces. (role: adjacent owner; confidence: medium; commits: 7fd723b51539, a67784ef431d; files: src/agents/sessions/agent-session-prompting.ts, src/trajectory/export.ts)

Rank-up moves

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

  • Restore providerReplay exclusion with focused runtime and export coverage.
  • Add redacted exact-head delegation and exported-artifact proof.
  • Re-run review where sibling Codex source is available.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (19 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-07T05:50:16.895Z sha abb3c23 :: needs real behavior proof before merge. :: [P1] Redact retained provenance values before recording
  • reviewed 2026-08-07T09:37:54.969Z sha f8792c5 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-07T11:37:19.872Z sha 170b0b0 :: needs real behavior proof before merge. :: [P1] Preserve a canonical sender join key
  • reviewed 2026-08-07T13:48:00.246Z sha 24ac418 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-07T14:40:01.659Z sha fd838f1 :: needs real behavior proof before merge. :: [P1] Preserve sensitive ancestor keys during trajectory projection | [P1] Resolve the new public plugin SDK contract
  • reviewed 2026-08-07T15:38:32.955Z sha 39ab57d :: needs real behavior proof before merge. :: [P1] Resolve the public plugin SDK contract
  • reviewed 2026-08-07T16:55:58.681Z sha 39ab57d :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-08T20:40:43.793Z sha 8fcef41 :: needs real behavior proof before merge. :: [P1] Keep providerReplay out of trajectory data

@openclaw-barnacle openclaw-barnacle Bot added the gateway Gateway runtime label Aug 4, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 4, 2026
@IsaiahStapleton

Copy link
Copy Markdown
Contributor Author

Addressed the latest ClawSweeper schema-v1 compatibility recommendation in 62b01f81bb4:

  • Worker tool.call trajectory rows now retain data.args for existing schema-v1 readers and add canonical data.arguments for export. Both fields receive the same already-sanitized value; the live worker event contract remains unchanged.
  • The focused worker regression now pins both fields, equality after sanitization, and absence of the raw credential. The existing export regression pins skill detection from canonical arguments.
  • Historical 7.2-beta args-only rows are unchanged; this does not add a storage migration.

Verification on the pushed head:

  • node scripts/run-vitest.mjs src/gateway/worker-environments/live-event-projection.test.ts src/trajectory/export.test.ts — 44 tests passed.
  • node_modules/.bin/oxfmt --check on both changed files — passed.
  • node scripts/run-oxlint.mjs on both changed files — passed.
  • git diff --check — passed.

I also rechecked the direct Codex contract at sibling Codex 6a828ca26f3e: MCP and dynamic tool-call protocol items carry arguments, and the app server forwards dynamic calls with that field. No Codex live or persisted contract changes here.

The PR body now records this compatibility decision and labels the existing two-agent production run accurately as predecessor-head (663385dc7ca) proof. That run covers the unchanged native sender/receiver paths; an exact-current-head production capture remains pending before the next review request.

@IsaiahStapleton

Copy link
Copy Markdown
Contributor Author

Explicitly reran the native two-agent sessions_send proof on exact PR head 62b01f81bb4ec0af328d35e135bb9e4a2f989b3d to address ClawSweeper's exact-head proof request. I rebuilt and pushed the image from that checkout, rolled the operator gateway to image digest sha256:a83a7bf2bc36dfa47d7d90d9cb74cee64182eebce227f62713ba245e545969f0, confirmed "runner": "embedded", and parsed the fresh R3 sender tool.call/tool.result plus receiver prompt.submitted.origin rows from persisted SQLite storage. The redacted rows and timestamps are now in the PR body.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 4, 2026
@IsaiahStapleton
IsaiahStapleton force-pushed the feat/native-tool-events-origin branch from 62b01f8 to 21d3ed0 Compare August 4, 2026 20:23
@clawsweeper clawsweeper Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Aug 4, 2026
@IsaiahStapleton

Copy link
Copy Markdown
Contributor Author

Addressed ClawSweeper's exact-head behavior-proof request on db2d8db13659f7d84e84bb470ac397b96ba1dfb2.

  • Rebased onto current origin/main and added Codex receiver-origin parity.
  • The mixed-runtime run exposed a sanitizer false positive on routing keys, so sessionKey and sourceSessionKey are now narrowly preserved while credential fields remain redacted.
  • Rebuilt the exact head with the Codex extension and embedded commit SHA. The running gateway reports OpenClaw 2026.7.2 (db2d8db) at image digest sha256:c4bf8aabb8e5bb85fb129987ce9be57bce59d09047fa744b2e9fef3f8e6802bc.
  • Fresh persisted SQLite capture proves native gpt-5.6 to Codex gpt-5.5 delegation and the Codex-to-native reply, with canonical arguments, successful tool.result, and structured receiver origin in both directions.
  • Focused Codex tests pass 129/129; formatting, lint, core types, and test types pass.

The PR body now contains the redacted exact-head rows, timestamps, runtime identities, and digest.

@clawsweeper clawsweeper Bot added status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 4, 2026
@vincentkoc vincentkoc self-assigned this Aug 5, 2026

@vincentkoc vincentkoc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. Scope routing-key preservation to validated provenance.
  2. Carry provenance through active steering and commit.
  3. Separate approval presentation from terminal telemetry.
  4. 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)) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 } : {}),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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", {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@IsaiahStapleton
IsaiahStapleton force-pushed the feat/native-tool-events-origin branch from db2d8db to 74e4be9 Compare August 5, 2026 16:45

@vincentkoc vincentkoc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@vincentkoc

Copy link
Copy Markdown
Member

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Command router queued. I will update this comment with the next step.

@vincentkoc vincentkoc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@vincentkoc

Copy link
Copy Markdown
Member

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 8, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

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 clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 8, 2026
@vincentkoc

Copy link
Copy Markdown
Member

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 8, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@vincentkoc

Copy link
Copy Markdown
Member

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 8, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 8, 2026
@vincentkoc

Copy link
Copy Markdown
Member

Maintainer direction:

Maintainers attempted a same-branch narrow rewrite against current main, but did not push it because adversarial review still reproduced four branch-owned blockers:

  • Routing-key aliases from unrestricted tool arguments remain unredacted.
  • This branch removes Codex diagnostic truncation and private-media redaction guarantees.
  • A pending request_user_input can consume delegated steering before origin correlation exists.
  • Malformed claimed sessions_send provenance can retain raw annotated prompt text.

The original issue only requires native tool.call / tool.result lifecycle telemetry plus joinable sessions_send receiver origin.

Do not continue expanding this PR. No author action is requested. Leave the branch unchanged while maintainers decide a fresh minimal replacement from current main. The PR remains open, but is not mergeable.

Direct upstream Codex evidence was checked for unrestricted JsonValue and steering ordering in ../codex/codex-rs/app-server-protocol/src/protocol/v2/item.rs and ../codex/codex-rs/core/src/session/mod.rs.

@openclaw-barnacle

Copy link
Copy Markdown

This assigned pull request has been automatically marked as stale after being open for 27 days.
Please add updates or it will be closed.

@openclaw-barnacle

Copy link
Copy Markdown

Closing due to inactivity.
If you believe this PR should be revived, post in #clawtributors on Discord to talk to a maintainer.
That channel is the escape hatch for high-quality PRs that get auto-closed.

@openclaw-barnacle openclaw-barnacle Bot closed this Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation extensions: codex gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL stale Marked as stale due to inactivity 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.

[Bug]: sessions_send delegation leaves no structured trace: native runner records no tool events, receiver origin is prose-only

2 participants