GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||
GeezerVison is showing github.com — fix(core): recover sessions and jobs from transient storage failures by kitlangton · Pull Request #53704 · anomalyco/opencode Conversation
Contributor
WhyWhen the host disk filled for ~90 seconds during active work, SQLite WAL buffered transaction pages until What Changes
sequenceDiagram
participant Runner as SessionRunner / Job
participant Exec as SessionExecution / SubagentJob
participant Bus as Bus / KV
participant DB as SQLite (WAL)
rect rgb(60, 35, 35)
Note over Runner,DB: Before: 90 s full disk
Runner->>Bus: publish(StepEvent)
Bus->>DB: COMMIT
DB-->>Bus: SQLITE_FULL (rollback)
Bus-->>Exec: Defect (SQLITE_FULL)
Exec->>Bus: publish(Execution.Failed) + release claim
Bus->>DB: COMMIT
DB-->>Bus: SQLITE_FULL (rollback)
Note over Exec,DB: Terminal event dropped; claim stays held and session looks busy forever
end
rect rgb(30, 55, 40)
Note over Runner,DB: After: < 30 s full disk
Runner->>Bus: publish(StepEvent)
loop StorageRetry.write (up to 30 s)
Bus->>DB: BEGIN IMMEDIATE ... COMMIT
DB-->>Bus: SQLITE_FULL (rollback)
end
Note over DB: Disk space frees
Bus->>DB: BEGIN IMMEDIATE ... COMMIT
DB-->>Bus: OK
Bus-->>Runner: Committed once, turn continues
end
rect rgb(35, 45, 65)
Note over Runner,DB: After: > 30 s full disk (e.g. 90 s)
Runner->>Bus: publish(StepEvent)
Bus-->>Exec: Exhausted after 30 s (SQLITE_FULL)
loop StorageRetry.settlement (interruptible, up to 15 min)
Exec->>Bus: publish(Execution.Failed { type: "storage" }) + release claim
Bus->>DB: COMMIT
DB-->>Bus: SQLITE_FULL (rollback)
end
Note over DB: Disk space frees
Exec->>Bus: publish(Execution.Failed { type: "storage" }) + release claim
Bus->>DB: COMMIT
DB-->>Bus: OK (claim released, session marked failed)
end
Storage Recovery & Tradeoffs
ScopeThis PR covers Verificationbun run --cwd packages/core typecheck bunx oxlint packages/core/src/bus.ts packages/core/src/database/storage-retry.ts packages/core/src/job.ts packages/core/src/session/execution.ts packages/core/src/session/subagent-job.ts packages/core/src/session/to-session-error.ts packages/core/test/lib/storage-fault.ts packages/core/test/session-execution.test.ts packages/core/test/session-runner.test.ts packages/core/test/storage-retry.test.ts bun run --cwd packages/core test test/storage-retry.test.ts test/bus.test.ts test/bus-session-routing.test.ts test/job.test.ts test/kv.test.ts test/tool-subagent.test.ts test/session-error.test.ts test/session-execution.test.ts test/session-run-coordinator.test.ts test/session-runner.test.ts test/session-store.test.ts test/session-prompt.test.ts test/session-wait.test.ts test/session-shell.test.ts bun run --cwd packages/core test test/database.test.ts test/database-drizzle.test.ts test/session-projector.test.ts test/session-log.test.ts test/session-runner-retry.test.ts test/session-runner-recorded.test.ts test/session-runner-message.test.ts test/session-runner-tool-events.test.ts test/session-step.test.ts test/session-revert.test.ts test/session-remove.test.ts test/session-move.test.ts test/session-owned.test.ts test/session-view.test.ts test/session-compact.test.ts test/session-compaction.test.ts test/session-activation.test.ts test/session-create.test.ts
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions…ures A full disk made every durable publish die at COMMIT with SQLITE_FULL, so a running turn failed on its next event. SQLite rolls such a transaction back, so the bus now reruns the whole commit with backoff for up to 30 seconds when the failure is SQLITE_FULL, SQLITE_IOERR, SQLITE_BUSY, or SQLITE_LOCKED. Brief outages now stall the turn instead of breaking it. When a turn died on a full disk, publishing its terminal event failed the same way and was only logged. The Session lost its outcome, kept its execution claim, and looked busy to clients until someone interrupted it. Lifecycle events now keep retrying while storage reports a transient failure, so the outcome lands once space frees. The retries wait interruptibly, so shutdown during an outage keeps the claim for restart recovery instead of hanging. Storage failures also surface as a storage error rather than an unknown one. A background job persisted its outcome inside settlement, so a write that failed on a full disk aborted settlement entirely: the job stayed running forever, its waiters never resumed, and the parent of a background subagent was never told the child had failed. Later continuations joined the stuck job and skipped notification too. Persisting the outcome now retries transient storage failures and then settles regardless, logging the lost marker. Delivering the outcome to the parent retries through longer outages, which is safe because the notice reuses its notification ID, and failures are logged instead of vanishing.
3 tasks done
woodsonl
added a commit
to woodsonl/opencode
that referenced
this pull request
…ment the control-statement bypass Review follow-up: - The lock holder is released by the test at wide margins instead of setTimeout, so the first attempt always precedes the release; the cross-fiber race is ordered with a Deferred that parks the interfering transaction mid-body. The interleaving no longer depends on 10/30/120ms sleeps lining up, and the race test now fails on the pre-fix head deterministically instead of by luck. - Shared setup (schema, WAL, holder, value reads) shrinks the file from 361 to ~250 lines across 6 focused cases: bun retry, values-path retry, node classification, fail-fast on a stale snapshot, fail-fast on non-lock errors, and the cross-fiber race. - The transactionOpen bypass in gateStatement now documents why only the transaction's own BEGIN/COMMIT/ROLLBACK can reach it: every gated statement runs holding the client semaphore, and the flag is true exactly while a transaction holds it, so a foreign statement queues instead of observing it. The header comment states the layering with caller-side whole-transaction replay (anomalyco#53704) so the two retry layers stay disjoint.
3 tasks done
Contributor
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ReviewersNo reviewsUh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabelsProjectsMilestoneNo milestoneDevelopmentSuccessfully merging this pull request may close these issues. Uh oh!
There was an error while loading. Please reload this page. 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. | ||||||||||||||||
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |