Repository navigation
Conversation
… not operator bubbles Claude Code writes harness-generated user-role turns (Skill instruction bodies, continuation summaries) into its native transcript with isMeta/isCompactSummary flags. The claude-cli history importer dropped that provenance, so webchat rendered those turns as right-aligned operator bubbles the operator never sent. Record the provenance at the import boundary as structured InputProvenance (internal_system / cli_harness_context) — the same contract the embedded runner uses to keep internal system prompts out of operator bubbles — and teach the system-notice path to render such turns as a collapsed "Injected context" notice that does not start an operator turn. Regression coverage: importer unit test (provenance recorded only for flagged rows), live chat.history gateway RPC test (provenance survives merge + display projection), and a chat-thread UI test (injected turn becomes a collapsed notice while a real operator message keeps its bubble). Before/after webchat captures via scripts/capture-injected-turn-notice-proof.mts. Co-Authored-By: Claude Fable 5 <[email protected]>
OpenClaw-Publication: 62f03fec-179b-4c5e-9423-4df80809de41
|
🦞👀 Pull request received. I will update this pull request when review starts. |
Release-note context lives in the PR body per repo policy. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 7:21 PM ET / 23:21 UTC. ClawSweeper reviewWhat this changesThe PR retains Claude CLI harness-row provenance during history import and displays those rows in webchat as collapsed injected-context notices instead of operator-authored messages. Merge readinessKeep open: the reviewed head is a coherent, source-bound fix, and the protected Priority: P2 Review scores
Verification
How this fits togetherGateway imports a bound CLI session transcript, merges it into chat history, and sends the result to Control UI. Control UI groups the history into transcript turns and renders provenance-marked internal rows as system notices. flowchart LR
A[Claude CLI transcript] --> B[Gateway history importer]
B --> C[Internal-context provenance]
C --> D[Chat history response]
D --> E[Control UI turn builder]
E --> F[Collapsed injected-context notice]
E --> G[Operator message group]
Decision needed
Why: The patch directly relies on an external native-transcript contract; the contributor documented direct inspection, but this read-only environment had neither the bundle nor working network to independently repeat it. Before merge
Agent review detailsSecurityNone. PR surfaceSource +88, Tests +139, Config +1, Other +125. Total +353 across 13 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the producer-side provenance classification and the existing system-notice rendering path, with maintainer acceptance of the documented Claude Code v2.1.246 flag contract. Do we have a high-confidence way to reproduce the issue? No independent reproduction was run in this read-only review; the PR supplies a concrete real-browser before/after capture claim plus importer, Gateway RPC, and UI regression coverage. Is this the best way to solve the issue? Yes, conditionally: recording provenance at the importer avoids brittle render-time text matching and reuses the existing system-notice path, subject to maintainer acceptance of the native flag contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 25a16dd96c42. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
Knip's full-tree unused-file scan requires capture scripts to be package.json entry points, matching the sibling ui:proof:* captures. Co-Authored-By: Claude Fable 5 <[email protected]>
…ovenance helper Claude Code groups isMeta, isCompactSummary, and isVisibleInTranscriptOnly as its own "not a real operator turn" predicate (verified in the v2.1.246 bundle); import all three through one canonical predicate. Inline the one-use provenance literal at the importer, returning input-provenance.ts to its main state. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Addressing the review's before-merge items: 1. Transcript-contract proof for
The inspection also surfaced the third member of upstream's grouping, 2. Production LOC / one-use helper (P1). Applied. The one-use 3. Stored data model note. No persisted-store or schema change: the flagged "serialized state" in the two test files is fixture JSONL serializing external Claude Code transcripts (the import source), not OpenClaw-owned storage. 4. Live-verification FAIL in the review harness. That step hit the harness's 30s command timeout — |
* origin/main: (26 commits) fix(plugins): preserve registry epoch on activation rollback (#129232) refactor(plugins): make discovery invocation-owned (#130486) feat(ui): save appearance preferences per user profile (#130340) fix: Buzz bots recover relay stalls and reject revoked senders (#130467) fix(code-mode): serialize catalog handles nested in final values (#130276) fix(webchat): CLI skill and harness-injected turns render as operator-sent messages (#130427) fix(agents): read the published model catalog owner from session_status (#130277) fix(channels): preserve long presentation text (#130368) fix(agents): route CLI bootstrap truncation notice into the system prompt (#130325) refactor(plugins): unify setup registration and artifact selection (#130474) fix(memory): prevent forgotten session content from returning (#130451) refactor(outbound): consolidate transport completion (#130460) fix(workers): protect in-flight workspace manifests from concurrent retention (#130449) fix(portals): keep worker previews reachable and owned by the active environment (#130434) fix(config): keep core channels keys in the generated config schema (#120736) chore(deps): refresh dependencies after seven-day cooldown (#130296) fix(agents): remind exec models to quote shell metacharacters (#125485) fix(auth): honor shared-store ownership in temp-state exec and agent deletion (#130437) fix(openshell): preserve file writes during concurrent mirror commands (#130447) fix(workers): report full nodes as at capacity, not offline (#130445) ...
…-sent messages (openclaw#130427) * fix(webchat): render CLI harness-injected turns as collapsed context, not operator bubbles Claude Code writes harness-generated user-role turns (Skill instruction bodies, continuation summaries) into its native transcript with isMeta/isCompactSummary flags. The claude-cli history importer dropped that provenance, so webchat rendered those turns as right-aligned operator bubbles the operator never sent. Record the provenance at the import boundary as structured InputProvenance (internal_system / cli_harness_context) — the same contract the embedded runner uses to keep internal system prompts out of operator bubbles — and teach the system-notice path to render such turns as a collapsed "Injected context" notice that does not start an operator turn. Regression coverage: importer unit test (provenance recorded only for flagged rows), live chat.history gateway RPC test (provenance survives merge + display projection), and a chat-thread UI test (injected turn becomes a collapsed notice while a real operator message keeps its bubble). Before/after webchat captures via scripts/capture-injected-turn-notice-proof.mts. Co-Authored-By: Claude Fable 5 <[email protected]> * Publish openclaw/fix-cli-injected-turns-rendering-as-operator-messages OpenClaw-Publication: 62f03fec-179b-4c5e-9423-4df80809de41 * chore: drop changelog entry; CHANGELOG.md is release-generated Release-note context lives in the PR body per repo policy. Co-Authored-By: Claude Fable 5 <[email protected]> * chore: register injected-turn proof capture as ui:proof script Knip's full-tree unused-file scan requires capture scripts to be package.json entry points, matching the sibling ui:proof:* captures. Co-Authored-By: Claude Fable 5 <[email protected]> * fix(gateway): cover isVisibleInTranscriptOnly harness rows; absorb provenance helper Claude Code groups isMeta, isCompactSummary, and isVisibleInTranscriptOnly as its own "not a real operator turn" predicate (verified in the v2.1.246 bundle); import all three through one canonical predicate. Inline the one-use provenance literal at the importer, returning input-provenance.ts to its main state. Co-Authored-By: Claude Fable 5 <[email protected]> --------- Co-authored-by: Claude Fable 5 <[email protected]>
What Problem This Solves
Fixes an issue where webchat users of CLI-backed sessions (e.g.
claude-cli) would see harness-injected turns — Claude Code Skill instruction bodies ("Base directory for this skill: … # Auto Review …") and compaction continuation summaries — rendered as right-aligned operator bubbles, as if the operator had typed them. Reproduced on a real claude-cli session: every Skill invocation made the full skill body appear in the transcript as an operator-authored message.Why This Change Was Made
Claude Code already records which user-role rows in its native transcript are harness-written (
isMetafor skill injections,isCompactSummaryfor continuation summaries), but the claude-cli history importer discarded those flags, so downstream rendering had no way to distinguish them from real operator messages. This change records that provenance at the import boundary as the existing structuredInputProvenancecontract (internal_system/cli_harness_context) — the same mechanism the embedded runner uses to keep internal system prompts out of operator bubbles — and teaches the webchat system-notice path to render such turns as a collapsed "System · injected context" notice that does not start a new operator turn. No render-time text matching; classification comes only from the provenance the CLI recorded. Other surfaces (e.g. TUI) now receive the recorded provenance inchat.historypayloads and can adopt the same treatment as a follow-up.User Impact
Operators watching a CLI-backed session in webchat now see only their own messages as operator bubbles. Skill instruction bodies and continuation summaries appear as compact, collapsed "Injected context" system notices with a "Show content" disclosure, so the transcript reflects who actually authored each turn.
Evidence
Before (skill body rendered as an operator bubble) / after (collapsed system notice, operator bubble intact):
Captures come from a real browser (Playwright Chromium) against the served Control UI with the repo's mock-gateway harness, via the committed
scripts/capture-injected-turn-notice-proof.mts;--mode beforereplays the pre-fixchat.historypayload (no provenance),--mode afterthe fixed payload. Both captures were visually inspected.Regression coverage (each new test verified to fail on pre-fix code):
src/gateway/cli-session-history.test.ts— importer recordsinternal_system/cli_harness_contextprovenance only forisMeta/isCompactSummaryrows; the operator-authored row stays clean.src/gateway/server.chat.gateway-server-chat-b.test.ts— live gatewaychat.historyRPC proves the provenance survives import, merge with local history, and display projection.ui/src/pages/chat/chat-thread.test.ts— an injected turn becomes a collapsed notice without an operator-turn boundary while a real operator message still renders as a user group.Upstream transcript-contract evidence (Claude Code v2.1.246, the pinned build the repro transcripts came from; embedded bundle inspected directly):
isMeta: !0is written exactly at harness-injection sites — skill-content injection, preloaded-skill notices, skill re-invocation reminders, attachment/truncation notices, queued poll events — while the plain operator-prompt path builds the user message without it.isCompactSummary: !0is written only by the compaction-summary builder. Claude Code's own turn logic groupsisMeta || isVisibleInTranscriptOnly || isCompactSummaryas one "not a real operator turn" predicate and excludes those rows from its real-user-turn checks, so this PR consumes the flags with the same semantics upstream itself relies on; the importer now covers all three via one canonical predicate. Misclassification is fail-safe in both directions: a false positive renders collapsed-but-visible, a false negative reverts to the pre-fix operator bubble, and operator turns sent through OpenClaw are displayed from OpenClaw's own persisted row with the imported duplicate deduped.Validation run locally at this head:
pnpm test src/gateway/cli-session-history.test.ts src/gateway/server.chat.gateway-server-chat-b.test.ts ui/src/pages/chat/chat-thread.test.ts ui/src/e2e/chat-agent-run-transcript.e2e.test.ts(all green: 169 + 183 + 4 tests),pnpm check:changed(format/typecheck/lint/i18n lanes clean),pnpm ui:i18n:baseline, and Codex autoreview (gpt-5.5) exited clean with no actionable findings.Release-note context: user-facing
fixfor webchat transcript rendering of CLI-backed sessions; reported by @jalehman.