-
Notifications
You must be signed in to change notification settings - Fork 26
fix(gastown): dispatch circuit breaker — per-bead attempt cap, exponential backoff, town-level breaker (#1653) #1921
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -517,6 +517,19 @@ export function applyAction(ctx: ApplyActionContext, action: Action): (() => Pro | |
| `, | ||
| [agentId] | ||
| ); | ||
| // Track dispatch attempts on the bead itself (not just the agent). | ||
| // The bead counter is never reset by hookBead, preventing the | ||
| // infinite retry loop (#1653). | ||
| query( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. WARNING: Dispatch attempts are counted twice per dispatch
|
||
| sql, | ||
| /* sql */ ` | ||
| UPDATE ${beads} | ||
| SET ${beads.columns.dispatch_attempts} = ${beads.columns.dispatch_attempts} + 1, | ||
| ${beads.columns.last_dispatch_attempt_at} = ? | ||
| WHERE ${beads.bead_id} = ? | ||
| `, | ||
| [now(), beadId] | ||
| ); | ||
| beadOps.updateBeadStatus(sql, beadId, 'in_progress', agentId); | ||
|
|
||
| const capturedAgentId = agentId; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WARNING:
RESTART_WITH_BACKOFFno longer applies the new backoff policyThe reconciler now gates redispatch off
beads.last_dispatch_attempt_at, but this restart path still only changes agent state before handing control back to the scheduler. If the bead's last dispatch timestamp is already stale, the next reconcile can redispatch immediately, so the manual restart bypasses the intended cooldown.