fix(workflows): make end-to-end runs survive without mid-run caps or stale state - #55
Conversation
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 33 minutes and 46 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (54)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
# [1.3.0](v1.2.2...v1.3.0) (2026-04-25) ### Bug Fixes * **review:** forward installation token, post inline findings, and stream progress ([#57](#57)) ([7ee4861](7ee4861)) * **workflows:** make end-to-end runs survive without mid-run caps or stale state ([#55](#55)) ([35ee605](35ee605)) ### Features * **workflows:** add label-dispatched bot workflow foundation ([#49](#49)) ([1b18779](1b18779))
|
🎉 This PR is included in version 1.3.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Description
Fix four classes of bug found while running real
bot:shipcascades on issue #11 end-to-end. The cascade was losing progress mid-run (turn cap, wall-clock cap), miscounting concurrency at the process boundary, and producing one-line tracking comments that hid all evidence the agent produced. Triage was a regex keyword classifier — now it actually reads the repo and returns a structured verdict that halts the cascade when the issue is invalid.While diagnosing the in-flight bookkeeping drift, we also replaced the time-threshold stale-row reaper with a heartbeat-based one so that crashed/killed orchestrators and daemons release their
workflow_runsrows immediately rather than after a 60-min timeout.Before
After
Changes
Concurrency bookkeeping
incrementActiveCount/decrementActiveCountownership insrc/orchestrator/connection-handler.ts(handleAcceptincrements,handleResultand error paths decrement).src/webhook/router.ts,src/workflows/dispatcher.ts,src/workflows/handlers/ship.ts,src/workflows/orchestrator.ts, andsrc/workflows/execution-row.ts(the daemon-side helper was double-counting across processes).isAtCapacity) still works correctly.maxTurnsmade truly optionalsrc/config.ts—defaultMaxTurnsis.optional()(no implicit 30).src/shared/ws-messages.ts—maxTurnsfield is optional.src/orchestrator/job-dispatcher.ts,src/daemon/job-executor.ts,src/core/executor.ts— conditionally spreadmaxTurnsrather than coalesce to 50.src/workflows/handlers/plan.ts— drop hard-codedmaxTurns: 30.Wall-clock timeout
AGENT_TIMEOUT_MSandSTALE_EXECUTION_THRESHOLD_MSdefaults raised from 600_000ms to 3_600_000ms (60 min). Realimplementruns were hitting the 10-min cap mid-task.Code-aware triage rewrite
src/workflows/handlers/triage.ts— replaces regex keyword classifier with an Agent-SDK-driven validator. Clones the repo, runs the agent withRead/Grep/Glob/Bash/Write, asks forTRIAGE.md+TRIAGE_VERDICT.json(zod-validated). Returnssucceeded(valid=true) orfailed(valid=false) — the latter halts thebot:shipcascade.Tracking comment richness
plan.ts,implement.ts,review.ts,triage.ts— embed the full structured agent report (PLAN.md/IMPLEMENT.md/REVIEW.md/TRIAGE.md) plus acost · turns · durationmetadata footer.src/types.ts—ExecutionResult.capturedFiles?: Record<string, string>.src/core/pipeline.ts—RunPipelineOverrides.captureFiles?: string[]; newreadCapturedFileshelper reads requested files before workspace cleanup.PR detection robustness
implement.tsfindRecentOpenedPr— filter onpr.user?.type === "Bot"instead of a hard-coded slug. Dev installs publish aschrisleekr-bot-dev[bot], prod aschrisleekr-bot[bot]— the slug check produced false negatives.Heartbeat-based liveness reaper (new)
src/db/migrations/006_workflow_runs_ownership.sql— addsowner_kind/owner_idtoworkflow_runs(nullable; pre-existing rows ignored by reaper).src/orchestrator/instance-id.ts,src/daemon/daemon-id.ts— stable IDs (k8s pod name in prod, host+pid in dev/tests).src/orchestrator/instance-liveness.ts— orchestrator publishesorchestrator:{id}:alivewith 60s TTL, refreshed every 20s.src/orchestrator/liveness-reaper.ts— scans Valkey alive keys; flipsworkflow_runsrows whose owning process no longer heartbeats tofailed.src/orchestrator/queue-worker.ts— pulls the queue independently of WS connect events so a slow connect can't starve the queue.src/orchestrator/valkey-cleanup.ts— drops orphaned per-instance processing lists and stale daemon active-job sets on startup.src/workflows/execution-row.ts— extractedrecordWorkflowExecution(ownership-aware row insert).Tests
test/workflows/handlers/triage.test.ts— full rewrite; 6 cases (valid, invalid, agent error, missing markdown, malformed JSON, wrong target).void mock.module(...)+ spread realnode:fs/promisesto avoid cross-file mock pollution.test/daemon/,test/orchestrator/instance-liveness.test.ts,test/orchestrator/liveness-reaper.test.ts,test/orchestrator/queue-worker.test.ts,test/orchestrator/valkey-cleanup.test.ts.Docs / config
.env.example,docs/CONFIGURATION.md,docs/ARCHITECTURE.md— reflect new defaults, remove theTRIAGE_MAXTURNS_*ladder, document the liveness reaper.Dockerfile.daemon,Dockerfile.orchestrator— minor surface updates to match new module layout.Related Issues
bot:review).Testing
bot:shipE2E runs against issue refactor(testing): extract shared test factories to eliminate duplicated makeCtx/silentLog boilerplate across 7 test files #11)mainare broken (finalizeTrackingComment,getExecutionState,requireValkeyClient,recoverStaleExecutions); not introduced by this PR