Repository navigation
fix(gateway): silent exec-completion prompts show as user messages in imported Claude CLI history - #174780
Conversation
…CLI history The Claude CLI importer recognized the delivered exec-completion prompt as an internal turn but not the deliverToUser=false form, so Claude's native user row for it was shown as a human message. Match the whole silent frame (fixed opening and closing sentences), with and without the heartbeat response tool.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
…eartbeat scratch The heartbeat runner can append a scratch section after the prompt, so match the closing sentence anywhere in the body instead of at its end.
|
Codex review: needs maintainer review before merge. What this changesThis PR hides saved silent exec-completion prompts in imported Claude history through the shared internal-wake classifier. Example: Import a Claude session containing a silent completion ending “Do not mention, summarize, or reuse command output.”
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Partial Merge readiness✅ Ready for maintainer review This PR fixes a concrete history-display bug that remains on current main; no actionable patch defects were found, and exact-head CI is still pending. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherClaude native history and durable catalog imports feed Gateway transcript projection, which returns human-facing messages through chat.history to Control UI. flowchart TD
A[Claude native history] --> B[Native history reader]
A --> C[Durable catalog import]
B --> D[Shared wake classifier]
C --> D
D --> E[History display projection]
E --> F[Chat history RPC]
F --> G[Control UI]
Technical reviewBest possible solution: Land the shared, attribution-scoped classifier repair while retaining the broader phantom-message issue for its remaining subtypes. Do we have a high-confidence way to reproduce the issue? The supplied built-Gateway comparison reproduces the display failure on the integrated main baseline, and inspected screenshots agree with current-main source; no target code was executed during this review. Is this the best way to solve the issue? The patch uses the existing shared classifier for both import paths, preserves canonical human attribution, and adds no competing owner or persisted format. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against dea6ff0cd0a3. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +17, Tests +47. Total +64 across 4 files. Added test files: 0. View PR surface stats
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (3 earlier review cycles)Reviewed October 26, 2026, 12:20 PM ET / 16:20 UTC (Revision 4). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
…-exec-prompt-display # Conflicts: # src/gateway/cli-session-history.claude-input.test.ts
|
Root-cause completion after integrating #174815: the initial reader-only patch did not fix durable |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
… imported Claude CLI history (#174780) fix(claude-cli): stop silent background-command completion envelopes showing as user messages Imported Claude history showed OpenClaw's internal silent background-command completion envelopes as human user messages. They are now recognized by the shared internal-wake classifier, the same owner that handles heartbeat instructions, so durable imports and the native history reader both leave them out. Real user text, quoted envelope text, assistant replies and the import notice are unchanged. Evidence: synthetic native Claude sessions imported with the shipped `sessions import claude` into built Gateways. On main chat.history and the Control UI in Chromium showed all three silent-completion variants as user messages (twice); with this change they are gone (twice), while the real and quoted controls remain. Screenshots: openclaw/openclaw#174780 (comment). The rest of #151962 is not addressed here. Thanks @maliv2. Co-authored-by: Ayaan Zaidi <[email protected]>
… imported Claude CLI history (#174780) fix(claude-cli): stop silent background-command completion envelopes showing as user messages Imported Claude history showed OpenClaw's internal silent background-command completion envelopes as human user messages. They are now recognized by the shared internal-wake classifier, the same owner that handles heartbeat instructions, so durable imports and the native history reader both leave them out. Real user text, quoted envelope text, assistant replies and the import notice are unchanged. Evidence: synthetic native Claude sessions imported with the shipped `sessions import claude` into built Gateways. On main chat.history and the Control UI in Chromium showed all three silent-completion variants as user messages (twice); with this change they are gone (twice), while the real and quoted controls remain. Screenshots: openclaw/openclaw#174780 (comment). The rest of #151962 is not addressed here. Thanks @maliv2. Co-authored-by: Ayaan Zaidi <[email protected]>
… imported Claude CLI history (openclaw#174780) fix(claude-cli): stop silent background-command completion envelopes showing as user messages Imported Claude history showed OpenClaw's internal silent background-command completion envelopes as human user messages. They are now recognized by the shared internal-wake classifier, the same owner that handles heartbeat instructions, so durable imports and the native history reader both leave them out. Real user text, quoted envelope text, assistant replies and the import notice are unchanged. Evidence: synthetic native Claude sessions imported with the shipped `sessions import claude` into built Gateways. On main chat.history and the Control UI in Chromium showed all three silent-completion variants as user messages (twice); with this change they are gone (twice), while the real and quoted controls remain. Screenshots: openclaw#174780 (comment). The rest of openclaw#151962 is not addressed here. Thanks @maliv2. Co-authored-by: Ayaan Zaidi <[email protected]>
…t history (#184216) Related: #174780 ## What Problem This Solves Fixes: background exec completion notices show as user messages in Control UI history for Claude CLI sessions. ## User Impact In Claude CLI sessions, the internal `[OpenClaw exec completion]` wake no longer appears as if the user typed it. The model still receives the wake and reports the result. A person who pastes wake text and adds a question still sees that message. Other backends are unchanged. ## Why This Change Was Made Claude Code records every stream-json input as an ordinary user row, so the history importer had to recognize wakes by their exact text. That broke when #182188 changed the wake frame. Another text matcher would break again the next time any wake text changes. Claude Code has a native marker for this case. Input sent with `isSynthetic: true` is saved as a meta row (`isMeta: true`, `turnOrigin: "host_synthetic"`), and the model still receives it. The importer already omits meta rows. The fix: - Core sets a new optional `promptOrigin: "host"` on the CLI backend execute context for exec completion wakes. - The bundled Claude runtime sends that prompt as synthetic input. - Steering messages that a person injects into the same turn stay ordinary user input. With this change, provenance comes from Claude itself instead of from text matching. The text matchers for shipped frames (the older prose wake and the silent wake from #174780) stay in place for existing transcripts. The current wake prompt, built in #182188, never reached a stable release, so it needs no matcher; stable releases used the bare `[OpenClaw exec completion]` string only as OpenClaw's own placeholder row, which existing filters already hide. Plugin SDK: additive only. `CliBackendExecuteContext` gains the optional `promptOrigin?: "host"` (documented in `docs/plugins/cli-backend-plugins.md`). `plugin-sdk:api:diff` against the merge base reports only this declaration. Credit: @Marvinthebored found and reported the regression, and wrote the first fix on this branch. ## Evidence **Live Gateway, real Claude CLI (Claude Code 2.1.310).** I ran two isolated Gateways (own state, port and workspace), one from `main` (`d0916212f`) and one from this branch. Each used a `claude-cli` Sonnet model and was driven through `chat.send`. Steps: 1. The model starts `sleep 8; echo wake-e2e-done` as a background OpenClaw exec. The completion wakes the session. 2. A person sends pasted wake text with `Why did you send this?` appended. `chat.history` rows: ```text main user Use your OpenClaw exec tool (not native Bash) to run: sleep 8; echo wake-e2e-done… assistant Started in background (session mild-reef); ending the turn now… user [OpenClaw exec completion]↵Exec completed (mild-ree, code 0) :: wake-e2e-done↵↵Treat this… <- internal wake shown as user assistant The background command finished: `wake-e2e-done`. user [OpenClaw exec completion]↵Exec completed (pasted, code 0) :: done↵↵Why did you send this? assistant I ran `sleep 8; echo wake-e2e-done` in the background per your earlier instruction… this PR user Use your OpenClaw exec tool (not native Bash) to run: sleep 8; echo wake-e2e-done… assistant Started the background command (session nimble-gulf). I'll be notified when it exits. assistant Background command finished successfully: `wake-e2e-done` (exit 0). user [OpenClaw exec completion]↵Exec completed (pasted, code 0) :: done↵↵Why did you send this? assistant I sent that because you'd asked me to run `sleep 8; echo wake-e2e-done` as a background ex… ``` Native Claude rows for the wake turn: - On `main`: an ordinary user row (`turnOrigin: "sdk"`). - With this PR: `isMeta: true`, `turnOrigin: "host_synthetic"`. Claude prefixes the content with `[MESSAGE FROM NON-USER SOURCE - NOT USER INPUT]`, and the model still acts on it. **Claude Code behavior checks**, with direct `claude -p --input-format stream-json` probes: - Synthetic input reaches the model and survives `--resume`. The model repeated a word given only in a synthetic message on the next resumed turn. - The `UserPromptSubmit` hook still fires for synthetic input, so private resume context and steering admission are unchanged. **Tests** - `cli-runtime.test.ts`: a host prompt is sent with `isSynthetic`, and an ordinary prompt is not. - `execute-plugin.test.ts`: only exec completion wakes get `promptOrigin: "host"`. Heartbeat, external user and missing provenance do not. - Focused suites pass: `extensions/anthropic/cli-runtime.test.ts`, `src/agents/cli-runner/execute-plugin.test.ts`, `src/gateway/cli-session-history.test.ts` and `src/gateway/cli-session-history.claude-input.test.ts`. - `oxlint` and `oxfmt` are clean on the touched files. **Gaps** - Paired-node Claude execution uses the host-managed process path and does not send stream-json input. Wakes there still rely on existing behavior. - Heartbeat and restart-recovery prompts still use the existing text recognition. Moving them to `promptOrigin` needs separate proof that Claude's non-user framing does not change how the model treats heartbeat task instructions. **Merge danger:** two-way door. Reverting restores the previous native rows. Already-written meta rows stay hidden, which is correct for internal wakes. Blast radius: Claude CLI sessions with background exec completion wakes. Third-party CLI backend plugins can ignore the new optional field. Co-authored-by: Marvinthebored <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
…matchers (#185746) Related: #184216, #174780, #166080 ## What Problem This Solves Claude CLI history hid OpenClaw-generated turns (exec completion wakes, heartbeats, restart recovery) by matching their exact prompt text. Each time a prompt's wording changed, the matcher missed it, and the internal turn showed in history as if the user had typed it. The current restart-recovery wording is already unmatched. ## Why This Change Was Made #184216 used Claude Code's native marker for exec wakes. Input sent with `isSynthetic: true` is stored as a meta row (`isMeta: true`, `turnOrigin: "host_synthetic"`). The model still receives it, and the history importer already drops meta rows. This PR applies the same marker to every OpenClaw-generated turn and deletes the text matchers: - The CLI runner sets `promptOrigin: "host"` exactly when the run's input provenance is `internal_system`. Provenance is the one signal for "OpenClaw wrote this turn". - Isolated cron recorded its `internal_system` provenance on the transcript row only and never passed it to the CLI run, so cron prompts reached Claude as ordinary user input. The cron executor now passes that provenance to `runCliAgent`. Hook-mapped jobs carry external content and get no provenance, so they stay ordinary input. Other runtimes are unchanged: Codex's scheduled-MCP authority and the requester tool policy read run provenance, and this change does not touch them. - The importer keeps only Claude's own frames (`/compact`, a resume note with no prompt), the task-notification and interrupt markers, and the inbound-context stripping that matches decorated human rows to canonical rows. - Removed: - the exec-wake, heartbeat and restart-recovery text matchers in `cli-session-history.claude.ts` - the silent exec-wake branch in `heartbeat-filter.ts` - their fixtures and tests Net: +15 / −182. ## User Impact - New Claude CLI history never shows OpenClaw-generated turns as user messages, whatever the prompt wording. - Older Claude CLI transcripts, written before #184216, can show those internal frames as user messages again. This is a display change. - One model-facing reader is affected. When a Claude CLI run falls back to another provider, `readClaudeCliFallbackSeed` builds a recent-turns prelude from native history. That reader skips meta rows, so cron and recovery prompts are now left out of the prelude, as exec wakes already are since #184216. The assistant replies stay in it. - Other backends are unchanged. ## Evidence Isolated Gateway on this branch, real Claude CLI (Claude Code 2.1.310), `claude-cli` Sonnet. I checked the native Claude rows and `chat.history`: | Turn | Native row | Model followed the turn | Shown as user | | --- | --- | --- | --- | | Isolated cron job: "create `cron-isolated.txt` containing `<nonce>`" | `isMeta: true`, `host_synthetic` | yes, the file was written with the exact nonce | no | | Main-session cron job, same task | `isMeta: true`, `host_synthetic` | yes, the file was written | no (history shows only the assistant's "Done.") | | Background exec completion wake | meta (as in #184216) | yes, it reported `wake-e2e-done` | no | | Person pastes wake text plus a question | ordinary row | yes | yes (`external_user`) | Before the cron provenance hand-off, the isolated cron row was `turnOrigin: "sdk"`, an ordinary user row, because the run had no provenance. These cron runs also answer the open question from #184216: Claude labels synthetic input "NOT USER INPUT", but the model still carried out the job's instructions. Tests: - `execute-plugin.test.ts`: `internal_system` provenance (exec, cron) gives `promptOrigin: "host"`; inter-session, external-user and absent provenance do not. - `run.cli-ownership.test.ts`: the cron executor passes `{kind: "internal_system", sourceTool: "cron"}` to `runCliAgent`. It fails without the executor change. - Focused suites pass: `execute-plugin`, `run.cli-ownership`, `run.message-tool-policy`, `run.payload-fallbacks`, `heartbeat-filter`, `cli-session-history.claude-input`, `cli-session-history.paging`, `cli-session-history`, `extensions/anthropic/cli-runtime`. - `tsgo:core` and `tsgo:core:test` pass. `oxlint` and `oxfmt` are clean. Gaps: - Restart recovery uses the same `internal_system` provenance as the exec wake. I could not trigger an automatic recovery turn on a non-main CLI session in the isolated Gateway, so it is covered by the provenance rule and unit test, not by a live run. - Paired-node Claude execution does not use stream-json input and is unchanged. Credit: @Marvinthebored reported the exec-wake and restart-recovery history regressions that led here. **Merge danger:** two-way door. A revert restores the matchers. Meta rows already written stay hidden, which is correct for internal turns. Blast radius: Claude CLI history display, and the fallback recent-turns prelude described above. Pre-#184216 internal frames reappear in old transcripts. Third-party CLI backends can ignore `promptOrigin`. Co-authored-by: Ayaan Zaidi <[email protected]>
…t history (openclaw#184216) Related: openclaw#174780 ## What Problem This Solves Fixes: background exec completion notices show as user messages in Control UI history for Claude CLI sessions. ## User Impact In Claude CLI sessions, the internal `[OpenClaw exec completion]` wake no longer appears as if the user typed it. The model still receives the wake and reports the result. A person who pastes wake text and adds a question still sees that message. Other backends are unchanged. ## Why This Change Was Made Claude Code records every stream-json input as an ordinary user row, so the history importer had to recognize wakes by their exact text. That broke when openclaw#182188 changed the wake frame. Another text matcher would break again the next time any wake text changes. Claude Code has a native marker for this case. Input sent with `isSynthetic: true` is saved as a meta row (`isMeta: true`, `turnOrigin: "host_synthetic"`), and the model still receives it. The importer already omits meta rows. The fix: - Core sets a new optional `promptOrigin: "host"` on the CLI backend execute context for exec completion wakes. - The bundled Claude runtime sends that prompt as synthetic input. - Steering messages that a person injects into the same turn stay ordinary user input. With this change, provenance comes from Claude itself instead of from text matching. The text matchers for shipped frames (the older prose wake and the silent wake from openclaw#174780) stay in place for existing transcripts. The current wake prompt, built in openclaw#182188, never reached a stable release, so it needs no matcher; stable releases used the bare `[OpenClaw exec completion]` string only as OpenClaw's own placeholder row, which existing filters already hide. Plugin SDK: additive only. `CliBackendExecuteContext` gains the optional `promptOrigin?: "host"` (documented in `docs/plugins/cli-backend-plugins.md`). `plugin-sdk:api:diff` against the merge base reports only this declaration. Credit: @Marvinthebored found and reported the regression, and wrote the first fix on this branch. ## Evidence **Live Gateway, real Claude CLI (Claude Code 2.1.310).** I ran two isolated Gateways (own state, port and workspace), one from `main` (`3240d0117`) and one from this branch. Each used a `claude-cli` Sonnet model and was driven through `chat.send`. Steps: 1. The model starts `sleep 8; echo wake-e2e-done` as a background OpenClaw exec. The completion wakes the session. 2. A person sends pasted wake text with `Why did you send this?` appended. `chat.history` rows: ```text main user Use your OpenClaw exec tool (not native Bash) to run: sleep 8; echo wake-e2e-done… assistant Started in background (session mild-reef); ending the turn now… user [OpenClaw exec completion]↵Exec completed (mild-ree, code 0) :: wake-e2e-done↵↵Treat this… <- internal wake shown as user assistant The background command finished: `wake-e2e-done`. user [OpenClaw exec completion]↵Exec completed (pasted, code 0) :: done↵↵Why did you send this? assistant I ran `sleep 8; echo wake-e2e-done` in the background per your earlier instruction… this PR user Use your OpenClaw exec tool (not native Bash) to run: sleep 8; echo wake-e2e-done… assistant Started the background command (session nimble-gulf). I'll be notified when it exits. assistant Background command finished successfully: `wake-e2e-done` (exit 0). user [OpenClaw exec completion]↵Exec completed (pasted, code 0) :: done↵↵Why did you send this? assistant I sent that because you'd asked me to run `sleep 8; echo wake-e2e-done` as a background ex… ``` Native Claude rows for the wake turn: - On `main`: an ordinary user row (`turnOrigin: "sdk"`). - With this PR: `isMeta: true`, `turnOrigin: "host_synthetic"`. Claude prefixes the content with `[MESSAGE FROM NON-USER SOURCE - NOT USER INPUT]`, and the model still acts on it. **Claude Code behavior checks**, with direct `claude -p --input-format stream-json` probes: - Synthetic input reaches the model and survives `--resume`. The model repeated a word given only in a synthetic message on the next resumed turn. - The `UserPromptSubmit` hook still fires for synthetic input, so private resume context and steering admission are unchanged. **Tests** - `cli-runtime.test.ts`: a host prompt is sent with `isSynthetic`, and an ordinary prompt is not. - `execute-plugin.test.ts`: only exec completion wakes get `promptOrigin: "host"`. Heartbeat, external user and missing provenance do not. - Focused suites pass: `extensions/anthropic/cli-runtime.test.ts`, `src/agents/cli-runner/execute-plugin.test.ts`, `src/gateway/cli-session-history.test.ts` and `src/gateway/cli-session-history.claude-input.test.ts`. - `oxlint` and `oxfmt` are clean on the touched files. **Gaps** - Paired-node Claude execution uses the host-managed process path and does not send stream-json input. Wakes there still rely on existing behavior. - Heartbeat and restart-recovery prompts still use the existing text recognition. Moving them to `promptOrigin` needs separate proof that Claude's non-user framing does not change how the model treats heartbeat task instructions. **Merge danger:** two-way door. Reverting restores the previous native rows. Already-written meta rows stay hidden, which is correct for internal wakes. Blast radius: Claude CLI sessions with background exec completion wakes. Third-party CLI backend plugins can ignore the new optional field. Co-authored-by: Marvinthebored <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
…matchers (openclaw#185746) Related: openclaw#184216, openclaw#174780, openclaw#166080 ## What Problem This Solves Claude CLI history hid OpenClaw-generated turns (exec completion wakes, heartbeats, restart recovery) by matching their exact prompt text. Each time a prompt's wording changed, the matcher missed it, and the internal turn showed in history as if the user had typed it. The current restart-recovery wording is already unmatched. ## Why This Change Was Made openclaw#184216 used Claude Code's native marker for exec wakes. Input sent with `isSynthetic: true` is stored as a meta row (`isMeta: true`, `turnOrigin: "host_synthetic"`). The model still receives it, and the history importer already drops meta rows. This PR applies the same marker to every OpenClaw-generated turn and deletes the text matchers: - The CLI runner sets `promptOrigin: "host"` exactly when the run's input provenance is `internal_system`. Provenance is the one signal for "OpenClaw wrote this turn". - Isolated cron recorded its `internal_system` provenance on the transcript row only and never passed it to the CLI run, so cron prompts reached Claude as ordinary user input. The cron executor now passes that provenance to `runCliAgent`. Hook-mapped jobs carry external content and get no provenance, so they stay ordinary input. Other runtimes are unchanged: Codex's scheduled-MCP authority and the requester tool policy read run provenance, and this change does not touch them. - The importer keeps only Claude's own frames (`/compact`, a resume note with no prompt), the task-notification and interrupt markers, and the inbound-context stripping that matches decorated human rows to canonical rows. - Removed: - the exec-wake, heartbeat and restart-recovery text matchers in `cli-session-history.claude.ts` - the silent exec-wake branch in `heartbeat-filter.ts` - their fixtures and tests Net: +15 / −182. ## User Impact - New Claude CLI history never shows OpenClaw-generated turns as user messages, whatever the prompt wording. - Older Claude CLI transcripts, written before openclaw#184216, can show those internal frames as user messages again. This is a display change. - One model-facing reader is affected. When a Claude CLI run falls back to another provider, `readClaudeCliFallbackSeed` builds a recent-turns prelude from native history. That reader skips meta rows, so cron and recovery prompts are now left out of the prelude, as exec wakes already are since openclaw#184216. The assistant replies stay in it. - Other backends are unchanged. ## Evidence Isolated Gateway on this branch, real Claude CLI (Claude Code 2.1.310), `claude-cli` Sonnet. I checked the native Claude rows and `chat.history`: | Turn | Native row | Model followed the turn | Shown as user | | --- | --- | --- | --- | | Isolated cron job: "create `cron-isolated.txt` containing `<nonce>`" | `isMeta: true`, `host_synthetic` | yes, the file was written with the exact nonce | no | | Main-session cron job, same task | `isMeta: true`, `host_synthetic` | yes, the file was written | no (history shows only the assistant's "Done.") | | Background exec completion wake | meta (as in openclaw#184216) | yes, it reported `wake-e2e-done` | no | | Person pastes wake text plus a question | ordinary row | yes | yes (`external_user`) | Before the cron provenance hand-off, the isolated cron row was `turnOrigin: "sdk"`, an ordinary user row, because the run had no provenance. These cron runs also answer the open question from openclaw#184216: Claude labels synthetic input "NOT USER INPUT", but the model still carried out the job's instructions. Tests: - `execute-plugin.test.ts`: `internal_system` provenance (exec, cron) gives `promptOrigin: "host"`; inter-session, external-user and absent provenance do not. - `run.cli-ownership.test.ts`: the cron executor passes `{kind: "internal_system", sourceTool: "cron"}` to `runCliAgent`. It fails without the executor change. - Focused suites pass: `execute-plugin`, `run.cli-ownership`, `run.message-tool-policy`, `run.payload-fallbacks`, `heartbeat-filter`, `cli-session-history.claude-input`, `cli-session-history.paging`, `cli-session-history`, `extensions/anthropic/cli-runtime`. - `tsgo:core` and `tsgo:core:test` pass. `oxlint` and `oxfmt` are clean. Gaps: - Restart recovery uses the same `internal_system` provenance as the exec wake. I could not trigger an automatic recovery turn on a non-main CLI session in the isolated Gateway, so it is covered by the provenance rule and unit test, not by a live run. - Paired-node Claude execution does not use stream-json input and is unchanged. Credit: @Marvinthebored reported the exec-wake and restart-recovery history regressions that led here. **Merge danger:** two-way door. A revert restores the matchers. Meta rows already written stay hidden, which is correct for internal turns. Blast radius: Claude CLI history display, and the fallback recent-turns prelude described above. Pre-openclaw#184216 internal frames reappear in old transcripts. Third-party CLI backends can ignore `promptOrigin`. Co-authored-by: Ayaan Zaidi <[email protected]>


Related: #151962
What Problem This Solves
Imported Claude history can show silent background-command completion instructions as human messages. The original reader-only matcher did not cover durable catalog copies made by
sessions import claude.Why This Change Was Made
Recognize the producer's complete opening/closing frame once in the existing shared internal-wake classifier. Both generic transcript projection and the native Claude reader consume it; the duplicate reader-only matcher is removed. Require durable Claude catalog origin or explicit native-reader context, because canonical human rows can inherit
importedFrommetadata during deduplication. Human quotes and canonical human rows remain visible. No generated prompt text, stored schema, or import policy changes.Evidence
Inspected before/after screenshots and built-entry observations.
Synthetic native Claude JSONL imported through shipped
sessions import claudeinto real isolated built Gateways; actualchat.historyand compiled Control UI in Chromium, main twice and candidate twice. Main is503bc1bd44992f5dc5426fe2f2fea263524fe0db, after #174815. Candidate behavior-bearing code is preserved at final heade2996b6f882619ed4b70547cf3906302015120f7(last commit adds only an explanatory comment).Focused shared classifier suite 28/28 and native importer suite 41/41 pass. Formatter and lint pass, zero lint warnings/errors. Canonical human duplicates, quoted text, incomplete frames, timestamp prefixes, scratch suffixes, and heartbeat-only classification boundaries are covered.
Not fixed here
This fixes silent background-command completion envelopes, not every phantom-message subtype in #151962. It does not change native producers, recover missing history, or claim that all imported internal-message shapes are classified. The broader issue should remain open. GitHub closingIssuesReferences was empty before push; this body intentionally says Related, not Fixes/Closes.
Simplification and Risk
The reader-only recognition path is replaced by the shared classifier; existing projection remains the sole display owner. The original contributor commits are preserved. Production +20/-3 and tests +47 against the integrated main baseline. Additional shared attribution checks and regressions are necessary to cover durable imports without hiding canonical human messages.
Two-way door: reverting restores the previous display classification without migrating data. Blast radius is imported Claude transcript visibility and shared wake classification; ordinary authored messages must remain visible.