[skip-tag:sdk] feat(sdk/engine): optional Resumer + LoadAndResume helper (3/4)#76
Merged
Conversation
- Resumer optional interface with CanResume(Checkpoint) error — engines opt in to early validation of resumed checkpoints. - IsResumable / AsResumer helpers for capability detection. - ResumeContext value-type carrying per-attempt metadata (ExecID, AttemptID, StartedAt, Reason). WithResumeContext / ResumeContextFromContext follow the standard context-key idiom. - LoadAndResume orchestrates the host-side resume flow: load checkpoint, invoke CanResume, hydrate Board, dispatch into Engine.Run with the resume context attached. AllowFreshStart / OnMissing options control behavior when no checkpoint exists. The core engine.Engine and engine.Run contracts are unchanged; this is purely additive. Co-authored-by: Cursor <cursoragent@cursor.com>
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Part 3 of 4 in the v0.2.x additive SDK batch. Tagging suppressed via
[skip-tag:sdk]; cumulativesdk/v0.2.9tag will be cut on PR 4/4.Adds a host-side helper to drive durable resume against any engine, and an
optional capability interface engines can implement to participate.
Surface
Resumeroptional interface —CanResume(Checkpoint) error. Engines thatimplement it get a chance to reject incompatible checkpoints (schema drift,
expired runs, mismatched topology) before the resume is dispatched.
IsResumable(Engine) bool/AsResumer(Engine) (Resumer, bool)— capabilityprobes for callers that need to branch.
ResumeContext(value-type) — per-attempt metadata:ExecID,AttemptID,StartedAt,Reason. Plumbed viaWithResumeContext/ResumeContextFromContextusing the standard context-key idiom.LoadAndResume(ctx, eng, host, store, run, board, opts...)— orchestratesthe canonical host-side flow:
CheckpointStore.Resumer.CanResumewhen the engine opts in.Boardfrom checkpoint state.Engine.RunwithResumeContextattached.AllowFreshStart(bool)/OnMissing(handler)options control behaviourwhen no checkpoint is found.
Out of scope (deliberately)
Resumerstill work — they simply get fresh-start semantics.sdk/engine/doc.goadds a worked example of the resume flow.Test plan
go vet ./engine/...go test ./engine/... -count=1sdk/engine/resume_test.gocovers:AllowFreshStart=true.ResumeContext.ExecIDmismatch is rejected.Resumer.CanResumerejection short-circuits before dispatch.Release notes
Additive only; tag deferred to PR 4/4.
Made with Cursor