Skip to content

Standalone resume-fidelity fixes (claude reader, codex resume identity, thinking on import)#143

Draft
benbaarber wants to merge 1 commit into
mainfrom
ben/standalone-fixes
Draft

Standalone resume-fidelity fixes (claude reader, codex resume identity, thinking on import)#143
benbaarber wants to merge 1 commit into
mainfrom
ben/standalone-fixes

Conversation

@benbaarber

@benbaarber benbaarber commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Split out of #108 — three fixes with no dependency on the compaction work, found while verifying projected resumes against the real harness TUIs.

  • claude reader: stream-parse each JSONL line so a mid-write flush boundary (two objects concatenated on one physical line) no longer drops entries. Regression test included.
  • codex resume identity: path resume mints a deterministic fresh session id (reusing the source id created ambiguous duplicate rollouts and clobbered the native session's threads row via INSERT OR REPLACE), and the registered thread title skips system-envelope messages instead of using the <environment_context> XML. Verified against codex 0.144.4.
  • thinking on import: path p import claude / path share derive with thinking included — dropping it degrades resume and leaves empty-thinking turns contentless.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Three fixes independent of the compaction work, split out of #108:

- toolpath-claude reader: a mid-write flush boundary can concatenate
  two JSON objects on one physical line; whole-line parsing dropped
  both (observed on a live import — a turn_duration + ai-title pair).
  read_conversation and read_from_offset now stream-parse each line,
  keeping every complete value.
- path resume (codex): mint a deterministic fresh session id instead
  of reusing the source id — reuse produced two rollouts sharing one
  id, making `path p import codex --session` ambiguous, letting the
  thread-row INSERT OR REPLACE clobber the native session, and
  confusing `codex resume <id>` about which file to load. The
  registered thread title now comes from the first non-envelope user
  message instead of the `<environment_context>` XML (verified against
  codex 0.144.4's threads table).
- path p import claude / path share: derive with thinking included.
  Dropping it degrades resume (the harness re-reads thinking) and
  leaves empty-thinking assistant turns with no content to project.
@github-actions

Copy link
Copy Markdown

🔍 Preview deployed: https://bc0fbb76.toolpath.pages.dev

ben-emp pushed a commit that referenced this pull request Jul 23, 2026
…1.2.0)

Restacked onto ben/items-ir (#144) with the standalone fixes split to
#143; the pre-restack 43-commit history is preserved at
ben/compaction-pre-split.

The Compaction item + the conversation.compact step type (kind
v1.2.0): a context-compaction boundary recorded as its own step
between the turns it separates, with trigger, summary, pre_tokens, and
the anchor-based kept contract (kept_from + expand_kept; the wire
carries the expanded contiguous run). Compaction provenance is a
closed typed set — no catch-all extra; native detail richer than the
typed fields is deliberate loss.

Per-provider support, each verified against the real harness TUI by
resuming projected sessions (versions in docs/agents/tui-drift-check.md):

- claude: compact_boundary + synthetic summary → typed boundary and
  back, preservedMessages as the kept run, transcript-only + isMeta
  render flags, empty-turn thinking-block projection.
- codex: compacted marker → wholesale boundary (2026-07 payload:
  encrypted summary + prefix-keep documented as deliberate loss);
  projector emits the event_msg/context_compacted marker the TUI
  renders, with native turn_context placement.
- opencode: per-boundary summary pairing, compaction-host parent
  redirects, tailStartID → kept anchor.
- pi: compaction entries with parent-chain kept expansion;
  model_change/thinking_level_change/label as typed events with the
  chain's model context threaded into projected assistant messages.
- copilot: the observed 1.0.68 session.compaction_start/complete pair
  mapped both directions (wholesale + summary).
- gemini/cursor: documented no-boundary.

Verification: executable round-trip oracle
(testing::{check_view_invariants, assert_fixpoint}), compaction
proptests, real captured compacted sessions for claude/codex/pi/
copilot/opencode as fixtures with looped stability tests, the
cross-harness compaction matrix (kept-anchor capability flags), the
env-gated real-session matrix mode, and import-time event-type
surfacing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant