Skip to content

fix: record interrupted runs so the update no-op check retries them#365

Open
Wenyu Chiou (WenyuChiou) wants to merge 1 commit into
langchain-ai:mainfrom
WenyuChiou:fix/interrupted-update-noop
Open

fix: record interrupted runs so the update no-op check retries them#365
Wenyu Chiou (WenyuChiou) wants to merge 1 commit into
langchain-ai:mainfrom
WenyuChiou:fix/interrupted-update-noop

Conversation

@WenyuChiou

Copy link
Copy Markdown

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:

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 (updatedAt is 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

  • 5 new regression tests across test/update-noop.test.ts and test/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); persistRunMetadataIfChanged records complete/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 win32 test/env-behavior.test.ts platform checks (0600 permissions / HOME resolution), which reproduce on pristine main — CI (ubuntu) should be fully green.

Fixes #364

🤖 Generated with Claude Code

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: an interrupted update run self-reports as fresh and the no-op check then skips every retry

1 participant