docs(claudecode): define wrapper history filtering #275
All Vouch review confidence checks passed
Residual risk 0.22 = Change Risk (0.50) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.50 · 447 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.365
Shallow Review Depth
shallow_review_depth
0.289
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #275"
general
weight: 0.35
aramase
Summary
EXE-43EXE-44EXE-7andEXE-17Problem
controller.ExeccommitsEXECUTION_STARTand the turn inputs before invokingHarness.Run. A host-side wrapper may then fail a pre-step before it invokes the underlying Claude Code harness. The outer journal correctly retains that failed execution, so the wrapper receives it in the next turn'sStart.History.A fresh Claude Code harness treats every prior
EXECUTION_STARTorINPUTas evidence that Claude Code may already have run. It therefore refuses the next turn witherrStateLostrather than start an empty conversation. Without a wrapper contract, one known-undelivered pre-step failure can make every later turn fail even though Claude Code never saw the first turn.Contract
This PR distinguishes three responsibilities:
1. Host to wrapper (
EXE-7,EXE-17): unchanged. The durable journal retains the failed execution, and the host sends the wrapper every event before the current execution. Failed and unfinished executions remain visible.2. Underlying harness (
EXE-43): caller-independent. An unmediated harness with no state for a session whose history records an earlier execution fails as possible state loss rather than starting an empty conversation.3. Wrapper to underlying harness (
EXE-44): when the wrapper positively knows it never delegated an execution, it omits that execution in full from the derived history it later sends to Claude Code.The positive-knowledge requirement is deliberate. An execution with no Claude Code-emitted events does not prove non-delivery: Claude Code may have changed memory, called its provider, or performed a side effect before emitting its first observable event. If delegation or delivery is uncertain, the wrapper retains the execution and the underlying harness continues to fail closed under
EXE-42/EXE-43.Non-goals
controller.Exec, the durable journal, or the publicStart.HistorycontracthasPriorTurnOUTPUT,USAGE, orTOOL_RESULTConnectfailure; that case lacks positive non-delivery evidence and is tracked in #276Files
spec.md: states the caller-independent harness refusal underEXE-43and adds wrapper delegation asEXE-44integrations/claudecode/claudecode.go: documents that everyEXECUTION_STARTorINPUTis prior-turn evidence, plus the wrapper responsibilitychangelog/unreleased/claudecode-harness.md: updates the existing unreleased feature entry and citesEXE-44Part of #272.
Related: #276.
Verification
go test -race -shuffle=on ./...inintegrations/claudecodego vet ./...inintegrations/claudecodego build ./...inintegrations/claudecodego test ./... -run '^$'go run ./hack/doccheckgo test ./hack/changeloggo run ./hack/changelog check -base upstream-agentsession/main -head HEAD -skip=falsepython3 hack/check-doc-links.py: 656 links across 73 Markdown filesnpm run build && node hack/check-links.mjsinsite: 19 pages and 18 routesgit diff --checkgofmt -l integrations/claudecode/claudecode.go