Skip to content

CL-6452: resolve launches from the hub-authored definition, never run-deploy clones - #182

Merged
TheGreatAxios merged 6 commits into
mainfrom
cl-6452-authoritative-defs
Aug 21, 2026
Merged

TheGreatAxios merged 6 commits into
mainfrom
cl-6452-authoritative-defs

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Contributor

Every code-sourced run deploy ensures a same-named workflow_definition sibling over the agent's asset, keyed by its per-run wire hash and frozen with whatever projection was current at that deploy. Launch resolution walked deployed siblings newest-first by NAME, so after an agent's first run the newest run clone's stale snapshot shadowed every hub-authored edit — skill pins and instruction saves never reached any later launch (validated live: 6 fact-checker rows after 5 runs, 3 post-pin invites all launched stale bodies).

The freezer (#179) writes correctly; the resolver's candidate set was the bug, and name-collision resolution was the defect rather than the tiebreak order. This makes the data model say which row is which instead:

  • workflow_definition.origin column ('authored' | 'run', default 'run'): a workbench delta on vendor/intx/db (migration 0086, ledger note in VENDORED.md). Backfill marks the earliest row per (tenant, asset) authored — the hub-authored row always predates any run clone.
  • freezeInertWorkflowDefinition stamps origin: 'authored' in the same transaction as the ensure+stamp; it is the sole writer of launch-authoritative rows (Agents page, template blocks, planner). refreeze keeps updating that row in place. The vendored ensure helper is untouched — run deploys keep minting their per-run frozen deploy records, which no longer masquerade as definitions.
  • Resolution is asset-keyed and origin-filtered: launchInvite and refreshAgentInstanceFromDefinition gather the asset's deployed rows and resolve only authored candidates (authoredDefinitionCandidates, newest-first, first with a projection); an empty authored set raises the existing named DefinitionProjectionMissingError 4xx. refreshAgentInstanceFromDefinition matters because the deploy repoints workflow_run.definitionId at the clone, so the old read-through-the-run path replayed the stale body forever. listInvitableDefinitions drops run clones, so the invite picker shows one row per agent. Name-based sibling matching is gone.

Red→green at the resolver layer: authored row + newer run clone with a stale frozen prompt — launch must carry the post-pin projection; N clones never grow the candidate set (exactly one projection lookup); refresh recomputes from the authored sibling, not the run's clone. DB-gated: the freeze drizzle suite proves the freeze marks authored, a bare per-run ensure mints run, and migration 0086 applies through the full ledger (run green against a scratch Postgres).

Fixes CL-6452

@TheGreatAxios
TheGreatAxios force-pushed the cl-6452-authoritative-defs branch from 2c0ac4d to ade3267 Compare August 21, 2026 04:36
…lones

Every code-sourced run deploy ensures a same-named workflow_definition
sibling over the agent's asset, keyed by its per-run wire hash and
frozen with whatever projection was current at that deploy. Launch
resolution walked deployed siblings newest-first by name, so the newest
run clone's stale snapshot shadowed every hub-authored edit (skill
pins, instruction saves) after an agent's first run.

Make the data model say which row is which: a new workflow_definition
origin column ('authored' | 'run', default 'run') marks hub-authored
definitions at freeze time, backfilled as the earliest row per
(tenant, asset). Launch and refresh resolution now gather the asset's
deployed rows and resolve only authored candidates; the invitable
listing drops run clones; name-based sibling matching is gone.
A definition ensured by a plain code-sourced deploy is a real
definition — the e2e echo agent is deployed exactly that way — so
keying 'authoritative' on which writer minted the row wrongly hid it
from the invite list. Only a folded run mints a per-run record: its
deployed bytes carry per-run values, so the deploy's freeze ensures a
sibling over the agent's asset and repoints the run at it.

Default origin to 'authored' and have deployAtHead mark the row the
deploy actually repointed its run at, so nothing else has to know the
distinction. A deploy that left the run on its original definition
marks nothing, which keeps a mis-set id from ever demoting an agent's
own definition.
@TheGreatAxios
TheGreatAxios force-pushed the cl-6452-authoritative-defs branch from ade3267 to fa05d84 Compare August 21, 2026 04:39
@TheGreatAxios
TheGreatAxios merged commit 9cf575e into main Aug 21, 2026
0 of 2 checks passed
@TheGreatAxios
TheGreatAxios deleted the cl-6452-authoritative-defs branch August 25, 2026 15:29
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