Skip to content

fix(transcripts): mark delivery mirrors as artifacts#99855

Merged
vincentkoc merged 3 commits into
mainfrom
fix/delivery-mirror-provenance
Jul 4, 2026
Merged

fix(transcripts): mark delivery mirrors as artifacts#99855
vincentkoc merged 3 commits into
mainfrom
fix/delivery-mirror-provenance

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes an issue where users auditing session transcripts could see delivery mirror rows recorded as openai-responses output when those rows were OpenClaw transcript bookkeeping for channel-final messages, not provider/model calls.

Why This Change Was Made

Delivery mirror transcript rows now use a dedicated openclaw-transcript artifact API while keeping the existing openclaw provider and delivery-mirror model markers that history filtering already understands. Shared constants keep transcript writing, replay, repair, session-lock, and gateway-history tests on the same provenance identity.

User Impact

Transcript and history tooling can distinguish OpenClaw delivery mirrors from real model responses. This removes the misleading openai-responses|openclaw|delivery-mirror provenance tuple from newly written channel-final mirror records.

Evidence

  • pnpm exec oxfmt --write --threads=1 src/shared/transcript-only-openclaw-assistant.ts src/config/sessions/transcript.ts src/config/sessions/transcript.test.ts src/agents/session-file-repair.test.ts src/agents/embedded-agent-runner/replay-history.test.ts src/agents/embedded-agent-runner.sanitize-session-history.test.ts src/agents/embedded-agent-runner/run/attempt.session-lock.test.ts src/gateway/sessions-history-http.test.ts
  • pnpm test:serial src/config/sessions/transcript.test.ts src/agents/session-file-repair.test.ts src/agents/embedded-agent-runner/replay-history.test.ts src/agents/embedded-agent-runner.sanitize-session-history.test.ts src/agents/embedded-agent-runner/run/attempt.session-lock.test.ts src/gateway/sessions-history-http.test.ts
  • OPENCLAW_TESTBOX=1 pnpm check:changed (blacksmith-testbox, tbx_01kwnwjeedbg4y2jhfrvv5c4a0)

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime agents Agent runtime and tooling size: S maintainer Maintainer-authored PR labels Jul 4, 2026
@clawsweeper

clawsweeper Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 4, 2026, 4:10 AM ET / 08:10 UTC.

Summary
This PR changes new delivery-mirror transcript rows to use a dedicated openclaw-transcript API marker and centralizes the OpenClaw transcript-only provider/model constants across related tests.

PR surface: Source +15, Tests +13. Total +28 across 8 files.

Reproducibility: yes. at source level: current main writes delivery-mirror rows with api: "openai-responses" in appendAssistantMessageToSessionTranscript. I did not run a live transcript-audit scenario in this read-only review.

Review metrics: 1 noteworthy metric.

  • Persistent Transcript Provenance: 1 serialized message.api value changed. The delivery-mirror API marker is written into session JSONL and may affect transcript audit/history consumers before merge.

Stored data model
Persistent data-model change detected: serialized state: src/agents/session-file-repair.test.ts, serialized state: src/config/sessions/transcript.test.ts, serialized state: src/config/sessions/transcript.ts, serialized state: src/gateway/sessions-history-http.test.ts, unknown-data-model-change: src/config/sessions/transcript.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🌊 off-meta tidepool
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • Get maintainer acceptance that openclaw-transcript is the permanent stored artifact API marker for new delivery mirrors.

Risk before merge

Maintainer options:

  1. Accept Artifact Provenance (recommended)
    Land once maintainers agree openclaw-transcript is the stable stored artifact API for new delivery-mirror rows and normal checks are green or triaged.
  2. Sequence With Replay Fix
    If fix(sessions): prevent delivery-mirror prompt contamination with adjacent dedup and identity fallback (#99470) #99504 lands first, rebase this PR and keep the shared constants plus transcript-only predicate changes coherent.
  3. Document The Audit Contract
    If transcript JSONL api values are considered a public audit contract, add a short maintainer-approved note explaining the new artifact marker before merge.

Next step before merge

  • [P2] The maintainer-labeled PR has no actionable code finding, but the persisted transcript provenance marker needs maintainer acceptance before merge.

Security
Cleared: The diff changes transcript writer/test constants only and does not touch dependencies, CI, secrets, auth, permissions, downloaded artifacts, or code execution paths.

Review details

Best possible solution:

Land after maintainers accept openclaw-transcript as the stable stored artifact API for new delivery mirrors, sequencing with the related prompt-contamination PR if it lands first.

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

Yes, at source level: current main writes delivery-mirror rows with api: "openai-responses" in appendAssistantMessageToSessionTranscript. I did not run a live transcript-audit scenario in this read-only review.

Is this the best way to solve the issue?

Yes, with maintainer signoff on the stored marker. Changing writer provenance while preserving provider/model identity is the narrow fix for audit correctness; replay-filter-only changes would not fix the misleading stored API value.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 2abad575d250.

Label changes

Label justifications:

  • P2: This is a bounded transcript provenance fix with audit/history impact but no outage, crash loop, security break, or data loss.
  • merge-risk: 🚨 compatibility: The PR changes a persisted transcript message.api value for new delivery mirrors, which can affect consumers that treat transcript JSONL as a data contract.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The external-contributor proof gate does not apply because this PR is maintainer-labeled and authored by a repository MEMBER; the PR body includes focused test and Testbox evidence.
Evidence reviewed

PR surface:

Source +15, Tests +13. Total +28 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 2 24 9 +15
Tests 6 24 11 +13
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 48 20 +28

What I checked:

  • Repository policy read: Root AGENTS.md and scoped agent/gateway AGENTS.md files were read; the stored transcript compatibility guidance applies because this PR changes serialized transcript JSONL provenance. (AGENTS.md:1, 2abad575d250)
  • Current main behavior: Current main still writes delivery-mirror assistant transcript rows with api: "openai-responses", provider: "openclaw", and model: "delivery-mirror", so the central reported provenance problem is not already fixed on main. (src/config/sessions/transcript.ts:361, 2abad575d250)
  • PR implementation: The PR head changes only the delivery-mirror writer provenance to OPENCLAW_TRANSCRIPT_ARTIFACT_API while keeping the existing OpenClaw provider and delivery-mirror model identity. (src/config/sessions/transcript.ts:366, b56c5c490c09)
  • Shared identity constants: The PR defines OPENCLAW_TRANSCRIPT_ARTIFACT_API as openclaw-transcript and centralizes the OpenClaw provider and delivery-mirror/gateway-injected model constants used by transcript-only predicates. (src/shared/transcript-only-openclaw-assistant.ts:4, b56c5c490c09)
  • Sibling replay filter: Provider-bound replay filtering drops transcript-only OpenClaw assistant rows by role/provider/model identity, not by api, so old and new delivery mirrors follow the same replay exclusion path. (src/agents/embedded-agent-runner/replay-history.ts:280, 2abad575d250)
  • Sibling history/display paths: Gateway source-reply mirror lookup, usage projection, and display projection also key delivery mirrors on provider/model identity rather than the api field. (src/gateway/server-methods/chat.ts:1871, 2abad575d250)

Likely related people:

  • vincentkoc: Authored this PR and has recent merged/current-main history importing the shared transcript-only helper plus transcript/replay surfaces used by this change. (role: recent area contributor; confidence: high; commits: e085fa1a3ffd, b56c5c490c09; files: src/shared/transcript-only-openclaw-assistant.ts, src/config/sessions/transcript.ts, src/agents/embedded-agent-runner/replay-history.ts)
  • steipete: Introduced delivered outbound message mirroring and later tightened delivery-mirror dedupe on the central transcript writer surface. (role: feature introducer and adjacent owner; confidence: medium; commits: fdaeada3ec76, d842ec417924; files: src/config/sessions/transcript.ts, src/config/sessions/transcript.test.ts)
  • andyylin: Authored the redundant delivery-mirror dedupe fix that shaped the current writer behavior and tests around delivery mirrors. (role: delivery-mirror dedupe contributor; confidence: medium; commits: e95efa437381, d842ec417924; files: src/config/sessions/transcript.ts, src/config/sessions/transcript.test.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.
Review history (2 earlier review cycles)
  • reviewed 2026-07-04T06:45:12.310Z sha b56c5c4 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-04T08:04:16.771Z sha b56c5c4 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Jul 4, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review July 4, 2026 07:58
@vincentkoc
vincentkoc requested a review from a team as a code owner July 4, 2026 10:41
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: discord Channel integration: discord channel: imessage Channel integration: imessage channel: line Channel integration: line channel: matrix Channel integration: matrix channel: mattermost Channel integration: mattermost channel: msteams Channel integration: msteams channel: nostr Channel integration: nostr channel: signal Channel integration: signal channel: slack Channel integration: slack channel: telegram Channel integration: telegram channel: voice-call Channel integration: voice-call channel: whatsapp-web Channel integration: whatsapp-web channel: zalo Channel integration: zalo channel: zalouser Channel integration: zalouser app: ios App: ios app: macos App: macos labels Jul 4, 2026
@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Dependency Guard

This PR changes dependency-related files. Maintainers should confirm these changes are intentional.

Changed files:

  • npm-shrinkwrap.json
  • package.json

Maintainer follow-up:

  • Review whether the dependency changes are intentional.
  • Inspect resolved package deltas when lockfile, shrinkwrap, or workspace dependency policy changes are present.
  • Treat package-lock.json and npm-shrinkwrap.json diffs as security-review surfaces.
  • Run pnpm deps:changes:report -- --base-ref origin/main --markdown /tmp/dependency-changes.md --json /tmp/dependency-changes.json locally for detailed release-style evidence.

@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Dependency graph changes noted

This PR includes dependency graph changes. The dependency guard is informational because the PR author is a repository admin or a member of @openclaw/openclaw-secops.

  • Current SHA: 9ef6bb3af1681dfa8fac1319147d5a93dc3d5985
  • Trusted actor: @vincentkoc
  • Trusted role: pull request author; openclaw-secops

Security review is still recommended before merge when the dependency graph change is intentional.

@github-actions github-actions Bot added the dependencies-changed PR changes dependency-related files label Jul 4, 2026
@openclaw-barnacle openclaw-barnacle Bot added the docker Docker and sandbox tooling label Jul 4, 2026
@vincentkoc
vincentkoc merged commit db72861 into main Jul 4, 2026
113 of 115 checks passed
@vincentkoc
vincentkoc deleted the fix/delivery-mirror-provenance branch July 4, 2026 11:02
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

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

Labels

agents Agent runtime and tooling app: ios App: ios app: macos App: macos app: web-ui App: web-ui channel: discord Channel integration: discord channel: feishu Channel integration: feishu channel: imessage Channel integration: imessage channel: line Channel integration: line channel: matrix Channel integration: matrix channel: mattermost Channel integration: mattermost channel: msteams Channel integration: msteams channel: nostr Channel integration: nostr channel: signal Channel integration: signal channel: slack Channel integration: slack channel: telegram Channel integration: telegram channel: twitch Channel integration: twitch channel: voice-call Channel integration: voice-call channel: whatsapp-web Channel integration: whatsapp-web channel: zalo Channel integration: zalo channel: zalouser Channel integration: zalouser cli CLI command changes commands Command implementations dependencies-changed PR changes dependency-related files docker Docker and sandbox tooling docs Improvements or additions to documentation extensions: acpx extensions: codex extensions: device-pair extensions: memory-core Extension: memory-core extensions: memory-wiki extensions: phone-control gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. plugin: migrate-claude plugin: migrate-hermes rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts security Security documentation size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant