Routines target a workflow asset, resolved at use (CL-7350) - #550
Draft
TheGreatAxios wants to merge 8 commits into
Draft
Routines target a workflow asset, resolved at use (CL-7350)#550TheGreatAxios wants to merge 8 commits into
TheGreatAxios wants to merge 8 commits into
Conversation
TheGreatAxios
force-pushed
the
cl-7350-routine-target
branch
from
September 2, 2026 07:56
9c101ea to
d6a0c26
Compare
…inition at use (CL-7350)
A routine stores definition_asset_id instead of definition_id, following
docs/workflow-model.md: Interchange keys workflow_definition on
(asset_id, wire_hash), so only the asset is stable across redeploys.
- New target.ts: resolveLaunchableDefinition picks the newest deployed,
frozen definition for an asset in a tenant; pickLaunchableDefinition
is the pure ordering rule; routineTargetRejection gives typed
envelopes (not found / not deployed / not approved) for UI and Myra.
- Migration 0006 backfills the asset id from workflow_definition,
deletes routines that cannot resolve (raising a WARNING with the
count, keeping run history), and drops definition_id. Drafts follow
the same rename.
- Routes take definitionAssetId on create (400 when absent, no server
side target search), validate it through resolveTarget, and every read
returns { definitionAssetId, definitionId } with the currently resolved
definition or null. The name-resolution and candidate-listing ports on
the run-authenticated mirror are removed.
- Tests: target ordering unit tests, route contract tests, DB-gated
migration backfill/delete and store round-trip tests.
Hub launcher and scheduler resolve the routine's asset to its newest approved definition at fire time and fail closed via reportError; routines-tools imports wire shapes from @corbits/routines/client; web, chat, hub-client, evals, and e2e callers rename the field.
Several suites still exercised the pre-cutover definitionId shape for agent participants and routine creation, and the chat routes test's fake platform never stubbed resolveDefinitionAssetId, so the hub's GET /workbenches/:id/agents route (which now filters out any participant it can't resolve an asset id for) silently dropped every result.
ensureDefaultRoutines still resolved a workflow_definition row id from the vendored /workflows/definitions listing (which never exposes an asset id) and sent it as POST /routines' definitionAssetId, so every default routine seed failed with routine_target_not_found. It now finds the deployed workflow's asset id the same way ensureWorkflowAsset and ensureDeployment already do: list /assets?kind=workflow, then confirm a live deployment exists for that asset id. Also regenerates tsconfig project references, out of sync since routines-tools dropped a dependency.
TheGreatAxios
force-pushed
the
cl-7350-routine-target
branch
from
September 2, 2026 08:30
d6a0c26 to
5ecb163
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.
Linear: https://linear.app/abklabs/issue/CL-7350
Builds to docs/workflow-model.md (CL-7349): a routine stores its target workflow asset id and resolves the newest deployed, frozen definition at create and (to be wired) at launch.
Status — incomplete, opened early on a budget cut
Done (packages/routines only): schema + migration 0006 (backfill, delete unresolvable, drop definition_id), src/target.ts resolver + typed rejections, routes/workflow-routine-routes/client/store/drafts cutover to definitionAssetId, unit + DB-gated tests. Package typechecks and its 291 tests pass (DB suites skipped locally — Docker/Postgres unavailable).
NOT done (repo-wide typecheck currently fails; pushed with --no-verify):
Resolves CL-7350