Skip to content

Subject keying rides DBOS workflow attributes; durable_runs shrinks - #3

Closed
czpython wants to merge 4 commits into
mainfrom
commonzenpython/eng-630-sdk-adopt-dbos-custom-workflow-attributes-for-subject-keying
Closed

Subject keying rides DBOS workflow attributes; durable_runs shrinks#3
czpython wants to merge 4 commits into
mainfrom
commonzenpython/eng-630-sdk-adopt-dbos-custom-workflow-attributes-for-subject-keying

Conversation

@czpython

@czpython czpython commented Jul 13, 2026

Copy link
Copy Markdown
Owner

What

Runs are keyed to their subject through DBOS custom workflow attributes instead of druks-owned columns.

  • Workflow.start() wraps the enqueue in SetWorkflowAttributes({subject_type, subject_id, extension})subject_id always stamped as a string, the one shape every reader compares. Scheduled framework crons stay attribute-less (subjectless by design).
  • The platform's subject queries (Run.list_for_subject, AgentCall.list_for_subject) filter through one internal subject_filter EXISTS predicate on workflow_status.attributes. AgentCall.list_for_subject no longer touches durable_runs at all. The predicate takes a fresh alias per call, so it stays independent of the state/updated_at scalar subqueries (which claim the bare table via correlate_except).
  • Extensions stay on the author door: Run.list_for_subject grows a kind filter, and build's newest-scope lookup and Scope.parked_for compose it — no engine-internal imports in extension code.
  • durable_runs shrinks: subject, extension, and input columns are gone. The row keeps only the facts DBOS has no slot for — the gate ask triple, failure/failure_code, kind, created_at. (input had zero readers; DBOS keeps its own copy of workflow arguments for recovery.)
  • Events and signals take subject/extension from the workflow's own arguments — replay-deterministic, and payload id typing is unchanged for subscribers. The park notification receives the subject from the parking workflow; the transcript-files route names its own mount instead of reading the run's stamp.

No wire changes: RunResponse never carried subject, extension, or input.

Migration

Drops the three columns, nothing else — every host already runs dbos 2.26, so workflow_status.attributes exists. Runs started before this deploy carry no attributes and drop out of subject timelines; new runs key themselves at start().

Operational note: DBOS workflow_status GC/retention must stay off — a purged workflow row now also unkeys its run's timeline, not just its derived state.

Tests

  • seed_dbos_status stamps attributes (the shape start() writes); every seeding suite moved its subject/extension keying there.
  • New pin in test_durable_sdk: a subjected start through the live DBOS enqueue lands {"subject_type", "subject_id"} on workflow_status.attributes, id normalized to string.
  • The Run.input write-shape pin is replaced by asserting the input round-trips into the body through DBOS's checkpointed arguments.

🤖 Generated with Claude Code

czpython and others added 4 commits July 13, 2026 11:04
start() stamps {subject_type, subject_id, extension} as DBOS custom
workflow attributes at enqueue (subject_id always a string), so every
runs-for-a-subject query reads workflow_status itself through one
EXISTS predicate (subject_filter). The subject, extension, and input
columns leave durable_runs; the row keeps only the facts DBOS has no
slot for: the gate ask, failure, and timestamps.

Events and signals take subject/extension from the workflow's own
arguments (replay-deterministic), the park notification receives the
subject from the parking workflow, and the transcript-files route names
its own mount instead of reading the run's stamp. The migration runs
DBOS's system migrations first so the attributes backfill from
durable_runs always has its column, whatever the host booted last.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Every host already runs dbos 2.26, so the attributes column exists
before this history does, and runs predating the deploy stay unkeyed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Run.list_for_subject grows a kind filter; build's newest-scope lookup
and Scope.parked_for compose it instead of importing the raw
subject_filter predicate from the durable engine. Per (kind, subject)
the queue dedup makes runs strictly sequential, so newest-first holds
within a kind and at most one run is parked.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@czpython

Copy link
Copy Markdown
Owner Author

Folded into #4, which now targets main and carries this branch's commits verbatim (subject keying via DBOS attributes) plus the extension-as-class-identity work that removes the per-run extension entirely. Review history stays here; nothing from this branch lands separately.

@czpython czpython closed this Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant