Skip to content

AI capture: durable checkpoints, persisted pause, optional AI packages - #442

Merged
guan4tou2 merged 2 commits into
codex/recording-export-workflowfrom
integrate/ai-durability
Oct 24, 2026
Merged

guan4tou2 merged 2 commits into
codex/recording-export-workflowfrom
integrate/ai-durability

Conversation

@guan4tou2

Copy link
Copy Markdown
Owner

Targets codex/recording-export-workflow (#437), not main. This PR reaches main only through #437.

What this is

A Codex session was rewriting tailer-host.ts and stopped with its work uncommitted in the shared checkout, built on 52b80c80. Meanwhile #441 landed on this branch and changed the same functions. This PR takes over that work and reconciles the two.

7f3ea39c: the stopped session's work, unchanged, plus the merge with #441

Design notes: specs/062-recording-workflow-consolidation/ai-durability-and-session-boundaries.md.

9932a31a: four gaps in the checkpoint design

Each was found by a #441 test or a probe, and each fix makes at least one test fail when reverted.

  • A waiting child whose flush failed was lost for good, even across a restart. Children now leave the queue only once they are written, and a re-read parent flushes whatever is still waiting on it.
  • Failed passes double-counted. On each failed pass, a re-read child was queued again and a re-read tool call was counted again.
  • A failure with no later file event waited for a restart. This is the last turn of a session. It is now retried with backoff from 1 s to 16 s, 5 times. After that it waits for the next file event or a restart, and the error stays in capture health.
  • A sidecar removed by retention stopped capture for that session. The checkpoint treated it as tampering. A missing sidecar now resumes at the checkpoint; a sidecar that is present but shorter than the checkpoint is still refused.

Behaviour dropped relative to #441

  • No give-up. A failed unit is never abandoned with a capture_gap. It stays retryable, so nothing is skipped, but a unit that can never be written also blocks everything after it.
  • Pre-pause failures are discarded. If a unit fails before a pause and has not been retried before the pause starts, it is discarded at resume.

Verification (local, macOS)

  • Gates: typecheck, verify:specs, verify:architecture and verify:i18n all pass.
  • Unit tests: 4151 pass. The 15 failing files are the known local shell/PTY environment set, which is 16 on the baseline.
  • Durability suites (tailer-durability, tailer-jsonl-durability, tailer-pause-sidecar): 40/40 pass.
  • Full e2e: 146 pass. The 3 failures (command-io, managed-http-capture, terminal-session-rotation) are the same 3 that fail locally on main.
  • Not run: verify:package-resources, and no packaged or native acceptance. This PR changes electron-builder.yml and the package verifier, and that check runs only on tag builds.

🤖 Generated with Claude Code

guan4tou2 and others added 2 commits October 24, 2026 19:31
…ackages

Work from a stopped Codex session's working tree, built on 52b80c8 and
carried onto the branch as it was left. See
specs/062-recording-workflow-consolidation/ai-durability-and-session-boundaries.md.

- Progress is a checkpoint beside each sidecar: source offset and saved
  bytes, written atomically after a unit is processed and appended. A
  failed write leaves the unit at the source, across a restart too.
- Pause keeps no source bytes; the boundary is persisted, so a restart
  during a pause does not replay it. Sessions found after resume are
  bounded by it.
- Per-session stop and reallow from the existing source rows.
- The three AI adapters move to optional-plugins/ and are installed as
  managed packages, with tamper refusal and rollback.

Merging it with #441 (already on this branch): tailer-host.ts takes this
version, which supersedes #441's in-memory queue and filler newlines.
bundle-export.ts goes back to before #441, since no pause-tail marker or
filler exists any more. The #441 tests move to the new adapter path; the
mock-based per-message suite and two tests of behaviour this design drops
(give up after the retries; retry a pre-pause failure after a pause) go.
Seven of the remaining #441 tests fail here; the next commit fixes them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…runing

Four gaps in the checkpoint design, each found by a #441 test or a probe
against it:

- A waiting child whose flush failed was lost for good. Its parent was
  recorded, so the re-read skipped it, and the child's own line was
  already committed. Children now leave the queue only once written, and
  a re-read parent flushes whatever still waits on it.
- A re-read child was queued again on every failed pass, and a re-read
  tool call was counted again.
- A failure with no later file event (the last turn of a session) waited
  for a restart. A few backed-off passes (1 s to 16 s) now retry it; after
  those it waits for the next event or restart, the error in capture
  health.
- Retention removes whole sidecars, and the checkpoint then refused the
  session as tampered, stopping its capture with only a DB error. A
  missing sidecar now resumes at the checkpoint; one that is present but
  short is still refused.

Each fix is caught by at least one test when reverted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 24, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7b98f5e6-8c48-432e-b7c9-561143f97aa3

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@guan4tou2
guan4tou2 merged commit 3e84483 into codex/recording-export-workflow Oct 24, 2026
8 checks passed
@guan4tou2
guan4tou2 deleted the integrate/ai-durability branch October 24, 2026 11:57
guan4tou2 added a commit that referenced this pull request Oct 24, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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