Skip to content

Reduce backlog replay cost and preserve capture during upgrades - #307

Merged
Stephen Belanger (Qard) merged 8 commits into
mainfrom
investigate/sdk-897
Nov 23, 2026
Merged

Stephen Belanger (Qard) merged 8 commits into
mainfrom
investigate/sdk-897

Conversation

@Qard

@Qard Stephen Belanger (Qard) commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Large Claude tracing backlogs can repeatedly serialize conversation history, consume a CPU core, and block hooks during daemon upgrades. Replay now checkpoints batches of up to 16 events, keeping inputs durable until their spans and matching state commit atomically. Status and shutdown respond during recovery.

Hooks capture with the running daemon before requesting an upgrade. They wait for durable acceptance without a capture timeout or handover retry cutoff. Only the maintenance request after successful capture has a bounded wait.

Addresses SDK-897.

Validated optimized replay of 1,600 synthetic turns in 10.4 seconds. The same workload previously took 55.9 seconds. Fault injection verifies failed batches retain all input and restart without duplicate output; the recovery-gate test verifies hook data is stored before handover while recovery is blocked. Translator, server, doctor tests, formatting, and strict all-target Clippy passed. The daemon keeps its listener available during draining so late hooks can retry through handover. Validation includes all 51 pipeline tests, replay/root-provenance tests, server tests, and strict all-target Clippy. Real desktop verification remains outstanding.

@Qard Stephen Belanger (Qard) changed the title Add tracing daemon replay diagnostics Keep tracing controls responsive during backlog recovery Nov 20, 2026
@Qard Stephen Belanger (Qard) changed the title Keep tracing controls responsive during backlog recovery Reduce backlog replay cost and preserve capture during upgrades Nov 20, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-20T18:57:42.506436Z 8aad690 Draft marked ready
ℹ️ About Codex in GitHub

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

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: 8aad690648

ℹ️ 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 (@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 (@codex) address that feedback".

complete: true,
continuation: None,
});
self.publish().await?;

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 Preserve the fetched control when a batch flush fails

When replaying a persisted backlog, next_input() has already advanced the journal reader past the control before this flush runs. If publish() encounters a transient storage failure, recovery retries the saved publication for the preceding batch and then calls advance() without resetting the reader or retaining entry. The control is consequently skipped, and a later commit can delete it without applying it. In particular, skipping a Reset makes subsequent events use stale translator state. Retain the fetched control across the failed flush, or rewind the reader to the successfully committed prefix before resuming.

Useful? React with 👍 / 👎.

@Qard
Stephen Belanger (Qard) merged commit f91a0d8 into main Nov 23, 2026
29 checks passed
@Qard
Stephen Belanger (Qard) deleted the investigate/sdk-897 branch November 23, 2026 15:18
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.

2 participants