Skip to content

fix(server): capture complete turn checkpoints after edits finish - #220

Merged
leoisadev1 merged 5 commits into
mainfrom
leoisadev1/t3-port-checkpoint-safety
Sep 13, 2026
Merged

leoisadev1 merged 5 commits into
mainfrom
leoisadev1/t3-port-checkpoint-safety

Conversation

@leoisadev1

Copy link
Copy Markdown
Member

Problem

Turn checkpoints could freeze too early, skip nested Git workspaces, and lose summaries on large diffs.

Provider runtimes can publish a diff update before they finish writing files. The reactor treated that placeholder as the final checkpoint, then skipped the real completion capture. Later edits landed on the next turn. Projects opened in a subdirectory of a Git repo were skipped because the reactor looked for .git only in the project directory. Automatic summaries parsed full unified patches, so changes over the 10 MB output cap produced incomplete counts. A git init during a turn left no baseline and could stop later captures. Git status refresh ran on the same worker before capture, so a slow refresh could let a follow-up edit into the snapshot.

Changes

Capture the workspace only when a turn completes or an eligible abort arrives. Reuse any placeholder turn count and assistant message id. Ignore aborts that never started and were not the active session. Detect repositories through CheckpointStore.isGitRepository so nested workspaces checkpoint and revert. Build automatic summaries from NUL-delimited Git numstat; on-demand diffs stay as patches. Skip the summary when no pre-turn baseline exists, keep the completion checkpoint, and resume after git init. Run local git status refresh on its own drainable worker so capture does not wait behind it.

SQL, in-memory, and client projections keep an interrupted turn interrupted when the real checkpoint becomes ready. A missing git ref is not treated as an interruption.

Akeru still uses AgentController rather than ProviderService. Chat copy, imported-history filtering, and the absence of hosted pull-request refresh stay as they were. Group/channel/bot fields are unchanged.

Upstream

Reviewed adaptations of pingdotgg/t3code:

  • #9694 numstat summaries
  • #9842 nested Git detection
  • #9841 capture after all edits
  • #10078 resume after git init
  • #10347 capture before status refresh

Scope

This PR is checkpoint correctness only.

Still assigned, separate PRs:

Verification

  • vp test run of CheckpointReactor, CheckpointStore, Diffs, VcsProcess, ProviderRuntimeIngestion, ProjectionPipeline, projector, and client-runtime threadReducer: 218 tests passed. New cases wait on typed receipts and worker drains.
  • Targeted lint, format, and vp run --filter akeru-bot --filter @t3tools/client-runtime typecheck passed (existing Effect suggestions only).
  • No UI layout or client-visible chrome change. Proof is filesystem-backed reactor tests plus projection/reducer regressions.

Limitations

Stop followed immediately by another message can still skip the interrupted snapshot if a newer active turn is already present. That ordering boundary is unchanged. Attachment cleanup and session reaper work are not in this PR.

Implemented and verified by Grok 4.6 High in Grok Build via Orca.

Mid-turn provider diffs were treated as the final checkpoint, nested Git
workspaces were skipped, and huge patches truncated automatic summaries.
Capture now waits for turn completion or an eligible abort, detects
repositories through CheckpointStore, and builds summaries from
NUL-delimited numstat. Git init during a turn no longer blocks later
captures, and status refresh no longer runs ahead of the snapshot.

Adapted from pingdotgg/t3code pingdotgg#9694 pingdotgg#9842 pingdotgg#9841 pingdotgg#10078 pingdotgg#10347.
@vercel

vercel Bot commented Sep 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
akeru-bot-landing Building Building Preview Sep 10, 2026 5:46pm UTC

Request Review

@greptile-apps

greptile-apps Bot commented Sep 10, 2026 •

Copy link
Copy Markdown

Greptile Summary

This PR updates checkpoint handling to capture the final filesystem state for completed and eligible interrupted turns, supports nested Git workspaces and repositories initialized during a turn, and produces path-safe file summaries. It also separates Git-status refresh work from checkpoint capture, preserves interrupted state through projections, and removes an unused patch-parsing dependency.

Confidence Score: 5/5

Safe to merge.

No outstanding findings remain.

Files Needing Attention: None.

Reviews (5): Last reviewed commit: "merge main into checkpoint safety" | Re-trigger Greptile

Comment thread apps/server/src/orchestration/Layers/CheckpointReactor.ts
Automatic numstat compared full parent-repository trees, so a sibling
commit between nested-workspace captures showed up in the turn file list.
Restrict numstat diffs to the session cwd. On-demand patches stay whole-tree.
@leoisadev1

Copy link
Copy Markdown
Member Author

This is Leo's agent.

Current GitHub state is CONFLICTING/DIRTY for 5e89969. A read-only git merge-tree against current main narrows the textual conflict to imports in apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.ts.

Preserve both sides: main's activity/message/proposed-plan repository imports and isGitRepository, plus this PR's CheckpointStore import. The rest auto-merges, but an automatic textual merge is not behavioral acceptance. Re-run focused checkpoint/reactor/ingestion/projection/client reducer tests on the resulting head and the Greptile review/fix loop. Existing integrated/native verification holds remain; this conflict resolution alone does not satisfy them.

No branch or worktree files were modified. Orca delivery remains blocked by the missing selected executable, so this comment is a repair specification, not confirmed worker delivery or execution.

@leoisadev1
leoisadev1 merged commit 59f5773 into main Sep 13, 2026
11 checks passed
This was referenced Sep 13, 2026

This branch was successfully deployed

1 active deployment
Preview — 366f7271 Deployed Sep 13, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant