fix: record interrupted runs so the update no-op check retries them#365
Open
Wenyu Chiou (WenyuChiou) wants to merge 1 commit into
Open
fix: record interrupted runs so the update no-op check retries them#365Wenyu Chiou (WenyuChiou) wants to merge 1 commit into
Wenyu Chiou (WenyuChiou) wants to merge 1 commit into
Conversation
Since langchain-ai#277, a run that fails mid-stream still persists .last-update.json so already-generated content stays diffable. That left a crashed run indistinguishable from a completed one: the next update sees a clean worktree with an unchanged git head and skips as a no-op, so a possibly partial wiki is treated as current until an unrelated commit lands. Update metadata now records a run status. The failure path writes status "interrupted", and getUpdateNoopStatus no longer skips when the previous run was interrupted. Metadata written by older versions has no status field and is treated as complete, so upgrades do not force a spurious re-run. A completed retry that changes no content still rewrites the metadata to clear a leftover interrupted status, so the no-op skip recovers instead of re-running forever. Adds five regression tests; three fail against the previous code. Co-Authored-By: Claude Fable 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.
What
Follow-up to #277. Update metadata now records how the run ended, and the update no-op check retries interrupted runs instead of locking them in:
UpdateMetadatagains an optionalstatus: "complete" | "interrupted".runOpenWikiAgentCore(the fix: persist .last-update.json when a run fails after generating content #277 catch block) persists metadata withstatus: "interrupted"; successful runs record"complete".getUpdateNoopStatusreturnsshouldSkip: false(reason:previous update was interrupted) when the last run was interrupted, so the next scheduled/manual--updateactually retries.statusfield and is normalized to"complete"— upgrading does not force a spurious re-run.interruptedstatus — otherwise the no-op skip would never engage again and every scheduled run would pay a full agent pass (the --update with zero diff runs a full agent pass instead of a no-op #44/~12× cost variance on repeated --init of the same repo (GLM 5.2/OpenRouter, no spend cap) — reinforces #44 #51 cost class).Why
#277 correctly keeps partially-generated content diffable, but it left a crashed run indistinguishable from a complete one. A half-written wiki then self-reports as fresh (
updatedAtis new), and the no-op gate skips every retry until an unrelated commit lands — bad for both correctness (agents consume a partial wiki that claims to be current) and scheduled-CI semantics.How tested
test/update-noop.test.tsandtest/run-metadata.test.ts, mirroring the existing temp-repo patterns: interrupted metadata → no skip with the exact reason; pre-status-field metadata still skips (back-compat guard);persistRunMetadataIfChangedrecordscomplete/interrupted; a no-change completed retry clears the interrupted flag; a no-change retry after a complete run still writes nothing. 3 of the new assertions fail against the previous code — verified before applying the fix.pnpm run format,pnpm run lint,pnpm test: 300/302 pass on my machine (Windows). The 2 failures are the pre-existing win32test/env-behavior.test.tsplatform checks (0600 permissions / HOME resolution), which reproduce on pristinemain— CI (ubuntu) should be fully green.Fixes #364
🤖 Generated with Claude Code