Skip to content

Fix --resume when the current registered log is missing - #3

Closed
Fly-Carrot wants to merge 1 commit into
mainfrom
fix/resume-surviving-segment
Closed

Fly-Carrot wants to merge 1 commit into
mainfrom
fix/resume-surviving-segment

Conversation

@Fly-Carrot

Copy link
Copy Markdown
Owner

When a chat has multiple registered log segments and the current entry['log'] has been deleted, --resume raises FileNotFoundError before starting the listener, even though the history reader can still read an older registered segment. This addresses the P2 finding in PR #2.

Resume now prefers the valid current source, then checks only deduplicated paths already recorded in logs. Each candidate must remain canonical and pass the existing resolve_session() containment, regular-file, exact-thread and main-user-conversation checks. A path retargeted during validation is rejected. The selected source still goes through the existing launch, service identity and connection verification flow; if no candidate is valid, resume fails before launch.

Registration and history formats, cache handling, credentials and browser behavior are unchanged. Missing segments remain recorded so the history reader can report incomplete coverage.

Validation

  • Reproduced the original failure with a real two-segment registry: history reads the surviving event, while unpatched resume fails on the deleted latest file.
  • Added 7 tests covering current-source preference, fallback revalidation, unregistered-source exclusion, malformed registries, path retargeting and recovery after a real service exit.
  • Fallback tests cover 15 invalid source cases, including wrong thread, subagent/exec logs, bad headers/encoding, outside-root paths, leaf/parent symlinks, FIFO and directory sources.
  • Real service recovery returns a freshly verified link, reads surviving history, preserves the missing-segment warning and leaves source logs unchanged.
  • python -B -m unittest discover -s tests -v: 178 tests passed locally on Linux, Python 3.12.14 and Node 24.19.0.
  • git diff --check: passed.

@Fly-Carrot

Copy link
Copy Markdown
Owner Author

Superseded by merged PR #4 (ab6a725). That PR incorporates this resume fallback and all seven regression tests, plus compressed/archive support and additional safety verification. Closing this draft to avoid a duplicate/conflicting merge.

@Fly-Carrot Fly-Carrot closed this Oct 14, 2026
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