Skip to content

fix(query): max_attempts is the total attempts allowed - #68

Merged
alob-mtc merged 1 commit into
mainfrom
fix/max-attempts
Sep 29, 2026
Merged

alob-mtc merged 1 commit into
mainfrom
fix/max-attempts

Conversation

@alob-mtc

Copy link
Copy Markdown
Collaborator

Found while porting the query layer to TypeScript (runnerq/runnerq-ts#6).

The bug: max_retries holds the total number of attempts allowed. An activity dead-letters once retry_count + 1 >= max_retries, and 0 means unlimited. Queries reported max_retries + 1:

  • an activity allowed 3 attempts showed as "attempt 3 of 4" in the console;
  • an unlimited one showed as allowing 1 attempt.

Changes:

  • ActivityRecord.MaxAttempts is max_retries, and 0 for unlimited (now documented on the field).
  • The agent leaves max_attempts out when unlimited (omitempty). This matches the TypeScript agent.
  • The max_attempts filter uses NULLIF(max_retries, 0), so an unlimited activity never matches a number.
  • The conformance suite (storagetest) expects 3 for an activity allowed 3 attempts, where it used to expect 4, and 0 for an unlimited one.

Cloud follow-up: RunnerQ Cloud's protocol type and console treat max_attempts as always present. A runnerq-cloud PR makes it optional, shows "unlimited", and fixes the protocol doc, which says "retries + 1".

Checked: the whole suite passes with -race and RUNNERQ_TEST_DSN.

Both SDKs store the total number of attempts in max_retries (an activity
dead-letters once retry_count + 1 reaches it; 0 is unlimited), but queries
reported max_retries + 1: one attempt too many, and 1 for an unlimited
activity. MaxAttempts is now max_retries, 0 for unlimited; the agent
leaves max_attempts out then, and the max_attempts filter never matches
an unlimited activity.
@coderabbitai

coderabbitai Bot commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 53 minutes.

Check out review usage here.

View limit details

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

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

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 845c9962-2745-4ba3-b4cc-7dad46c94c03

📥 Commits

Reviewing files that changed from the base of the PR and between bf73901 and 73fa2bf.

📒 Files selected for processing (4)
  • conductor/wire.go
  • storage/postgres/query.go
  • storage/query.go
  • storage/storagetest/query.go

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

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the fix label Sep 29, 2026
@alob-mtc
alob-mtc merged commit a8a25fa into main Sep 29, 2026
3 checks passed
@alob-mtc
alob-mtc deleted the fix/max-attempts branch September 29, 2026 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant