Public: anyone can read this; the crew can change it.

A maintenance worker that fails three ticks in a row parks itself and files one issue naming its last error #13315

opened this

Merged 20d 4h ago, live in production

The 97 test files that scripts/fast.ts named finished without a failure: 1559 passed, 2 skipped, 0 failed. I earlier said I'd left them to the forge's check, but the run had carried on in the background and completed.

Notes

opened this

The 97 test files that scripts/fast.ts named finished without a failure: 1559 passed, 2 skipped, 0 failed. I earlier said I'd left them to the forge's check, but the run had carried on in the background and completed. The run also covered the two other pause tests, test/maintain-failing.test.ts and test/maintain-pause.test.ts.

The pull description above stands as written.

Closes #13301

2 earlier comments
commented

The 97 test files that scripts/fast.ts named finished without a failure: 1559 passed, 2 skipped, 0 failed. I earlier said I'd left them to the forge's check, but the run had carried on in the background and completed. The run also covered the two other pause tests, test/maintain-failing.test.ts and test/maintain-pause.test.ts.

The pull description above stands as written.

commented

I fixed the dedupe hole, but left the runner.ts comment reflow in. The parked-worker tests pass, tsc is clean, and the fix is pushed.

  • Dedupe: the check in src/maintain/park.ts now matches only open issues authored by the watcher (AND author_id = ?3, bound to watcherId(db)). A person pasting Maintenance key: parked/<duty> into an issue no longer silences the alert. The header comment says so.
  • Test: in test/maintain-parked-issue.test.ts, a person-authored issue carrying the key for other-worker does not suppress the filing. The park still files an issue, and a second park files nothing more.
  • Reflow, not reverted: I did revert it, but bun scripts/gate.ts --fix rewrapped it again. The gate rewraps long comments in any file the pull touches, and this pull touches runner.ts, so the reflow comes with the change. Keeping runner.ts out of the diff would mean not wiring the park report into the runner, so I kept it. It is one comment line.
  • Scope: nothing else was added.

Try it: bun test test/maintain-parked-issue.test.ts.

commented

A duty that fails three ticks in a row is paused and files one issue naming the duty and its last error. While that issue is open, a restart or a resume that fails again files nothing more. Once someone closes the issue, the next park files a new one. Docs are in docs/features/maintenance-duties.md.

Changes since the last review:

  • No prefix collisions: the open-issue check in src/maintain/park.ts now matches the whole key line, so parked/flaky no longer matches inside parked/flaky-worker. It also only counts issues the watcher wrote, so anyone else pasting the key line into an issue can't silence the alert.
  • No silent failures: reportParked now returns { filed }, { open: true } or { failed: reason }. When nothing was filed and none is open, the runner logs parked maintenance duty not reported with the reason. That covers a failed createIssue and a forgeRepo that is unset or doesn't resolve.
  • Imports: getRepo now sits with the other imports from outside the module.
  • Tests: in test/maintain-parked-issue.test.ts each test now uses its own duty name, so each one passes when run alone. There are new tests for:
    • a pair of duty names where one prefixes the other; it fails against the old substring match;
    • a person-authored issue carrying the key, which does not stop the filing;
    • the log line when the configured repo is missing.

One thing left as is: the comment reflow in src/maintain/runner.ts stays. scripts/gate.ts --fix rewraps long comments in any file the pull touches, and putting the line back makes the gate rewrap it again.

To try it: bun test test/maintain-parked-issue.test.ts. All five tests pass, together and one at a time, and bun x tsc --noEmit is clean.

🤖 Generated with Claude Code

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs