feat(heartbeat): automatic diagnostic retry for failed runs#1
Merged
Noesis-Boss merged 1 commit intomasterfrom Apr 23, 2026
Merged
feat(heartbeat): automatic diagnostic retry for failed runs#1Noesis-Boss merged 1 commit intomasterfrom
Noesis-Boss merged 1 commit intomasterfrom
Conversation
- Add diagnosticRetryCount column to heartbeat_runs table - Add maybeEnqueueDiagnosticRetry function that runs after each failed run - Diagnostic agent analyzes error (signal, exitCode, error message) and classifies failure type - Retry is enqueued as a new run with context from the failed run (task, session, workspace) - Max 2 diagnostic retries per failed run before giving up - Includes migration for diagnostic_retry_count column - Future upstream updates: rebase origin/master and re-apply migration if needed
bef20d1 to
ad3faaa
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When a run fails due to an adapter error (network timeout, rate limit, API error, etc.), Paperclip now automatically classifies the failure and can retry it up to 2 times using the heartbeat service as a diagnostic agent.
What changed
New column:
diagnosticRetryCountheartbeat_runsvia migration0046_curious_deadpool.sqlNew function:
maybeEnqueueDiagnosticRetryinheartbeat.tsAfter every failed run in
finalizeCompletedRun, this function:diagnosticRetryCount < 2error,exitCode, andsignalcanRetry = true(transient errors only), enqueues a diagnostic retry rundiagnosticRetryCounton the new runFailure classification (
classifyFailure)Each failure is categorized and marked retryable or not:
process_killedrate_limittimeoutnetwork_erroreof_errornot_foundpermission_deniedoomunknownNo changes for
process_lostThe existing
processLossRetryCountretry mechanism is unchanged.Testing