Repository navigation
feat(dbos): pin the workflow application version to stop deploy-induced stranding - #4143
Merged
Merged
Conversation
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…rage Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
tlgimenes
enabled auto-merge (squash)
June 25, 2026 20:28
main's #4134 (split web_research into web_search + deep_research) changed two registered-workflow files — automations/dbos-workflow.ts and harnesses/decopilot/background-tool-workflow.ts — entirely inside existing step bodies (no DBOS.runStep added or reordered). Recovery-compatible, so no DBOS_WORKFLOW_VERSION bump; just re-baseline the source-hash snapshot. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
decocms Bot
pushed a commit
that referenced
this pull request
Jun 25, 2026
PR: #4143 feat(dbos): pin the workflow application version to stop deploy-induced stranding Bump type: minor - decocms (apps/mesh/package.json): 3.60.1 -> 3.61.0 Deploy-Scope: server
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.
Problem
DBOS leaves the application version at its SDK default: an MD5 of the source (
fn.toString()) of every registered workflow, plus the SDK version. Because the server ships bundled, that hash changes on nearly every deploy. DBOS workflow recovery is version-scoped, so when the hash changes, in-flight workflows of the old version have no executor able to resume them — they strand.This bit production: a deploy landed mid-run, the long-polling
threadGateWorkflow(per-threadconcurrency=1, ~1h poll, noworkflow_timeout_ms) was strandedPENDINGon the old version, permanently holding its thread's partition slot, so every later message on that thread satENQUEUEDforever ("accepted and queued"). Conductor reportedrecovery … : okfor the dead executor, but the new-version executors loggedNo workflows to recover from application version <new>and skipped the old rows. All 11 registered workflows are subject to the same mechanism.Fix
Pin the application version to a hand-maintained constant (modeled on the existing
LINK_PROTOCOL_VERSIONapparatus), so compatible deploys stop changing it. Recovery now spans deploys; the version moves only on a deliberate bump.apps/mesh/src/dbos/workflow-version.ts—DBOS_WORKFLOW_VERSION = "1"with a bump-rule doc: bump only when a registered workflow's durable step sequence changes incompatibly (add/remove/reorder a step, change a step's recorded I/O); do not bump for logic inside a step, non-workflow code, or comments.apps/mesh/src/dbos/config.ts— a pure, unit-testedbuildDbosConfig()that injectsapplicationVersion: DBOS_WORKFLOW_VERSION, wired intoindex.ts'sDBOS.setConfig(...). The only behavioral change to setConfig is the added field (every other field is byte-identical).DBOS.registerWorkflow(sites (8 files) pointing to the constant, so an edit in any domain surfaces the bump obligation.workflow-source-guard.ts+.snapshot.json+scripts/update-workflow-source-snapshot.ts) — a unit test that auto-discovers workflow source files and fails when any changes, with a re-baseline-or-bump message. Conservative (file-level, over-triggers safely; never silently misses a standard-form registration).The version is global across all 11 workflows by design — DBOS has no per-workflow version, and a global pin makes every workflow deploy-stable, not just thread-gate.
Cutover (one-time)
The first deploy carrying
applicationVersion="1"strands whatever is in-flight on the previous hash version one last time (expected; no"1"executor existed when they started). Clear leftovers via the DBOS cancel procedure already used for the stranded thread-gates, or leave them for a future reaper. After cutover, the version only changes on a deliberate bump.Testing
bun test apps/mesh/src/dbos/→ 11 pass. Covers the constant,buildDbosConfig(incl. field parity +listenQueuespresent/absent), and the guard (pure-comparison fixtures + the real-files snapshot check).fmt/lintclean;checkshows only a pre-existing unrelated AJV error inpackages/mcp-utils.Out of scope
A stranded-workflow reaper/reconciler (the "mop up after stranding" complement) and per-workflow versioning (impossible — the version is global).
🤖 Generated with Claude Code
Summary by cubic
Pins the DBOS application version to a manual constant to stop deploys from stranding in‑flight workflows, adds a guard that forces a version decision when workflow sources change, and logs the effective version on boot for easy verification.
New Features
DBOS_WORKFLOW_VERSION = "1"; bump only when a workflow’s durable step sequence changes.buildDbosConfig()injectsapplicationVersion(all other config fields unchanged) and is now used byDBOS.setConfig(...).DBOS.registerWorkflow(call sites to surface the bump obligation.apps/mesh/scripts/update-workflow-source-snapshot.ts) to detect workflow-source drift; unit tests included.workflow-source-guard.snapshot.jsonafter main’s feat(decopilot): split web research into web_search + deep_research #4134 changed step internals inautomations/dbos-workflow.tsandharnesses/decopilot/background-tool-workflow.ts; recovery-compatible, so no version bump.DBOS.launch(), log the effective application version on boot (expect"1"; a 32‑char hash indicates the pin was bypassed via env/Cloud).knip; guard internals remain module‑private.Migration
"1"will leave prior-version runs stranded; cancel via the existing DBOS cancel procedure.bun apps/mesh/scripts/update-workflow-source-snapshot.ts. If step sequence changes, bump the version first, then re-baseline.DBOS__CLOUD=true, the SDK uses its env version and ignores the pin; for self-hosting here, the pin applies.Written for commit 78cf05b. Summary will update on new commits.