Skip to content

Fix compressed and archived history segment recovery - #4

Merged
Fly-Carrot merged 3 commits into
mainfrom
codex/compressed-archived-segments
Oct 14, 2026
Merged

Fly-Carrot merged 3 commits into
mainfrom
codex/compressed-archived-segments

Conversation

@Fly-Carrot

@Fly-Carrot Fly-Carrot commented Oct 14, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Resolve registered logical segments after .jsonl becomes .jsonl.zst or moves into archived_sessions.
  • Revalidate exact main-chat identity through no-follow directory handles. Original transcripts remain read-only.
  • Bound compressed input/output, decoder window and forward indexing; preserve indexed-record proofs and reject changed, removed or shifted records.
  • Keep read-only detail errors from resetting completed scans; show a bounded-detail notice instead of a connection failure.
  • Incorporates the resume fallback and seven regression tests from Fix --resume when the current registered log is missing #3, extended for compressed/archive compatibility. Supersedes Fix --resume when the current registered log is missing #3.
  • Update changelog, installation guidance and a focused reference note covering upstream Codex, lnav and Perfetto.

Validation

  • Failing-first reproduction: two original tests failed in four compression/archive cases.
  • Additional review findings were reproduced with failing-first tests for changed/truncated/shifted representation and detail-state reset, then fixed.
  • Local Python 3.14: 196 tests passed, including installer, HTTP, UI, history and resume coverage.
  • Latest commit 9c53535: Ubuntu/macOS x Python 3.10/3.13/3.14 all six jobs passed (push and PR workflows).
  • Bounded read-only subagent review rechecked the final shifted-proof fix; no blocking finding remained in the reviewed scope.
  • Real-source header validation and isolated existing-index migration completed without unavailable-segment warnings. No private transcripts, credentials or local links included.
  • py_compile and git diff --check passed.

Resource boundary

No decoded transcript files are written. Compressed indexing uses bounded forward chunks and an 8 MiB decoder window. Input work also has a byte cap and cooperative deadline. Explicit details scan at most 16 MiB per reference and show a limit notice beyond that; summaries remain browsable. Python 3.10-3.13 needs optional backports.zstd; Python 3.14 uses its standard library.

Installed files and already-running observers are separate: activation requires restarting the observer and obtaining fresh private links; this PR does not change hooks or global rules.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-14T01:59:14.984190Z a840cda PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a840cda281

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +152 to +156
if old and old['identity'] != identity:
if compressed or old['identity'].startswith('zstd:'):
# Representation changes restart bounded indexing; refs retain
# logical paths and uncompressed byte offsets for lazy checks.
old = None

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject changed compressed contents before retaining stale events

When an existing .zst file is replaced or recompressed with different contents, its identity changes and this branch resets only the source progress row; it does not remove events previously contributed by that logical path. After reindexing, records removed from the replacement remain visible in events, while opening their details fails with Indexed source record changed. Either distinguish a plain/compressed representation transition from a changed compressed source or rebuild the affected cached events rather than merging the replacement into the old index.

Useful? React with 👍 / 👎.

Comment on lines +30 to +33
archive = Path(sessions).parent / 'archived_sessions' / path.name
if archive != path:
yield archive
yield Path(str(archive) + '.zst')

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Report timestamps from resolved segment paths

When the logical file has been compressed or moved into archived_sessions, these candidates allow indexing from the physical replacement, but _snapshot still computes source_updated by statting the absent logical paths at history.py:426. Consequently a chat whose segments exist only in either newly supported representation reports 1970-01-01T00:00:00+00:00 as its latest source update; retain or re-resolve the physical path when calculating that value.

Useful? React with 👍 / 👎.

@Fly-Carrot
Fly-Carrot merged commit ab6a725 into main Oct 14, 2026
12 checks passed
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