Repository navigation
fix(automations): replace fixed timeout with progress-based stall detection - #4355
Merged
Merged
Conversation
…ails a run Co-Authored-By: Claude Opus 4.8 <[email protected]>
Automations were killed after 5 min regardless of progress. Remove the hosted-path wall-clock timeout so automations fall under the existing 10-min progress-based idle reaper (unified with interactive runs). A stalled run is now reaped + failed with a legible stall reason. Co-Authored-By: Claude Opus 4.8 <[email protected]>
RUN_STARTED didn't clear failure_reason/failure_kind, so a re-run of a previously-stalled thread carried a stale reason. Also adds real-Postgres assertions proving the stall reason set on RUN_FAILED(reaped) is actually persisted by the update() whitelist, not just accepted by the fake storage used in unit tests. Co-Authored-By: Claude Opus 4.8 <[email protected]>
tlgimenes
force-pushed
the
feat/automation-stall-detection
branch
from
July 7, 2026 17:59
acdfba9 to
692d202
Compare
tlgimenes
enabled auto-merge (squash)
July 7, 2026 18:00
decocms Bot
pushed a commit
that referenced
this pull request
Jul 7, 2026
PR: #4355 fix(automations): replace fixed timeout with progress-based stall detection Bump type: patch - decocms (apps/mesh/package.json): 3.102.0 -> 3.102.1 Deploy-Scope: server
tlgimenes
pushed a commit
that referenced
this pull request
Jul 16, 2026
…TS.md (#4475) Mined ~300 merged PRs for the delta between the first PR proposal and the work added before merge. The dominant shape: a first draft ships the happy path, then a hardening pass (often a different engineer who takes over the branch and merges — the vibecoder→engineer handoff) adds the same categories every time. Encoded those 9 categories as an actionable first-pass checklist, each citing a real PR (#4008, #4230, #4365, #4409, #4426, #4445, #4357, #4355, #4449, #4350, #4373, #4416, #4446, #4461, #4134, #4469). Covers: variant/edge-case handling, tenant/permission scoping, concurrency & silent-data-loss, test-per-fix + invert-bug-tests + real-PG, dead-code/knip, lifecycle symmetry + state reset, kill-switch/GC/git-exclude for risky infra, input validation vs over-engineering, compile-time type-safety. Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
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
Automation runs were being killed after a fixed 5-minute wall-clock timeout regardless of progress — a legitimately long, actively-streaming run (e.g. the 17-task commerce-discovery audit) died mid-work, on task 1 of 17. This replaces the crude cap with the progress-based idle reaper that already governs interactive runs, unifying both under one mechanism.
Observed on prod thread
thrd_J5cKVKyrKLyEHM-Dc3wT7: ran exactly 5:00, aborted while streaming tool calls with a nullfailure_reason.What changed
RUN_FAILED/reason: "reaped"), it now writesfailure_reason: "Run stalled — no progress within the idle timeout window"andfailure_kind: "stall"instead of a barestatus: "failed". Reuses the columns added in fix(automations): record failure reason on failed automation runs #4343. Applied only to"reaped";"error"/"cancelled"/"ghost"are unchanged.AUTOMATIONS_RUN_TIMEOUT_MS, therunHostedHarnesssetTimeout,formatTimeoutReason, and thetimeoutMsplumbing). Automations now fall under the existing 10-min progress-based idle reaper (RUN_IDLE_TIMEOUT_MS) — a run lives as long as it keeps streaming, and is aborted only after 10 min of no progress. No absolute cap (per design); blast radius is bounded by per-org queue concurrency (10). TheAbortControllerstays for cancellation + the reaper's force-fail.RUN_STARTEDso a re-run of a previously-stalled thread doesn't carry a stale reason.Design decisions (see spec)
tapProgress→last_progress_at) is already wired on the hosted path, so a progressing automation run is protected.Scope
Hosted (cluster) path only. The sandbox/link (user-desktop CLI) timeout branch in
thread-gate-workflow.tsis intentionally left untouched.DBOS / recovery
Recovery-compatible workflow-source change — logic inside the existing
runHostedHarnessstep + removal of an unused workflow-input field that replayed journals simply ignore. NoDBOS_WORKFLOW_VERSIONbump; the workflow-source-guard snapshot was re-baselined instead.Testing
failure_reason/failure_kind;error/cancelledunchanged;RUN_STARTEDclears the columns.run-reactor.integration.test.ts(verifies theupdate()whitelist actually persists the fields, via a raw column read).bun run check,fmt:check,lint(0 errors) green; workflow-source-guard 5/5.Follow-ups (out of scope)
failure_reason/failure_kindon theThreadread model / API so a consumer can display the stall reason (currently write-only through the storage layer — a pre-existing gap since fix(automations): record failure reason on failed automation runs #4343; no consumer today).🤖 Generated with Claude Code
Summary by cubic
Replaced the 5‑minute wall‑clock timeout for automations with progress-based stall detection shared with interactive runs. Runs keep going while streaming and only fail after 10 minutes of no progress; stalled runs record a clear reason.
RUN_IDLE_TIMEOUT_MS).failure_reason: "Run stalled — no progress within the idle timeout window"andfailure_kind: "stall"; other reasons unchanged.failure_reason/failure_kindonRUN_STARTEDto avoid stale data on re-runs.AbortControllerfor cancellation; removed timeout plumbing andtimeoutMsfrom the hosted harness, thread gate, and automations workflow.Written for commit 692d202. Summary will update on new commits.