feat: add durable generic agent checkpoints - #1449
Conversation
Automated code reviewReviewed 48 file(s) in the diff against
|
c9236fa to
e046ba3
Compare
e046ba3 to
1ae561d
Compare
4d2fd9c to
6b1d813
Compare
The new agent-checkpoint error codes have to appear in the TryCatchFinally catchErrors union. Note that `pnpm check:dts` silently no-ops here; this was regenerated with `pnpm -C packages/components build`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Address PostgreSQL migration and checkpoint publication races, make rewind and fork provenance exact and bounded, preserve reset resume semantics, regenerate declarations and docs, and add cross-dialect regression coverage.
5a9c5ba to
f0c287d
Compare
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Resolve the Effect 4 integration conflicts while preserving checkpoint durability changes and current generated docs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Preserve the v0.32.0 docs snapshot, document the occupied 0034 migration slot, and link the real-PostgreSQL E2E skip to its tracking issue. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The clean declaration build exposed that the aggregate internal schema omitted the four cancellation-attribution columns added on main. Keep it aligned with smithersRuns and regenerate the published declarations. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…low-make # Conflicts: # apps/observability/src/metrics/index.d.ts
…oints # Conflicts: # apps/observability/src/metrics/index.d.ts # apps/observability/src/metrics/openApiToolDuration.js # apps/observability/src/resolveSmithersObservabilityOptions.js
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Resolve the stacked branch against the squash-merged Effect 4 base while preserving the contributor commits. Co-Authored-By: Codex Sol <noreply@openai.com>
Use the run VCS baseline when an exact snapshot predates the first attempt, preserving sandbox restore and effect-boundary handling. Co-Authored-By: Codex Sol <noreply@openai.com>
Co-Authored-By: Codex Sol <noreply@openai.com>
Co-Authored-By: Codex Sol <noreply@openai.com>
Co-Authored-By: Codex Sol <noreply@openai.com>
Co-Authored-By: Codex Sol <noreply@openai.com>
Co-Authored-By: Codex Sol <noreply@openai.com>
Co-Authored-By: Codex Sol <noreply@openai.com>
Summary
Adds a generic, durable checkpoint contract for stateful Smithers agents.
Checkpoint-aware agents can publish opaque JSON state during or after generation, resume it on retries and process restarts, and carry exact checkpoint lineage through snapshots, rewind, replay, and historical forks.
This is backend-agnostic infrastructure. Existing agents remain unchanged unless they opt in. It also provides the durable foundation needed by future stateful adapters such as Nanocodex.
Why
Smithers persisted provider-native CLI session IDs, but had no generic mechanism for agents that expose richer resumable state or snapshots. That prevented stateful library-backed agents from preserving high-fidelity execution state across retries, schema correction, engine crashes, process restarts, rewind, reset, and historical forks.
Agent contract
Introduces:
AgentCheckpoint,AgentCheckpointMode,AgentCheckpointFormat, andAgentCheckpointCapabilitycheckpointFormatsfor states an agent may producecheckpointCapabilitiesfor codec/version/mode combinations an agent may consumeresumeCheckpointandcheckpointModecontinuation inputsonCheckpoint(...)publication as a durability fenceCheckpoint envelopes use strict JSON:
Generic checkpoints and provider-native session continuation remain mutually exclusive.
Persistence and engine behavior
Migration
0035_agent_checkpointsadds:The engine supports checkpoints across task retries, schema-correction turns, failed attempts, progress publication, process restart, task forks, cache identity, and same-task workspace restoration. The maximum checkpoint size is 16 MiB. History scans fail explicitly at their safety bound instead of silently starting fresh.
Time travel
Snapshots preserve the exact attempt rows and checkpoint bytes visible to each frame. Rewind and fork can therefore:
Legacy snapshots retain their timestamp fallback.
Live validation finding
A live Codex workflow exposed an existing fast path that rewrote completed nodes with
lastAttempt: null, causing later snapshots to lose checkpoint lineage. This PR preserves or reconstructs the durable attempt number and adds a regression proving completed-run resume and latest-frame fork retain checkpoint references.Compatibility
0035is additive.Testing
Focused local validation:
Live
gpt-5.3-codex-sparkvalidation covered:PostgreSQL CI gates
Real-PostgreSQL-only tests are wired into CI for migration repair, concurrent sequence allocation, writer/GC overlap, publication versus owner takeover/cancellation, and fresh-process SIGKILL/resume. They require
SMITHERS_TEST_PG_URLand therefore run in the GitHub PostgreSQL job rather than the local fallback suite.Follow-up
A subsequent PR can add
NanocodexAgenton top of this contract without coupling Nanocodex-specific state or execution semantics into Smithers core.Stack and merge order
This is layer 2 of 3. It is based on and requires #1463 at
92ca474344a194c188e8a6981ec5e51d907e341e; this PR's verified head isf0c287dfb5c0f37f4657d25148c8ef5bc4cb6f30.Merge order: #1463 → #1449 → #1461. Because these are cross-repository PRs, the GitHub base intentionally remains
main, so the displayed diff is cumulative until #1463 lands.