Skip to content

fix(memory): persist trusted owner provenance at the canonical transcript boundary - #118987

Merged
steipete merged 1 commit into
mainfrom
codex/qa0803-trusted-transcript-owner-provenance
Aug 3, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/qa0803-trusted-transcript-owner-provenance

Conversation

@steipete

@steipete steipete commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Root cause and architectural owner

Trusted transcript ownership was inferred or lost separately across gateway agent runs, local CLI recording, direct replies, collected followups, and durable overflow summaries. Synthetic inter-session/internal input could therefore become owner-authored durable memory, while real operator-originated owner turns could lose their authoritative ownership.

Canonical repair

  • Record ownership and provenance together once at the existing buildPersistedUserTurnMessage persistence owner: only genuine external-user owner input is eligible for trusted memory; inter-session and internal-system turns remain explicitly untrusted without reducing their separate execution permissions.
  • Forward existing authoritative owner/provenance facts from the gateway, local CLI recorder, and overflow-summary producer; all other existing producers automatically inherit the canonical rule.
  • Preserve cron execution privileges, sender metadata, transport metadata, hooks, idempotency, and undefined versus explicit-false semantics.
  • Exactly four existing production owners, five existing regression suites; production net +12 lines; no public SDK, configuration, database schema, protocol, or compatibility additions.

Real behavior proof

{
  "physicalStore": "agents/main/agent/openclaw-agent.sqlite",
  "consumer": "actual session-backed memory corpus and dreaming projection",
  "matrix": {
    "entrypoints": [
      "gateway agent",
      "local CLI",
      "admin chat.send",
      "direct auto reply",
      "collect",
      "durable overflow"
    ],
    "provenance": [
      "external_user",
      "inter_session",
      "internal_system"
    ],
    "sender": [
      "owner",
      "nonowner"
    ],
    "scenarios": 16,
    "passed": 16
  },
  "mixedOverflow": {
    "queueCap": 1,
    "sameTransportSenderId": true,
    "inputOrder": [
      "guest:false",
      "owner:true"
    ],
    "actual": [
      {
        "text": "GUEST_ALPHA",
        "executionOwner": false,
        "transcriptOwner": false
      },
      {
        "text": "OWNER_BRAVO",
        "executionOwner": true,
        "transcriptOwner": true
      }
    ],
    "modes": [
      "collect",
      "followup"
    ],
    "guestLeak": false
  }
}
  • Focused gateway 270 + CLI 25 + queue 22 + transcript-owner 38 + persistence 7 = 362 passed; unchanged ACP/direct-reply suites add six for 368 total passing tests.
  • Actual physical SQLite, owner memory corpus, and dreaming projection verified all 16 trust matrix cases and mixed-owner overflow ordering; formatting, oxlint, and diff checks passed.
  • Exactly-one Codex/Sol/high formal raised a mixed-owner overflow hypothetical; it was conclusively rejected using direct owner-key/group-source inspection and the pre-existing exact cap=1 guest-then-owner regression. Five existing mixed-owner chronology tests all passed, and separate real production collect/followup queues with the same sender id produced the physical SQLite result above. Zero accepted P0/P1 findings.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime agents Agent runtime and tooling size: M maintainer Maintainer-authored PR labels Aug 3, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. labels Aug 3, 2026
@clawsweeper

clawsweeper Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 3, 2026, 6:02 PM ET / 22:02 UTC.

ClawSweeper review

What this changes

The PR records owner and provenance facts on persisted user turns so only external owner input remains trusted by transcript-backed memory, while synthetic handoffs retain their separate execution permissions.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep this PR open for normal maintainer review. The patch repairs a source-proven trust-boundary gap: current main persisted the caller’s owner flag unchanged and several transcript producers omitted the authoritative owner/provenance facts; this branch normalizes that fact at the canonical persistence boundary and forwards it through the affected gateway, CLI, and overflow paths. The protected maintainer label also requires explicit maintainer handling rather than automated cleanup.

Priority: P1
Reviewed head: 1d1ce9255e827f2a19a899f995b88830d0baba64

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused canonical repair with broad adjacent regression coverage and credible live-output proof; final head CI remains the normal merge gate.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The PR body supplies copied after-fix live-output evidence for a physical SQLite transcript, memory corpus, and dreaming projection across 16 provenance/owner cases, supplemented by focused test totals and a successful real-behavior-proof check.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body supplies copied after-fix live-output evidence for a physical SQLite transcript, memory corpus, and dreaming projection across 16 provenance/owner cases, supplemented by focused test totals and a successful real-behavior-proof check.
Evidence reviewed 6 items Current-main defect: At the reviewed current-main SHA, the canonical persisted-user-turn builder copied senderIsOwner without considering provenance, so a caller that marked a synthetic handoff as owner-authored could persist it as trusted.
Canonical repair: The PR changes the persistence owner to retain senderIsOwner: true only when provenance is absent or explicitly external_user; inter_session and internal_system become untrusted persisted metadata.
Caller coverage: The branch forwards the existing command owner/provenance facts into the fallback CLI recorder, carries the gateway-derived owner fact into its recorder, and adds the source owner fact to synthetic overflow-summary persistence.
Findings None None.
Security None None.

How this fits together

User turns arrive through gateway RPC, local agent commands, channel reply queues, and overflow summaries before OpenClaw persists a canonical transcript message to SQLite. Memory and dreaming consumers read that transcript metadata, so the persisted owner flag must distinguish genuine owner input from privileged synthetic work.

flowchart LR
  A[Gateway, CLI, and channel input] --> B[Owner and provenance facts]
  B --> C[Canonical transcript builder]
  C --> D{External owner input?}
  D -->|Yes| E[Trusted owner metadata]
  D -->|No| F[Untrusted transcript metadata]
  E --> G[SQLite transcript and memory]
  F --> G
Loading

Before merge

  • Resolve merge risk (P1) - This intentionally changes durable transcript ownership for synthetic turns; maintainers should confirm that downstream memory consumers treat the new untrusted metadata as the desired migration-free behavior before merge.
  • Resolve merge risk (P1) - One required CI shard was still in progress in the supplied check state, so the final merge gate should evaluate the exact head after it completes.
  • Complete next step (P2) - This active, protected maintainer-labeled PR needs ordinary owner review and final exact-head CI confirmation; there is no discrete repair task to hand to an automated fix lane.
Agent review details

Security

None.

PR surface

Source +28, Tests +133. Total +161 across 9 files.

View PR surface stats
Area Files Added Removed Net
Source 5 37 9 +28
Tests 4 163 30 +133
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 9 200 39 +161

Review metrics

Metric Value Why it matters
Production versus regression coverage production +12, tests +149 The small production change centralizes a persisted ownership invariant while the added coverage spans the primary ingress and queue paths.
Persisted ownership semantics 1 stored owner field narrowed; 0 config, schema, protocol, or SDK changes The compatibility-sensitive effect is limited to future transcript metadata rather than a public configuration or database migration surface.

Stored data model

Persistent data-model change detected: serialized state: src/sessions/user-turn-transcript.persistence.test.ts, serialized state: src/sessions/user-turn-transcript.test.ts, serialized state: src/sessions/user-turn-transcript.ts, unknown-data-model-change: src/sessions/user-turn-transcript.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Confirm and land the persisted-trust boundary (recommended)
    Accept the intended change that future synthetic turns are stored as untrusted, then merge after the final current-head checks pass.
  2. Pause for memory-consumer confirmation
    Hold the PR if maintainers intend any synthetic owner run to remain a trusted source for durable memory, because that would require a different explicit contract.

Technical review

Best possible solution:

Land the canonical persistence-boundary normalization once the final head checks pass and a maintainer confirms that synthetic owner execution must remain distinct from trusted durable-memory authorship.

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

Yes—current-main source shows the canonical builder persisting a supplied owner flag unchanged, while the affected recorder paths omit or fail to forward the authoritative fact. The PR’s focused regression matrix exercises the resulting provenance combinations, though this read-only review did not execute it.

Is this the best way to solve the issue?

Yes—the best fix is to normalize trust once at buildPersistedUserTurnMessage and forward existing facts from producers, rather than teaching each memory consumer or ingress path its own synthetic-input exception.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 65fa1f9a7bd1.

Labels

Label changes:

  • add P1: A synthetic turn can currently be persisted as trusted owner-authored memory, affecting a live agent-memory workflow rather than optional behavior.
  • add merge-risk: 🚨 session-state: The PR changes persisted transcript ownership metadata that downstream memory and dreaming projections consume.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body supplies copied after-fix live-output evidence for a physical SQLite transcript, memory corpus, and dreaming projection across 16 provenance/owner cases, supplemented by focused test totals and a successful real-behavior-proof check.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body supplies copied after-fix live-output evidence for a physical SQLite transcript, memory corpus, and dreaming projection across 16 provenance/owner cases, supplemented by focused test totals and a successful real-behavior-proof check.

Label justifications:

  • P1: A synthetic turn can currently be persisted as trusted owner-authored memory, affecting a live agent-memory workflow rather than optional behavior.
  • merge-risk: 🚨 session-state: The PR changes persisted transcript ownership metadata that downstream memory and dreaming projections consume.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body supplies copied after-fix live-output evidence for a physical SQLite transcript, memory corpus, and dreaming projection across 16 provenance/owner cases, supplemented by focused test totals and a successful real-behavior-proof check.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body supplies copied after-fix live-output evidence for a physical SQLite transcript, memory corpus, and dreaming projection across 16 provenance/owner cases, supplemented by focused test totals and a successful real-behavior-proof check.

Evidence

