Skip to content

Harden session cwd resume precedence#202

Draft
nestharus wants to merge 12 commits into
mainfrom
feat/session-cwd-resolution
Draft

Harden session cwd resume precedence#202
nestharus wants to merge 12 commits into
mainfrom
feat/session-cwd-resolution

Conversation

@nestharus

Copy link
Copy Markdown
Owner

Summary

  • Preserve live external-provider runtime cwd as authoritative on resume.
  • Keep invocation-recorded cwd as the durable fallback for script/import resume cases with stale mailbox/runtime cwd.
  • Add characterization coverage for live runtime cwd beating recorded script-session cwd.

Verification

  • cargo fmt --check
  • git diff --check
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo test -p oulipoly-runtime session_metadata -- --nocapture
  • cargo test -p oulipoly-runtime --test session_metadata_resume_cwd_characterization -- --nocapture
  • cargo test -p oulipoly-state provider_session_binding -- --nocapture
  • cargo test -p oulipoly-runtime creates_unknown_model_invocation_row -- --nocapture
  • cargo test -p oulipoly-runtime passes_parent_invocation_env_to_launcher -- --nocapture
  • cargo test -p oulipoly-runtime registers_ingested_session_chain -- --nocapture
  • Provider token delta guard: claude delta=-4, codex delta=0

Known Existing Reds

  • cargo test --workspace fails on documented pre-existing AGE-245 source guard: s7c_provider_name_grep_invariant_uses_authoritative_manager_baseline.
  • bunx tsc --noEmit fails on existing frontend JSX/type baseline issues.

nestharus and others added 12 commits June 26, 2026 16:18
Interactive --resume built its target from the model-effective provider,
injecting -m/--variant launch args; opencode rejects --variant and exits 1.
Use the runtime provider resume argv (session already carries model/variant).
Verified against real ses_1012 (enters TUI vs exit-1). Token-clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K7cQsdbQh7wM1dRRjyjYn5
…merge

When multiple segments of one chain collapse to one post-alias tuple, select
survivor/start/tail independently: the open segment wins survivor selection,
earliest started_at and latest tail are preserved, and merged_ended_at stays
open if any merged row is open. forward.sql gains a fail-closed guard against
plans that would close an open merge group. Synthetic-fixture tests only.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K7cQsdbQh7wM1dRRjyjYn5
main had accumulated rustfmt drift across ~24 files; every pipeline worktree
regenerated these on 'cargo fmt', polluting WU diffs and causing repeated
'rogue edits' confusion. Pure formatting, no behavior change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K7cQsdbQh7wM1dRRjyjYn5
Live pty_interactive owners that NACK immediate notify-time PTY delivery
(e.g. unsafe_mid_line) left a durable pending mailbox row with no wake claim,
and sweep filtered busy sessions out before any retry -> the owner showed a
pending count but was never notified (affects opencode + claude interactive
sessions). Add a sweep pre-pass that retries pending rows via the PTY control
socket for live pty_interactive owners, marking delivered only after a PTY ACK;
no headless wake claim for busy owners; repeated NACK stays safely pending.
Sidecar-only pending lookup; no schema change; no provider-specific tokens.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K7cQsdbQh7wM1dRRjyjYn5
Recovered from the trunk WIP stash; B2 reviewed as KEEP (general in-core cwd
resolution, token-clean, applies on main). Pipeline will harden + test this.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K7cQsdbQh7wM1dRRjyjYn5
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