Conversation
Schema v6 with a v5 backfill: tasks, attempts, user_actions and feedback_events. Guarded attempt transitions, where the Store chooses the terminal state from the first reason, D's result and context currency. State version and context generation counters, cancel task, merge closure, replayable user actions (including refusals) and feedback events. Implements the Store slice of docs/implementation/runner-lifecycle.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mchwang
force-pushed
the
feat/f1-store-lifecycle
branch
from
September 26, 2026 08:21
3ce52eb to
4c83e78
Compare
mchwang
changed the base branch from
docs/f1-runner-lifecycle-contract
to
main
September 26, 2026 08:21
This was referenced Sep 26, 2026
This was referenced Sep 26, 2026
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.
Lane F, step F1, slice F1a: the Store. The F1 contract (#49) is merged; this PR now targets
main. Related: #22, #51.What this does
Adds the durable half of the F1 runner lifecycle contract (
docs/implementation/runner-lifecycle.md). There is no coordinator, HTTP or shutdown wiring yet; those are later slices.tasks,attempts,user_actionsandfeedback_events. Every v5 plan gets one task row with the documented defaults. A merged plan becomesmergedand gets itstask-closedevent. A null budget means "not started", never expired.recordFirstReasonis the same-state "Stopping" transition, andmarkRunningis refused once a stop reason is recorded.settleAttempttakes D's result and the in-memory first reason, and applies the precedence inrunner/lifecycle.ts(classifySettlement), so the precedence lives in one place:stale;#savePlan,#snapshot,setAssignment). Lifecycle changes increase only the state version.cancelTaskcloses at once, or, with an active attempt, stops it first and closes when it settles. A pending cancel beats the time limit.finishMergeAttempt(merged)now closes the task and writestask-closedin the same transaction.userActiongives exact replay for a UUID-v4 action ID: the same request returns the saved response without re-applying it. A different request with the same ID is refused. Guard refusals are recorded and replayed; storage errors are not.recordFeedbackworks only inside a user action, and supersedes by source.feedbackEventsis lane J's read path and is available once the task closes.#transactionnow joins an outer transaction, so a user action can wrap existing Store methods atomically.Contract change found while implementing
The
running → failedguard in the contract said "no first reason". That contradicted the round-19 rule that a D stop before shutdown endsfailed. I fixed the row on #49 (e44d04a).Validation (head
4c83e78, rebased ontomainafter #49 merged)npm run typecheck: passes.npm testminus the Docker suites): 470 passed, 0 failed. 26 of those tests are new, intest/runner-lifecycle-store.test.ts. The 26th test, from contract round 35, checks that a result never completes into a task that isn'trunning, and fails without the guard.markRunningignoring the first reason;npm run test:browser: 47 passed in a full run.main: threereview.spec.tstests are timing-sensitive ("preserves edits made while a question submission is in flight" ×2, and "drains an in-flight question request…"). Run alone three times each, they failed 2 of 12 with this change and 3 of 12 without it. So this PR doesn't cause them; I'm flagging them separately.agent-*) weren't run locally; this PR doesn't touchagents/.Not in this slice
F1b (coordinator), F1c (shutdown wiring and
/api/runner), F1d (startup recovery and the OS lock), F1e (planning endpoints and wiring feedback into review actions). The F1 implementation must not merge as a whole until #51's pre-F1 D items land.🤖 Generated with Claude Code