What I checked:

  • Current-main defect: At the reviewed current-main SHA, the canonical persisted-user-turn builder copied senderIsOwner without considering provenance, so a caller that marked a synthetic handoff as owner-authored could persist it as trusted. (src/sessions/user-turn-transcript.ts:165, 65fa1f9a7bd1)
  • Canonical repair: The PR changes the persistence owner to retain senderIsOwner: true only when provenance is absent or explicitly external_user; inter_session and internal_system become untrusted persisted metadata. (src/sessions/user-turn-transcript.ts:165, 1d1ce9255e82)
  • Caller coverage: The branch forwards the existing command owner/provenance facts into the fallback CLI recorder, carries the gateway-derived owner fact into its recorder, and adds the source owner fact to synthetic overflow-summary persistence. (src/agents/command/run-embedded-attempt.ts:170, 1d1ce9255e82)
  • Existing sibling flow: Collected followups already create recorder inputs from the source run’s senderIsOwner and inputProvenance, so they inherit the new canonical normalization instead of needing a parallel policy branch. (src/auto-reply/reply/queue/drain.ts:402, 65fa1f9a7bd1)
  • Regression coverage: The PR adds a matrix over undefined, external-user, inter-session, and internal-system provenance, including deferred resolution, plus gateway, CLI, queue, and persistence regressions. (src/sessions/user-turn-transcript.test.ts:83, 1d1ce9255e82)
  • Branch ancestry: The PR is a one-commit change based on commit 76cc60a..., which is an ancestor of the reviewed current-main SHA; the current main does not already contain this repair. (src/sessions/user-turn-transcript.ts:154, 1d1ce9255e82)

Likely related people:

  • Vincent Koc: The available current-main blame for the canonical transcript-builder region attributes the present lines to this recent source-file touch; deeper historical traversal was limited by unavailable promisor objects. (role: recent area contributor; confidence: low; commits: 5150670c72d9; files: src/sessions/user-turn-transcript.ts)

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.

@steipete
steipete merged commit 2c79d1d into main Aug 3, 2026
134 of 144 checks passed
@steipete
steipete deleted the codex/qa0803-trusted-transcript-owner-provenance branch August 3, 2026 22:18
@steipete

steipete commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Aug 3, 2026
…r-admin-20260803

* origin/main: (89 commits)
  fix(googlechat): align doctor policy ownership with canonical account configuration (#118972)
  test(tui): prove editor input through PTY (#118982)
  fix(memory): persist trusted owner provenance at canonical transcript boundary (#118987)
  test(qa): cover health monitor and cache boundaries (#118961)
  fix(macos): restore dashboard frame double-click zoom (#118976)
  fix(googlechat): recover durable lanes after oversized attachments (#118986)
  test(qa): cover runtime telemetry evidence (#118950)
  fix(gateway): resolve SQLite usage details (#118918)
  test(cron): cover durable scheduler state (#118981)
  test(gateway): cover node exec approval relay (#118825)
  test(qa): add Active Memory recall coverage (#118963)
  test(qa): promote package-backed Docker artifact proof (#118826)
  test(qa): cover diagnostic event boundary (#118844)
  test(gateway): cover WebSocket runtime contracts (#118797)
  fix(signal): drain accepted websocket messages before shutdown (#118975)
  fix(plugins): remove stale load paths during uninstall (#118930)
  test(qa): cover bundled runtime discovery (#118922)
  chore(clawhub): cover plugin release policy contracts (#118971)
  test(qa): cover support export and stability (#118956)
  fix(feishu): enforce exact signed webhook request boundaries (#118758)
  ...
vincentkoc added a commit that referenced this pull request Aug 3, 2026
…ansports-20260803

* origin/main: (120 commits)
  test(ui): add service-worker update primary QA proof (#118805)
  test(qa): cover CLI onboarding and plugin install sources (#118882)
  test(qa): cover remote logging boundaries (#118951)
  fix(sms): retry transient MMS failures before durable adoption (#118994)
  test(qa): cover video generation invocation (#118864)
  test(qa): cover media reference intake (#118858)
  test(qa): cover image generation task lifecycle (#118915)
  feat(sms): track Twilio delivery status (#118665)
  test(tasks): cover TaskFlow registry lifecycle (#118983)
  test(gateway): verify SSH tunnel fallback (#118818)
  fix(security): harden network tool output at canonical owner boundaries (#118984)
  fix(googlechat): align doctor policy ownership with canonical account configuration (#118972)
  test(tui): prove editor input through PTY (#118982)
  fix(memory): persist trusted owner provenance at canonical transcript boundary (#118987)
  test(qa): cover health monitor and cache boundaries (#118961)
  fix(macos): restore dashboard frame double-click zoom (#118976)
  fix(googlechat): recover durable lanes after oversized attachments (#118986)
  test(qa): cover runtime telemetry evidence (#118950)
  fix(gateway): resolve SQLite usage details (#118918)
  test(cron): cover durable scheduler state (#118981)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 4, 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 gateway Gateway runtime maintainer Maintainer-authored PR 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. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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