Skip to content

Retry main watcher queueing safely - #8952

Merged
dezren39 merged 2 commits into
mainfrom
fix/main-broken-watcher-43264623316
Nov 14, 2026
Merged

dezren39 merged 2 commits into
mainfrom
fix/main-broken-watcher-43264623316

Conversation

@dezren39

@dezren39 dezren39 commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

Summary

The watcher retries a queue POST only when its caller supplies a stable dedupe key:

append breakage → send per-run dedupe_key → retry transient 502/503/504 or transport errors up to 3 attempts

Create-task calls without a stable key remain single-attempt, avoiding duplicate task creation. Adds a focused contract test for retries, exhaustion, non-retryable responses, and key requirements.

Fixes #8950

Evidence

  • Before: main watcher run https://github.com/developing-today/code/actions/runs/43264623316 failed when pm-dispatch POST /v1/tasks returned HTTP 502.
  • After: bash .github/scripts/pm-dispatch-queue-post.test.sh passes, including transient retries, no-key safety, and non-retryable responses.
  • The fix session also reports passing shellcheck, workflow-validator contract tests, and full workflow/composite-action validation. The CI-policy agreement check passed; its separate local contract-test script failed before assertions without output.

Merge Danger

Door: Two-way.

Blast Radius: Low — retries are enabled only for calls with an explicit idempotency key; other composite-action callers retain one-attempt behavior.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner November 12, 2026 17:31
@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 29 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0bd88002-a7a9-409f-91f2-9cd20342e9a0
Commits

Reviewing files that changed from the base of the PR and between 0d1882d and 991fc8a.

Files selected for processing: 5

  • .github/actions/pm-dispatch-queue/action.yml
  • .github/actions/pm-dispatch-queue/post-task.sh
  • .github/scripts/pm-dispatch-queue-post.test.sh
  • .github/workflows/main-broken.yml
  • .github/workflows/workflow-lint.yml
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@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: c34b2cb5bf

ℹ️ 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".

Comment on lines +156 to +157
if [ -n "$INPUT_DEDUPE_KEY" ]; then
retryable=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.

P2 Badge Exclude issue-creation requests from automatic retries

When a caller supplies dedupe_key without issue_number and leaves issue at its default true, a lost response after a successful POST causes the retry to create another GitHub issue. In pm-stack/dispatch/src/server.ts, handleTasks creates the issue before deduplicating the queue task (lines 437–438), then returns the newly created issue number even when enqueue returns the existing task (lines 557–562). Consequently, the action reports an issue that the task does not track and leaves duplicate labeled issues behind. Restrict retries to existing-issue attachments or issue=false until issue creation itself is idempotent.

Useful? React with 👍 / 👎.

@dezren39 dezren39 Nov 14, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in 991fc8a (task 17197, lane any-c).

You are right: a dedupe_key alone made requests retryable, and handleTasks creates the tracking issue before deduplicating the task, so a lost response + retry would duplicate the issue.

  • post-task.sh: when retries are requested, the payload must now attach to an existing issue (issue_number) or create no issue (issue != true); an issue-creation payload is refused before any request is made.
  • action.yml: retryable is computed with the same rule (dedupe key AND (issue_number set OR issue != true)).
  • Contract tests: new cases cover the issue-creation refusal (no request made) and the existing-issue attach retry (502 then success), plus a grep guard on the action.yml condition. bash .github/scripts/pm-dispatch-queue-post.test.sh passes.

The branch was also rebased onto current main; the previously failing ci-policy agreement contract test passes on the rebased branch (it failed on the stale Nov 12 base and passes on clean main).

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-14T20:07:42.821222Z
We couldn’t complete this review. Comment @codex review to try again.
991fc8a New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@dezren39

Copy link
Copy Markdown
Member Author

Agent note — task 17197 picked up (lane any-c)

  • state: claimed
  • Task 17197 (pr_shepherd) claimed by lane any-c; execution-lane assignment: direct.
  • Revalidating PR Retry main watcher queueing safely #8952 fresh: still open, head fix/main-broken-watcher-43264623316 @ c34b2cb, no held / user/owned / do-not-merge / do-not-auto-edit labels.
  • Next: disposition the Codex P2 finding (retries must exclude issue-creation requests) and the failing checks, then merge or close with evidence per task 17197 acceptance.

repo-worker-tmp-code-b added 2 commits November 14, 2026 14:06
Codex P2 on PR #8952: a dedupe_key alone made issue-creation requests retryable, but handleTasks creates the tracking issue before deduplicating the task, so a lost response followed by a retry would create a duplicate issue. post-task.sh now refuses retries when the payload would create an issue (issue=true without issue_number), and the composite action computes retryable with the same rule. Contract tests cover both the refusal and the existing-issue attach case.
@dezren39
dezren39 force-pushed the fix/main-broken-watcher-43264623316 branch from c34b2cb to 991fc8a Compare November 14, 2026 20:07
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@dezren39
dezren39 merged commit 1753bc0 into main Nov 14, 2026
2 checks passed
@dezren39
dezren39 deleted the fix/main-broken-watcher-43264623316 branch November 14, 2026 20:11
@dezren39

Copy link
Copy Markdown
Member Author

Agent note — task 17197 done: fixed_merged (lane any-c)

  • PR Retry main watcher queueing safely #8952 MERGED at 2026-11-14T20:11:09Z, merge commit 1753bc0. Issue main CI failure: developing-today/code — main broken watcher (run 43264623316) #8950 CLOSED by the merge.
  • Codex P2 finding (comment 4554019251) fixed in 991fc8a and dispositioned on its thread (reply 4575457635): retries are now refused for issue-creation payloads — post-task.sh requires an existing issue_number or issue != true when retries are requested, and the composite action computes retryable with the same rule.
  • Branch rebased onto current main before merge (clean rebase; final head 991fc8a, merge state CLEAN/MERGEABLE).
  • Tests: bash .github/scripts/pm-dispatch-queue-post.test.sh — all contract tests pass, including the two new Codex cases. bash .github/scripts/check-ci-policy-agreement.test.sh passes on the rebased branch (it failed on the stale Nov 12 base and passes on clean main, so that failure was pre-existing staleness, not this change). check-workflows.test.sh could not run locally (actionlint not installed on the laptop; its CI step passed on the original head).

@dezren39 dezren39 removed status/in-progress Queue worker lifecycle state queue/claimed Queue worker lifecycle state work/assigned Queue worker lifecycle state labels Nov 14, 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.

main CI failure: developing-today/code — main broken watcher (run 43264623316)

1 participant