diff --git a/ROADMAP.md b/ROADMAP.md index 3d42471..161ced6 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -17251,3 +17251,15 @@ Gap. Auto-compaction lacks a pre-request guard based on `estimate_session_tokens Required fix shape: (a) add a preflight auto-compact phase before provider dispatch using estimated session/request size and model context metadata; (b) include the threshold, estimated session tokens, estimated request tokens, and context window in a typed `auto_compaction_preflight` event/status surface; (c) after `context_window_blocked`, optionally run a safe compact-and-retry once, with an explicit receipt; (d) persist the compacted session before retry so session continuity is recoverable even if the retry fails; (e) surface whether compaction was skipped because the session was below threshold, no messages were removable, or compaction would not fit; (f) add regression coverage where a resumed oversized session compacts before request and does not hit provider context-window rejection first. Acceptance: an oversized maintained session gets compacted or fails with a typed “not compactable” reason before provider context-window failure, never with silent “auto-compact did not run.” **Status:** Open. No source code changed. Filed 2026-04-26 18:39 KST. Branch: feat/jobdori-168c-emission-routing. HEAD: `79eeaae` before filing. Cluster delta: session-continuity-auto-compaction-semantics +1; concrete user-signal source: Sigrid report of frequent session breakage and auto-compaction not working. Concrete delta this cycle: ROADMAP-only pinpoint appended from auto-compaction trigger audit. + +## Pinpoint #288 — Context-window/session-break failures bypass the JSON envelope and omit session-file + auto-compaction decision receipts, so automation cannot tell which session to compact or why auto-compact did not run + +Dogfooded 2026-04-26 19:02 KST from the same session-maintenance / auto-compaction complaint cluster as #287. Static audit of `rust/crates/rusty-claude-cli/src/main.rs` shows `run_prompt_json` only prints a JSON envelope after `runtime.run_turn(...)` succeeds. On provider/context-window failure, `result?` returns a `RuntimeError` whose message is produced by `format_user_visible_api_error` / `format_context_window_blocked_error`. That text includes failure class, session id, optional trace/model/token estimates, and human recovery commands, but it is not emitted as a structured JSON error envelope and does not include the concrete session file path, auto-compaction threshold, preflight estimate, compaction skip reason, or whether a compact/retry was attempted. Text mode has the same limitation: the visible recovery line says `claw --resume {session_id} /compact`, not the resolved session path or a machine-readable recovery receipt. + +Concrete failure mode: a long session fails with `context_window_blocked` while a user or orchestrator is running `--output-format json`. Instead of `{ kind: "error", failure_class: "context_window_blocked", session_id, session_file, auto_compaction: { attempted, reason }, recovery: ... }`, the command exits with a formatted string. Automation cannot reliably distinguish provider context failure from other runtime errors, cannot know whether auto-compaction was skipped because it is reactive (#287) or because no messages were removable, and cannot safely run the exact recovery command against the right session file. The user-facing symptom is "session broke and auto-compact did not work" with no actionable structured receipt. + +Gap. Error paths do not share the success JSON envelope contract. Context-window recovery is human-readable only and loses the state needed for autonomous repair. This is distinct from #287, which fixes when compaction should run; #288 fixes how a failed oversized turn reports recovery state when compaction did not save it. + +Required fix shape: (a) make `--output-format json` emit structured error envelopes for `RuntimeError`/provider errors, preserving `kind`, `failure_class`, `message`, `session_id`, `session_file`, `model`, trace/request id, token estimates, and recovery commands; (b) include an `auto_compaction` decision object on failure with `attempted`, `phase`, `threshold`, `estimated_session_tokens`, `skip_reason`, and `retry_attempted`; (c) include the resolved managed session file path in text and JSON context-window recovery output; (d) add an orchestrator-safe `recommended_command` that uses the exact path/id; (e) regression-test `claw --output-format json prompt ...` with a synthetic context-window error to prove the output is parseable JSON and contains the recovery receipt. Acceptance: context-window/session-break failures are machine-readable and tell both humans and claws exactly what happened and what session artifact to repair. + +**Status:** Open. No source code changed. Filed 2026-04-26 19:03 KST. Branch: feat/jobdori-168c-emission-routing. HEAD: `9b06c98` before filing. Cluster delta: session-continuity-auto-compaction-semantics 1→2 (#287 trigger timing + #288 failure-envelope/recovery receipt). Concrete delta this cycle: ROADMAP-only pinpoint appended from JSON/error recovery audit.