Skip to content

fix(publish): stale exact-review artifacts complete terminally instead of requeueing forever - #634

Merged
steipete merged 1 commit into
mainfrom
fix/stale-publication-terminal
Jul 16, 2026
Merged

steipete merged 1 commit into
mainfrom
fix/stale-publication-terminal

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Why

Monitoring found a poison cohort: openclaw/agent-skills#100@publish:29455236464:1 retried publication for 21+ hours. Root cause: when the publisher's preflight detects a stale artifact ("current state has a newer tuple" / "already closed" / "no record tuple"), it throws — the workflow fails, the queue requeues the SAME artifact, and the failure is deterministic, so it loops until the 80-day artifact ceiling. The oldest-pending publication cohort (~20h) is this bug.

What

The preflight-stale branch now writes the workflow's existing disposition outputs and exits successfully instead of throwing:

  • remote-newer -> requeue_latest=true: the existing "Queue fresh review after source drift" step enqueues a review of the LATEST revision (superseding), classifier reports success, queue completes this item.
  • remote-closed -> terminal_closed=true, missing -> terminal_missing=true: terminal completions the classifier already accepts.

The outcome vocabulary and all consuming steps already existed — the preflight path just never emitted it. Disposition mapping lives in a new pure module (src/repair/stale-event-disposition.ts) so it is unit-testable (the publisher script executes at module load).

Proof

  • Unit tests: disposition mapping per preflight result; output lines match the workflow contract; a source-level guard asserts the preflight block writes dispositions and contains no throw (the regression that caused the loop).
  • pnpm run build:all, format:check, lint green; autoreview (Codex Sol, xhigh) clean on first pass.
  • After deploy, expect the ~20h publication cohort to drain within one retry cycle per item.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7f364f3eff

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

return {
detail: "current state is already closed",
requeueLatest: false,
terminalClosed: true,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid emitting terminal_closed for stale closed-state preflight

When the publisher reaches this branch, the workflow has already queried GitHub and skipped the script entirely if the live item was closed (.github/workflows/sweep.yml:1600-1634). For a remote-closed preflight with a still-open live item (for example a reopened issue whose state record is still under closed/), this now writes terminal_closed=true, which triggers Release terminal review leases; that step asserts the live item is closed before deleting leases (.github/workflows/sweep.yml:1710-1718), so the job fails and the exact-review queue can still requeue the stale artifact instead of completing terminally.

Useful? React with 👍 / 👎.

@steipete
steipete merged commit 0fcbad4 into main Jul 16, 2026
10 checks passed
@steipete
steipete deleted the fix/stale-publication-terminal branch July 16, 2026 19:51
azaj01 pushed a commit to azaj01/clawsweeper that referenced this pull request Sep 21, 2026
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.

1 participant