Conversation
…x, and restart recovery Add a dedicated SQLite-backed local store under HOSTLINK_STATE_PATH that persists received, running, final, and interrupted task execution state keyed by task_id and execution_attempt_id. Implementation: - Config helpers for store path, spool cap (default 64MiB), and terminal reserve (default 1MiB) with env overrides - localtaskstore package with RecordReceived, RecordStarted, AppendOutputChunk, RecordFinal, AckMessage, UnackedMessages, Snapshot, and MarkInterruptedRunningTasks - Two-table schema: local_task_executions (task/execution state) and local_task_outbox_messages (unacked output/final resend queue) - Spool cap with oldest-first chunk rotation, truncation markers, and terminal-preservation semantics - Startup recovery converts stale running tasks into interrupted terminal records - Narrow ReceiptStore, ResultOutbox, RecoveryStore interfaces for later WebSocket adoption - Hostlink startup wiring in recoverLocalTaskStore() helper
6c23d87 to
b17a118
Compare
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
Add a durable local task store under
HOSTLINK_STATE_PATHthat persists received, running, final, and interrupted task execution state. This establishes the persistence boundary required for reliable WebSocket reconnect, resend, and restart behavior before task result delivery can be trusted in production.Changes
New package:
app/services/localtaskstore/local_task_executions(task/execution state keyed by task_id + execution_attempt_id) andlocal_task_outbox_messages(unacked output chunk / final result resend queue)RecordReceived,RecordStarted,AppendOutputChunk,RecordFinal,AckMessage,UnackedMessages,Snapshot,MarkInterruptedRunningTasksoperationsRecordReceivedfails withErrTerminalReserveUnavailablewhen outbox cannot reserve space for a future final resultReceiptStore,ResultOutbox,RecoveryStoreModified:
config/appconf/LocalTaskStorePath()— derives default fromHOSTLINK_STATE_PATHor explicit env overrideLocalTaskStoreSpoolCapBytes()— envHOSTLINK_LOCAL_STORE_SPOOL_CAP_BYTES, default 64MiBLocalTaskStoreTerminalReserveBytes()— envHOSTLINK_LOCAL_STORE_TERMINAL_RESERVE_BYTES, default 1MiBModified:
main.gorecoverLocalTaskStore()helper: opens store viaNewDefault()and runsMarkInterruptedRunningTasks()on bootVerification
All tests pass:
go test ./config/appconf/go test ./app/services/localtaskstore/go test .(root startup wiring tests)go test ./app/jobs/taskjob ./app/services/taskreporter/