Repository navigation
Fix run-record defects found in the re-review of #174 - #177
Merged
Merged
Conversation
A write to history, or the write that takes a finished one-shot task out of the queue, is now tried again for a few seconds. A run record history still refuses is kept in memory and in runs/<run-id>.pending.json, written ahead of the next record and replayed at the next daemon start. Retiring a one-shot marks it done and removes it in one locked update; a one-shot left queued after it ran is removed at the next start. Notifications keep the settings read last when config.toml cannot be read, instead of falling back to the desktop alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A config that does not parse or a task that does not validate is not tried again. AppendRun and RetireTask take their locks per attempt, so the rest of the daemon is not held up during the pauses. A failed history write cuts back only what it wrote itself, every fallback file is removed once history holds its record, and a replay never sets a finished run back to running. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tegrity # Conflicts: # README.md
A run's start record gets one attempt without pauses, since the caller holds the engine lock; a start history refuses is dropped and the run does not start, instead of a "running" row landing later for a run that never was. A record that is only late (store.ErrRunKept) no longer counts as a failure when cancelling a resume or taking a run back. The start-up repair now removes only one-shot tasks whose removal RetireTask recorded as owed, and never one with a run in flight or a waiting session. A task queued again by hand under a completed id stays listed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…it fails The happy path is one config write and one state write again. A task edited to cron is never removed by the repair, which also rewrites state only when it settled something. A history write that completed is not reported as failed because closing the file failed afterwards. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The last-good-settings fallback for notifications moves into liveNotifier.Channels(), which now feeds the engine's outbox: a config that cannot be read still reports the error, and returns the channels of the settings read last instead of the desktop alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…k outcomes (#175) * Record and notify runs cut off by a restart, and read taken-back outcomes At start, every run that ended while no daemon watched it (still recorded as running, or a quiet-history run known only by its process record) now goes through the normal end-of-run path: it gets a history row, its task's schedule is updated, and the failure is notified. Its outcome comes from the harness's own session transcript when that shows how the turn ended (Claude Code), otherwise it is written off as interrupted. A run taken back after a restart reads its outcome the same way when its process ends. A one-shot run DispatchQ itself cut off (the shutdown grace ran out, or the daemon died under it) continues its session once at the next start instead of being retired half done or started over; cut off again, it is retired. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Document how runs cut off by a restart are recorded and continued Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Treat an unreadable taken-back end as cut off, and keep quiet runs until recorded A taken-back run whose transcript cannot tell how it ended now counts as cut off, like a run that ended before the restart: its one-shot continues the session once. A gone run's process record is forgotten only after its end is recorded, so a daemon stopped mid-recovery finds a quiet run again. The transcript reader skips meta lines the CLI adds after an answer, and a run read back from it records the transcript's end time. A run without a task snapshot is settled with its queued task. A continuation after an interruption is no longer shown as waiting for the rate limit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Read limits and login errors from transcripts, and continue cut-off sessions safely A transcript turn that ended on an API error is classified by the same parser as a live run: a usage limit pauses the provider until the window it names and resumes the session, a 401 is an auth_error, an organisation or billing block pauses the account. Before, all of them were plain failures. A session DispatchQ cut off is continued with a dedicated prompt (check what is already done, finish only what is missing) instead of the task's full prompt, which a possibly finished session would have redone. The one extra go survives a rate-limit pause of the continuation, the same run met twice counts once, and a task deleted meanwhile is not continued. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Keep the spent continuation through limit pauses, and read org blocks from transcripts A limit that pauses a continuation makes it an ordinary limit resume (shown as waiting for the limit, resumed with the task's prompt), but the record that its one more go is spent survives, whatever session id the harness reports. A one-shot whose completion is recorded with its removal still owed is not continued. A queue that cannot be read does not cancel the continuation. Transcript API errors pass their error code on, so an organisation block pauses the account instead of reading as a login problem. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Daniel Maier <dm@dc.ag> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
History appends now take the cross-process write lock per attempt, so a retry waits holding no lock; the start record's single attempt does too. Runs overlays kept records on main's readHistoryLocked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…to feature/run-record-integrity
Restart outcomes now sit on main's quiet-run recording: a quiet-history run cut off by a restart is recorded as an interrupted, visible row, not a hidden quiet one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ar live runs last AppendRun queues the record before it tries the cross-process lock, so a lock file that cannot be opened leaves the record waiting and kept instead of lost with a nil error. A run's process record is cleared only after its outcome is written or kept, so a quiet run whose outcome history refused is recorded at the next start. A cut-off one-shot continues only a session the harness itself named (reported on its output, or a Claude Code transcript on disk); a Codex or opencode run with no such session, or a harness stopped before it started, is retired as before instead of resuming a placeholder. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Main's tree equals the branch point 5cebee0, so every conflict resolves to this branch's side; the diff to main is only the review fixes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…orting A run that resumed a waiting session continues it after a cut-off even before the harness named it again. A transcript that exists but cannot be read still confirms its session. AppendRun reports its own record as kept when its fallback file was written, whatever happened to other waiting records. A start that cannot record a gone run keeps its process record. Tests no longer spend wall-clock time on store retries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Fixes from the re-review of #174, which is merged.
What changes for the operator
runs/<run-id>.pending.json. A record whose own fallback file was written is reported as kept even when another waiting record could not be.Known gap, not changed here
Checks
go build ./...,gofmt,go vet ./...,golangci-lint run,go test ./... -race/code-reviewon the diff, confirmed findings fixed🤖 Generated with Claude Code