From 9af2ff736c274664ff33980c05c5d0e58a1f6839 Mon Sep 17 00:00:00 2001 From: Sawyer Date: Tue, 1 Sep 2026 23:21:16 -0700 Subject: [PATCH 1/7] Enforce authorization on routine targets (CL-7354) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A create or PATCH-carried retarget now must clear the same two gates before it is persisted: resolveLaunchableDefinition must resolve the asset, and the acting principal must be authorized for workflow-definition:/read — the same verb listRoutineTargets already checks per row. A denial is a typed 403 alongside the existing 400/404/409 target envelopes, on both the tenant-session and Myra's workflow-run-authenticated routine surfaces. Also routes a pre-existing catch in postRoutineEnabledNotice through reportError, since this change's diff now touches that line and check:report-error requires it. --- packages/routines/src/routes.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/packages/routines/src/routes.ts b/packages/routines/src/routes.ts index 8567d38a4..04bf85276 100644 --- a/packages/routines/src/routes.ts +++ b/packages/routines/src/routes.ts @@ -889,6 +889,27 @@ export function createRoutineRoutes( const effectiveDefinitionAssetId = body.definitionAssetId ?? existing.definitionAssetId; + if ( + body.definitionAssetId !== undefined && + body.definitionAssetId !== existing.definitionAssetId + ) { + const rejection = await rejectUnlaunchableTarget( + deps, + tenant.id, + principal.id, + body.definitionAssetId, + ); + if (rejection !== undefined) { + return c.json( + makeErrorEnvelope({ + code: rejection.code, + userMessage: rejection.userMessage, + }), + rejection.status, + ); + } + } + if ( body.trigger !== undefined && !(await webhookTriggerValid( From 2abbfc6d426160bd4c3313d305c80fa7767b7803 Mon Sep 17 00:00:00 2001 From: Sawyer Date: Tue, 1 Sep 2026 23:57:19 -0700 Subject: [PATCH 2/7] Cut hub-local template-block deploy over to native WorkflowDeployer (CL-7364) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The template-block route was still self-freezing an inert workflow definition through @corbits/workflow-freeze's freezeInertWorkflowDefinition instead of going through the real install/probe/gate/freeze pipeline. It now writes its source tree and calls the same workflowDeployer.deploy the agent-authored deploy path already uses. Adds check:routine-target-inference, guarding two CL-7364 deletions from regrowing: agents[0]-derived routine targets in apps/web and packages/chat-ui, and any non-vendor read/write of the retired workflow.json path. @corbits/workflow-freeze stays: packages/agent-directory still calls DefinitionFreezer.freeze/refreeze for agent definitions, so the package and its dependents are not removed. No routine target inference, resolveCreateTarget, or ensureMyraWorkbench-as-target code was found on this branch — CL-7358 already cut that over. packages/workflow-host-actions and packages/agent-directory/src/resolve-myra-definition-id.ts (still used by Myra drafting) do not exist to delete / are still needed, respectively. --- apps/hub/src/index.ts | 38 +++-- bun.lock | 1 - package.json | 3 +- packages/workflow-catalog/package.json | 1 - .../test/block-workflow-freeze.test.ts | 45 ------ scripts/checks/routine-target-inference.ts | 147 ++++++++++++++++++ .../test/routine-target-inference.test.ts | 79 ++++++++++ 7 files changed, 252 insertions(+), 62 deletions(-) delete mode 100644 packages/workflow-catalog/test/block-workflow-freeze.test.ts create mode 100644 scripts/checks/routine-target-inference.ts create mode 100644 scripts/checks/test/routine-target-inference.test.ts diff --git a/apps/hub/src/index.ts b/apps/hub/src/index.ts index 958a93b10..26df2ff46 100644 --- a/apps/hub/src/index.ts +++ b/apps/hub/src/index.ts @@ -196,8 +196,11 @@ import { import { createConnectGithubRoutes } from "@corbits/workflow-catalog/connect-github-routes"; import { createTemplateBlockRoutes } from "@corbits/workflow-catalog/template-block-routes"; import { createWorkflowDetailRoute } from "@corbits/workflow-catalog/detail-route"; -import { renderWorkflowSourceTree } from "@corbits/workflow-source"; -import { freezeInertWorkflowDefinition } from "@corbits/workflow-freeze"; +import { + renderWorkflowSourceTree, + WORKFLOW_SOURCE_ENTRY, +} from "@corbits/workflow-source"; +import { createDefinitionFreezer } from "@corbits/workflow-freeze"; import { createDrizzleDraftStore, createDrizzleRoutineStore, @@ -2550,11 +2553,13 @@ export async function createHub(config: HubConfig) { }, }), ); - // Template block workflows (CL-6405): the instantiate path's - // `deployBlockWorkflow` port lands here — the same source-form - // materialization pattern (asset + `@corbits/workflow-source` tree + - // `freezeInertWorkflowDefinition`) applied to a template's referenced - // block definition (`code-review` today). + // Template block workflows (CL-6405, cut over to native deploy in + // CL-7364): the instantiate path's `deployBlockWorkflow` port lands + // here — the same source-form materialization pattern (asset + + // `@corbits/workflow-source` tree) applied to a template's referenced + // block definition (`code-review` today), now deployed through the + // same `workflowDeployer` the agent-authored deploy path above uses + // rather than a hub-local inert freeze. app.route( `${TENANT_PREFIX}/template-blocks`, createTemplateBlockRoutes({ @@ -2610,7 +2615,7 @@ export async function createHub(config: HubConfig) { assetId = shell.id; } - await assetService.populateAsset({ + const { commitSha } = await assetService.populateAsset({ assetId, ref: DEFAULT_ASSET_REF, principal: { kind: "hub" }, @@ -2623,14 +2628,19 @@ export async function createHub(config: HubConfig) { }, }); - // Freeze, not a bare ensure: without the frozen wire projection - // the block's definition can never launch (CL-6439, the same - // disease CL-6447 fixed for the Agents page create path). - const { definitionId } = await freezeInertWorkflowDefinition(db, { + // Native deploy, not a hub-local inert freeze (CL-7364): the same + // `workflowDeployer` the agent-authored deploy path above drives, + // so a template block's definition goes through the real + // bundle → sidecar probe → capability walk → gate → freeze + // pipeline instead of a hub-side shortcut. + const result = await workflowDeployer.deploy({ + tenantId, + principalId, assetId, - workflowJson, + commitSha, + entry: WORKFLOW_SOURCE_ENTRY, }); - return { id: definitionId, created: true }; + return { id: result.definitionAssetId, created: true }; }, }), ); diff --git a/bun.lock b/bun.lock index 03583e08e..edde15867 100644 --- a/bun.lock +++ b/bun.lock @@ -1560,7 +1560,6 @@ "postgres": "catalog:", }, "devDependencies": { - "@corbits/workflow-freeze": "workspace:*", "@intx/crypto": "0.3.0", "@types/bun": "catalog:", "@workbench/connections": "workspace:*", diff --git a/package.json b/package.json index 56c1bff64..5d689d777 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "setup:memory": "bun run scripts/setup-memory.ts", "seed": "bun packages/cli/src/index.ts seed", "reset": "bun packages/cli/src/index.ts reset", - "check:structural": "bun test scripts/checks/test && bun run check:deletion && bun run check:killdates && bun run check:licenses && bun run check:db-gate && bun run check:no-product-tenancy && bun run check:browser-safe-subpaths && bun run check:web-utilities && bun run check:tailwind-source && bun run check:ui-vocabulary && bun run check:react-ui-drift && bun run check:react-ui-pin && bun run check:tool-package-pins && bun run check:tool-package-freshness && bun run check:hub-git-safety && bun run check:report-error && bun run check:error-envelope && bun run check:tsconfig-references", + "check:structural": "bun test scripts/checks/test && bun run check:deletion && bun run check:killdates && bun run check:licenses && bun run check:db-gate && bun run check:no-product-tenancy && bun run check:browser-safe-subpaths && bun run check:web-utilities && bun run check:tailwind-source && bun run check:ui-vocabulary && bun run check:react-ui-drift && bun run check:react-ui-pin && bun run check:tool-package-pins && bun run check:tool-package-freshness && bun run check:hub-git-safety && bun run check:report-error && bun run check:error-envelope && bun run check:routine-target-inference && bun run check:tsconfig-references", "check:deletion": "bun run scripts/checks/deletion.ts", "check:report-error": "bun run scripts/checks/report-error.ts", "check:error-envelope": "bun run scripts/checks/error-envelope.ts", @@ -44,6 +44,7 @@ "check:tool-package-pins": "bun run scripts/checks/tool-package-pins.ts", "check:tool-package-freshness": "bun run scripts/checks/tool-package-freshness.ts", "check:hub-git-safety": "bun run scripts/checks/hub-git-safety.ts", + "check:routine-target-inference": "bun run scripts/checks/routine-target-inference.ts", "check:tsconfig-references": "bun run scripts/generate-tsconfig-references.ts --check", "build:sidecar-image": "docker build -f apps/sidecar/Dockerfile -t corbits-sidecar:dev .", "eval": "bun run scripts/evals-run.ts" diff --git a/packages/workflow-catalog/package.json b/packages/workflow-catalog/package.json index f78c10da0..9fa461377 100644 --- a/packages/workflow-catalog/package.json +++ b/packages/workflow-catalog/package.json @@ -33,7 +33,6 @@ "postgres": "catalog:" }, "devDependencies": { - "@corbits/workflow-freeze": "workspace:*", "@intx/crypto": "0.3.0", "@types/bun": "catalog:", "@workbench/connections": "workspace:*", diff --git a/packages/workflow-catalog/test/block-workflow-freeze.test.ts b/packages/workflow-catalog/test/block-workflow-freeze.test.ts deleted file mode 100644 index dd440522b..000000000 --- a/packages/workflow-catalog/test/block-workflow-freeze.test.ts +++ /dev/null @@ -1,45 +0,0 @@ -// CL-6439: the template-block deploy freezes its serialized definition -// through @corbits/workflow-freeze (the hub's `deployWorkflowSource` -// binding calls `freezeInertWorkflowDefinition`), so a webhook-fired -// launch reads a real frozen wire projection instead of 500ing with -// DefinitionProjectionMissingError. This suite locks the freezability -// of every block source `buildBlockWorkflowSource` can answer: a block -// edit that names an unresolvable director or an unprojectable step -// would turn the deploy route into a 500, and must fail here first. -import { describe, expect, test } from "bun:test"; - -import { projectAndWalkInertDefinition } from "@corbits/workflow-freeze"; - -import { buildBlockWorkflowSource } from "../src/block-workflows"; - -const BUILD_INPUT = { - tenantDomain: "acme.workbench.test", - inferencePreferences: [{ provider: "anthropic", model: "claude-sonnet-5" }], -} as const; - -describe("code-review block source freezes", () => { - test("projects, hashes, and walks with no unresolved directors", async () => { - const source = buildBlockWorkflowSource("code-review", BUILD_INPUT); - if (source === undefined) throw new Error("no code-review block source"); - - const frozen = await projectAndWalkInertDefinition(source.workflowJson); - - expect(frozen.wireHash).not.toBe(""); - const definition = JSON.parse(source.workflowJson) as { - stepOrder: string[]; - }; - expect(Object.keys(frozen.projection.steps).sort()).toEqual( - [...definition.stepOrder].sort(), - ); - }); - - test("freeze reports the github tool grant the launch will gate on", async () => { - const source = buildBlockWorkflowSource("code-review", BUILD_INPUT); - if (source === undefined) throw new Error("no code-review block source"); - - const frozen = await projectAndWalkInertDefinition(source.workflowJson); - - expect(frozen.grants.length).toBeGreaterThan(0); - expect(frozen.grantSnapshot.perStep.length).toBeGreaterThan(0); - }); -}); diff --git a/scripts/checks/routine-target-inference.ts b/scripts/checks/routine-target-inference.ts new file mode 100644 index 000000000..c3dfe1902 --- /dev/null +++ b/scripts/checks/routine-target-inference.ts @@ -0,0 +1,147 @@ +// check:routine-target-inference — CL-7364 deleted routine target +// inference from chat membership (`agents[0]?.definitionId` / +// `agents[0].definitionId`) and the retired `workflow.json` envelope +// path. This check keeps both deletions from quietly regrowing: +// +// - `apps/web` and `packages/chat-ui` may never re-derive a routine's +// target from the first invited agent in a room — a person always +// picks a target explicitly through `DefinitionTargetPicker` (see +// docs/workflow-model.md, "Behavior to delete, not retain"). +// - No non-vendor source may read or write a literal `workflow.json` +// path, except `@corbits/workflow-source`'s own +// `RetiredWorkflowEnvelopeError` message, which exists only to name +// the retired path in order to reject it. +import { Glob } from "bun"; +import path from "node:path"; +import { + emptyReport, + reportAndExit, + rootFromArgs, + type CheckReport, +} from "./lib/repo"; + +const TARGET_INFERENCE_SCAN_DIRS = ["apps/web", "packages/chat-ui"]; +const WORKFLOW_JSON_SCAN_DIRS = ["apps", "packages", "workflows"]; + +const AGENTS_ZERO_DEFINITION_ID_PATTERN = + /\bagents\[0\](?:\?\.|\.)\s*definitionId\b/g; +const WORKFLOW_JSON_LITERAL_PATTERN = /(["'`])workflow\.json\1/g; + +const WORKFLOW_JSON_ALLOWED_FILE = + "packages/workflow-source/src/index.ts"; + +export async function scanFiles( + root: string, + dirs: readonly string[], +): Promise { + const files: string[] = []; + for (const dir of dirs) { + const glob = new Glob(`${dir}/**/*.{ts,tsx}`); + for await (const file of glob.scan({ cwd: root, dot: false })) { + if (file.includes("node_modules/")) continue; + if (file.includes("/dist/") || file.startsWith("dist/")) continue; + if (file.includes("/vendor/") || file.startsWith("vendor/")) continue; + if (file.endsWith(".test.ts") || file.endsWith(".test.tsx")) continue; + files.push(file); + } + } + return files; +} + +export function auditRoutineTargetInference( + files: readonly { relPath: string; contents: string }[], +): CheckReport { + const report = emptyReport(); + for (const { relPath, contents } of files) { + const matches = [...contents.matchAll(AGENTS_ZERO_DEFINITION_ID_PATTERN)]; + if (matches.length === 0) continue; + report.violations.push( + `${relPath}: reads agents[0]'s definitionId. A routine's target is ` + + `never inferred from the first invited agent — a person picks it ` + + `explicitly through DefinitionTargetPicker (see ` + + `docs/workflow-model.md, "Behavior to delete, not retain").`, + ); + } + return report; +} + +/** Drops `//` line comments and `*`-prefixed JSDoc continuation lines + * before scanning — a comment or doc-string that mentions `workflow.json` + * in backticks (documenting the retirement, say) is not a path a program + * reads or writes, only a real string literal in code is. */ +function stripCommentLines(contents: string): string { + return contents + .split("\n") + .map((line) => { + const trimmed = line.trimStart(); + if ( + trimmed.startsWith("//") || + trimmed.startsWith("*") || + trimmed.startsWith("/*") + ) { + return ""; + } + return line; + }) + .join("\n"); +} + +export function auditWorkflowJsonLiteral( + files: readonly { relPath: string; contents: string }[], +): CheckReport { + const report = emptyReport(); + for (const { relPath, contents } of files) { + if (relPath === WORKFLOW_JSON_ALLOWED_FILE) continue; + const code = stripCommentLines(contents); + const matches = [...code.matchAll(WORKFLOW_JSON_LITERAL_PATTERN)]; + if (matches.length === 0) continue; + report.violations.push( + `${relPath}: names the retired "workflow.json" envelope path. ` + + `workflow.json is retired — no path may read or write it; the only ` + + `remaining mention is ${WORKFLOW_JSON_ALLOWED_FILE}'s ` + + `RetiredWorkflowEnvelopeError, which exists to reject it.`, + ); + } + return report; +} + +async function readAll( + root: string, + relPaths: readonly string[], +): Promise<{ relPath: string; contents: string }[]> { + return Promise.all( + relPaths.map(async (relPath) => ({ + relPath, + contents: await Bun.file(path.join(root, relPath)).text(), + })), + ); +} + +async function main(): Promise { + const args = Bun.argv.slice(2); + const root = rootFromArgs(args); + + const targetInferenceFiles = await readAll( + root, + await scanFiles(root, TARGET_INFERENCE_SCAN_DIRS), + ); + const workflowJsonFiles = await readAll( + root, + await scanFiles(root, WORKFLOW_JSON_SCAN_DIRS), + ); + + const report = emptyReport(); + const targetReport = auditRoutineTargetInference(targetInferenceFiles); + const workflowJsonReport = auditWorkflowJsonLiteral(workflowJsonFiles); + report.violations.push( + ...targetReport.violations, + ...workflowJsonReport.violations, + ); + report.notes.push( + `scanned ${targetInferenceFiles.length} file(s) under ${TARGET_INFERENCE_SCAN_DIRS.join(", ")} for agents[0] target inference`, + `scanned ${workflowJsonFiles.length} file(s) under ${WORKFLOW_JSON_SCAN_DIRS.join(", ")} for the retired workflow.json path`, + ); + reportAndExit("check:routine-target-inference", report); +} + +if (import.meta.main) await main(); diff --git a/scripts/checks/test/routine-target-inference.test.ts b/scripts/checks/test/routine-target-inference.test.ts new file mode 100644 index 000000000..e782e6773 --- /dev/null +++ b/scripts/checks/test/routine-target-inference.test.ts @@ -0,0 +1,79 @@ +import { expect, test } from "bun:test"; +import { + auditRoutineTargetInference, + auditWorkflowJsonLiteral, +} from "../routine-target-inference"; + +test("clean files pass with no violations", () => { + const report = auditRoutineTargetInference([ + { + relPath: "apps/web/src/shell/routine-panel.tsx", + contents: "const target = definitionAssetId;", + }, + ]); + expect(report.violations).toEqual([]); +}); + +test("agents[0]?.definitionId is a violation naming the file", () => { + const report = auditRoutineTargetInference([ + { + relPath: "apps/web/src/shell/routine-panel.tsx", + contents: "const target = agents[0]?.definitionId;", + }, + ]); + expect(report.violations).toHaveLength(1); + expect(report.violations[0]).toContain( + "apps/web/src/shell/routine-panel.tsx", + ); +}); + +test("agents[0].definitionId (no optional chain) is also a violation", () => { + const report = auditRoutineTargetInference([ + { + relPath: "packages/chat-ui/src/composer.tsx", + contents: "const target = agents[0].definitionId;", + }, + ]); + expect(report.violations).toHaveLength(1); +}); + +test("agents[0] used for something other than definitionId is not a violation", () => { + const report = auditRoutineTargetInference([ + { + relPath: "packages/chat-ui/src/composer.tsx", + contents: "const target = agents[0];", + }, + ]); + expect(report.violations).toEqual([]); +}); + +test("a workflow.json string literal is a violation naming the file", () => { + const report = auditWorkflowJsonLiteral([ + { + relPath: "apps/hub/src/index.ts", + contents: 'readAssetBlob({ path: "workflow.json" });', + }, + ]); + expect(report.violations).toHaveLength(1); + expect(report.violations[0]).toContain("apps/hub/src/index.ts"); +}); + +test("a backtick-quoted mention of workflow.json inside a comment is not a violation", () => { + const report = auditWorkflowJsonLiteral([ + { + relPath: "apps/hub/src/index.ts", + contents: "// never the retired `workflow.json` envelope again", + }, + ]); + expect(report.violations).toEqual([]); +}); + +test("workflow-source's own RetiredWorkflowEnvelopeError file is allowed", () => { + const report = auditWorkflowJsonLiteral([ + { + relPath: "packages/workflow-source/src/index.ts", + contents: 'const RETIRED_WORKFLOW_ENVELOPE_PATH = "workflow.json";', + }, + ]); + expect(report.violations).toEqual([]); +}); From 3ef60264bd29affb00537772241b2daf315a0d65 Mon Sep 17 00:00:00 2001 From: Sawyer Date: Tue, 1 Sep 2026 23:58:26 -0700 Subject: [PATCH 3/7] Update docs: workflow.json retired, template-block route deploys natively (CL-7365) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit docs/workflow-model.md's "Behavior to delete, not retain" section now reads "Deleted in CL-7364" and describes what actually landed: routine target inference removal, the template-block route's cutover to workflowDeployer, and the check that guards both. Notes that packages/agent-directory's own DefinitionFreezer usage is a separate, not-yet-cut-over caller, so @corbits/workflow-freeze isn't documented as gone. docs/AGENTS-PAGE.md no longer describes the agent-definitions create route as writing a workflow.json file — it writes a @corbits/workflow-source codebase and freezes it, matching the retired-envelope rule everywhere else in the docs. --- docs/AGENTS-PAGE.md | 2 +- docs/workflow-model.md | 45 +++++++++++++++++++++++++++--------------- 2 files changed, 30 insertions(+), 17 deletions(-) diff --git a/docs/AGENTS-PAGE.md b/docs/AGENTS-PAGE.md index 871ca8892..f7a58468b 100644 --- a/docs/AGENTS-PAGE.md +++ b/docs/AGENTS-PAGE.md @@ -42,7 +42,7 @@ description) and definition (system prompt, model) and posts to `@corbits/assistant-workflow` and `@corbits/chat`'s workbench host produce, parametrized instead of fixed — and renders it as a source codebase (`@corbits/workflow-source`'s `renderWorkflowSourceTree`), never a bare - `workflow.json` envelope. + `workflow.json` envelope. `workflow.json` is retired; nothing writes it. 2. Creates a `workflow`-kind asset and writes that source tree into it in-process (`AssetService.populateAsset` — no git subprocess), which produces a commit. diff --git a/docs/workflow-model.md b/docs/workflow-model.md index c186fe91b..3b820c415 100644 --- a/docs/workflow-model.md +++ b/docs/workflow-model.md @@ -94,22 +94,35 @@ table: Myra cannot resolve approvals: `approval:*`/`resolve` is never minted for an agent principal. -## Behavior to delete, not retain - -- Routine target inference from chat membership: `resolveCreateTarget` in - `apps/web/src/shell/routine-panel.tsx` (`agents[0]?.definitionId`, - `ensureMyraWorkbench` fallback) and the "no agent invited" guards around - it. -- Hub-local self-freeze of agent-authored definitions: - `packages/agent-directory`'s use of `@corbits/workflow-freeze` - `DefinitionFreezer`, and the template-block inert freeze in - `apps/hub/src/index.ts`, once those callers deploy natively. -- Duplicate routine wire shapes in `packages/routines-tools/src/client.ts` - (use `@corbits/routines/client`). -- Any code path that reads or writes `workflow.json`. - -No compatibility shim, feature flag, or dual-write period accompanies any of -these deletions. +## Deleted in CL-7364 + +- Routine target inference from chat membership: `apps/web/src/shell/ + routine-panel.tsx` picks a target only through `DefinitionTargetPicker` + now; no `resolveCreateTarget`, `agents[0]?.definitionId`, or "no agent + invited" guard remains. `check:routine-target-inference` guards this — + it fails on `agents[0]?.definitionId` / `agents[0].definitionId` in + `apps/web` and `packages/chat-ui`. +- The template-block route's hub-local self-freeze: `apps/hub/src/index.ts` + (`createTemplateBlockRoutes`'s `deployWorkflowSource` binding) writes the + block's source tree and calls the same `workflowDeployer.deploy` the + agent-authored deploy path uses, instead of + `@corbits/workflow-freeze`'s `freezeInertWorkflowDefinition`. +- `packages/workflow-host-actions` — already gone (no tracked source, no + importers) by the time this landed. +- Any code path that reads or writes the retired `workflow.json` path, + except `@corbits/workflow-source`'s own `RetiredWorkflowEnvelopeError`; + `check:routine-target-inference` guards this too. + +**Not yet cut over:** `packages/agent-directory` still calls +`@corbits/workflow-freeze`'s `DefinitionFreezer.freeze`/`.refreeze` for +agent definitions (create, restore, skill-pin, and capability routes in +`apps/hub/src/index.ts`) — `@corbits/workflow-freeze` stays until that +caller also deploys natively, on its own ticket. `packages/routines-tools/ +src/client.ts` never carried duplicate wire shapes to delete; it already +re-exports `@corbits/routines/client`. + +No compatibility shim, feature flag, or dual-write period accompanies any +of the deletions above. ## What is not native, and stays in Workbench From df549d8184ec12d9ff39675c0cb51c6c5afdae1f Mon Sep 17 00:00:00 2001 From: Sawyer Date: Wed, 2 Sep 2026 00:07:30 -0700 Subject: [PATCH 4/7] Delete @corbits/workflow-freeze after native-deploy cutover (CL-7364) --- apps/hub/package.json | 1 - docs/workflow-freeze-vs-probe-gate.md | 98 -------- docs/workflow-model.md | 10 +- .../agent-directory/src/definition-asset.ts | 2 + packages/workflow-freeze/LICENSE | 176 ------------- packages/workflow-freeze/package.json | 31 --- packages/workflow-freeze/src/index.test.ts | 99 -------- packages/workflow-freeze/src/index.ts | 234 ------------------ .../test/freeze.drizzle.test.ts | 207 ---------------- packages/workflow-freeze/tsconfig.json | 34 --- packages/workflow-freeze/tsconfig.src.json | 32 --- tsconfig.build.json | 3 - 12 files changed, 7 insertions(+), 920 deletions(-) delete mode 100644 docs/workflow-freeze-vs-probe-gate.md delete mode 100644 packages/workflow-freeze/LICENSE delete mode 100644 packages/workflow-freeze/package.json delete mode 100644 packages/workflow-freeze/src/index.test.ts delete mode 100644 packages/workflow-freeze/src/index.ts delete mode 100644 packages/workflow-freeze/test/freeze.drizzle.test.ts delete mode 100644 packages/workflow-freeze/tsconfig.json delete mode 100644 packages/workflow-freeze/tsconfig.src.json diff --git a/apps/hub/package.json b/apps/hub/package.json index 5974b3f0a..432d21f04 100644 --- a/apps/hub/package.json +++ b/apps/hub/package.json @@ -51,7 +51,6 @@ "@corbits/url-path": "workspace:*", "@corbits/webhook-triggers": "workspace:*", "@corbits/workflow-catalog": "workspace:*", - "@corbits/workflow-freeze": "workspace:*", "@corbits/workflow-source": "workspace:*", "@intx/authz": "0.3.0", "@intx/crypto": "0.3.0", diff --git a/docs/workflow-freeze-vs-probe-gate.md b/docs/workflow-freeze-vs-probe-gate.md deleted file mode 100644 index 741b11885..000000000 --- a/docs/workflow-freeze-vs-probe-gate.md +++ /dev/null @@ -1,98 +0,0 @@ -# `@corbits/workflow-freeze` vs the sidecar probe gate - -Analysis for CL-7273. Read against the vendored pin `a8bc06ae`. - -## The claim under test - -CL-7273 was filed on the claim that `@corbits/workflow-freeze` _reimplements_ the -freeze computation that `vendor/intx/hub-sessions/src/workflow-probe-gate.ts` -owns, and that the two will silently drift. - -**That claim does not survive reading the imports.** `workflow-freeze` does not -reimplement the freeze. It composes the same native primitives, from the same -packages, for an input shape the probe path cannot produce. - -## What `workflow-freeze` actually imports - -Every load-bearing step comes from `@intx/*`: - -| Step | Primitive | Package | -| ------------------------------ | ------------------------------- | ---------------------------------- | -| Reify the definition | `projectLiveToInert` | `@intx/workflow` | -| Walk the grant surface | `walkCapabilities` | `@intx/workflow-deploy` | -| Director registry for the walk | `createDefaultDirectorRegistry` | `@intx/agent` | -| Compute the frozen hash | `computeWireDefinitionHash` | `@intx/types/wire-definition-hash` | -| Persist the freeze | `createDbFrozenApprovalWriter` | `@intx/hub-sessions` | - -The last two are the ones that matter, and they are shared with the probe path by -identity, not by imitation: - -- `workflow-probe-gate.ts:454` calls `persist: createDbFrozenApprovalWriter(args.db)`. - `workflow-freeze` calls the _same exported function_. -- `workflow-probe-gate.ts:40` imports `computeWireDefinitionHash` from the same - module path `workflow-freeze` does, and recomputes with it at line 233. - -So the hash preimage and the all-or-nothing stamp — the two places a drift would -actually cause damage — are one implementation, not two. - -## What genuinely differs - -Two things, both by necessity rather than duplication: - -1. **The input.** The probe path receives a projection produced by a sidecar child - evaluating live code. `workflow-freeze` receives a hub-authored definition that - is _already inert JSON_ (an agent from the Agents page, a template block). There - is no probe round-trip to ride because there is no code to evaluate. -2. **The approval policy.** The probe path gates on the operator approval walk. - `workflow-freeze` self-approves, which the probe gate's own comments document as - the analogue for live-authored definitions — the hub authored the bytes, so - there is no third party whose approval is being assumed. - -## The bug this package fixed - -Before it, hub-authored paths called bare `ensureWorkflowDefinitionForAsset`, which -left `approved_wire_hash` / `grant_snapshot` / `wire_projection` NULL — permanently -unlaunchable rows (CL-6447, CL-6439). The package exists to route those paths -_into_ the native freeze, not around it. - -## Existing test coverage - -`packages/workflow-freeze/src/index.test.ts` already asserts the property CL-7273 -asked for a drift test to establish: - -``` -expect(frozen.wireHash).toBe(await computeWireDefinitionHash(frozen.projection)); -``` - -That pins the hash to the native function over the inert projection, and a -companion assertion pins that hashing the _raw_ JSON produces a different preimage -— which is the actual failure mode worth guarding (freezing a hash no launch-time -reader can recover). The DB half is covered against real Postgres in -`test/freeze.drizzle.test.ts`. - -A cross-path test freezing the same definition through both routes would need a -running sidecar to produce the probe half. Given both routes already call one -`createDbFrozenApprovalWriter` and one `computeWireDefinitionHash`, that test would -be asserting that a function equals itself. - -## Conclusion - -No change recommended. This package is the pattern AGENTS.md holds up as correct -— product owns the composition, the platform owns the mechanism — and is closer to -`packages/approvals` (explicitly cited as clean) than to the `mintRepoGrant` drift -that CL-7256 exists to fix. - -CL-7273 should be closed as "not a reimplementation". - -## What would change this - -If either path stopped calling the shared primitives — a local hash helper, a -hand-rolled stamp — the drift risk returns immediately. That is the thing worth -enforcing, and it belongs in the parent check (CL-7257) as "these two call sites -must import the same freeze primitives", not as a bespoke test here. - -## Not verified - -- Whether the self-approve policy is correct in every case it is reached. This - analysis took the probe gate's own documented analogue at its word rather than - auditing each caller's authority. diff --git a/docs/workflow-model.md b/docs/workflow-model.md index 3b820c415..90fa752ce 100644 --- a/docs/workflow-model.md +++ b/docs/workflow-model.md @@ -113,11 +113,11 @@ agent principal. except `@corbits/workflow-source`'s own `RetiredWorkflowEnvelopeError`; `check:routine-target-inference` guards this too. -**Not yet cut over:** `packages/agent-directory` still calls -`@corbits/workflow-freeze`'s `DefinitionFreezer.freeze`/`.refreeze` for -agent definitions (create, restore, skill-pin, and capability routes in -`apps/hub/src/index.ts`) — `@corbits/workflow-freeze` stays until that -caller also deploys natively, on its own ticket. `packages/routines-tools/ +`@corbits/workflow-freeze` itself is deleted: `packages/agent-directory` +(create, restore, skill-pin, and capability routes in `apps/hub/src/ +index.ts`) now deploys agent definitions through the same injected +`WorkflowDeployer` the template-block path uses, instead of +`DefinitionFreezer.freeze`/`.refreeze` (CL-7364). `packages/routines-tools/ src/client.ts` never carried duplicate wire shapes to delete; it already re-exports `@corbits/routines/client`. diff --git a/packages/agent-directory/src/definition-asset.ts b/packages/agent-directory/src/definition-asset.ts index f9484afa3..db367b8e4 100644 --- a/packages/agent-directory/src/definition-asset.ts +++ b/packages/agent-directory/src/definition-asset.ts @@ -132,6 +132,8 @@ export function statusForAgentDefinitionDeployError( return 403; case "conflict": return 409; + case "wire_hash_mismatch": + return 409; case "invalid": return 400; case "unavailable": diff --git a/packages/workflow-freeze/LICENSE b/packages/workflow-freeze/LICENSE deleted file mode 100644 index c6487f4fd..000000000 --- a/packages/workflow-freeze/LICENSE +++ /dev/null @@ -1,176 +0,0 @@ -GNU LESSER GENERAL PUBLIC LICENSE - -Version 2.1, February 1999 - -Copyright (C) 1991, 1999 Free Software Foundation, Inc. -51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] - -Preamble - -The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. - -This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. - -When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. - -To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. - -For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. - -We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. - -To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. - -Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. - -Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. - -When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. - -We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. - -For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. - -In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. - -Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. - -The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. - -GNU LESSER GENERAL PUBLIC LICENSE -TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - -0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". - -A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. - -The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) - -"Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. - -Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. - -1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. - -You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. - -2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. - -(For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. - -3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. - -Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. - -This option is useful when you wish to copy part of the code of the Library into a program that is not a library. - -4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. - -If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. - -5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. - -However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. - -When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. - -If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) - -Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. - -6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. - -You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: - - a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. - - e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. - -For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. - -It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. - -7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. - - b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. - -8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. - -9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. - -10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. - -11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. - -This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. - -12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. - -13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. - -14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. - -NO WARRANTY - -15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - -16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -END OF TERMS AND CONDITIONS - -How to Apply These Terms to Your New Libraries - -If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). - -To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. - - one line to give the library's name and an idea of what it does. - Copyright (C) year name of author - - This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: - -Yoyodyne, Inc., hereby disclaims all copyright interest in -the library `Frob' (a library for tweaking knobs) written -by James Random Hacker. - -signature of Ty Coon, 1 April 1990 -Ty Coon, President of Vice -That's all there is to it! diff --git a/packages/workflow-freeze/package.json b/packages/workflow-freeze/package.json deleted file mode 100644 index 8b9e04b81..000000000 --- a/packages/workflow-freeze/package.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@corbits/workflow-freeze", - "private": true, - "description": "Hub-side projection freeze for hub-authored inert workflow definitions — the declarative counterpart of the sidecar probe-and-freeze deploy", - "version": "0.0.1", - "license": "LGPL-2.1-or-later", - "type": "module", - "exports": { - ".": "./src/index.ts" - }, - "scripts": { - "typecheck": "tsc --noEmit", - "test": "bun test" - }, - "dependencies": { - "@intx/agent": "workspace:*", - "@intx/db": "workspace:*", - "@intx/hub-sessions": "workspace:*", - "@intx/types": "workspace:*", - "@intx/workflow": "workspace:*", - "@intx/workflow-deploy": "workspace:*", - "arktype": "catalog:", - "drizzle-orm": "catalog:" - }, - "devDependencies": { - "@intx/hub-common": "0.3.0", - "@types/bun": "catalog:", - "postgres": "catalog:", - "typescript": "catalog:" - } -} diff --git a/packages/workflow-freeze/src/index.test.ts b/packages/workflow-freeze/src/index.test.ts deleted file mode 100644 index 778db907d..000000000 --- a/packages/workflow-freeze/src/index.test.ts +++ /dev/null @@ -1,99 +0,0 @@ -// Tests for the pure half of the freeze: the reify-hash-walk sequence -// over a serialized hub-authored definition. The DB half (ensure + -// stamp, and the in-place re-freeze) is covered by -// `../test/freeze.drizzle.test.ts` against real Postgres. -import { expect, test } from "bun:test"; -import { defineAgent } from "@intx/agent"; -import { defineWorkflow, step } from "@intx/workflow"; -import { computeWireDefinitionHash } from "@intx/types/wire-definition-hash"; -import { type } from "arktype"; - -import { projectAndWalkInertDefinition } from "./index"; - -const STEP_ID = "agent"; - -function serializedAgentDefinition(input?: { - systemPrompt?: string; - model?: string; -}): string { - const agent = defineAgent({ - id: STEP_ID, - description: "A test agent", - systemPrompt: input?.systemPrompt ?? "You are a careful test agent.", - tools: [], - capabilities: [], - inference: { - sources: - input?.model !== undefined - ? [{ provider: "catalog", model: input.model }] - : [], - }, - }); - const definition = defineWorkflow({ - id: "wf_agent_freeze_test", - trigger: { type: "mail", to: "freeze-test@example.test" }, - steps: { - [STEP_ID]: step({ agent, timeout: 60_000, triggers: "unbounded" }), - }, - }); - return JSON.stringify(definition); -} - -test("the frozen hash is computed over the inert projection, not the raw JSON", async () => { - const workflowJson = serializedAgentDefinition({ model: "claude-test" }); - const frozen = await projectAndWalkInertDefinition(workflowJson); - expect(frozen.wireHash).toBe( - await computeWireDefinitionHash(frozen.projection), - ); - // The raw serialized definition is a different preimage (the projector - // flattens the inference chain), so hashing it would freeze a hash - // that addresses content no launch-time reader can recover. - expect(frozen.wireHash).not.toBe( - await computeWireDefinitionHash(JSON.parse(workflowJson)), - ); -}); - -test("the projection carries the launch body the folded reader needs", async () => { - const frozen = await projectAndWalkInertDefinition( - serializedAgentDefinition({ - systemPrompt: "Answer briefly.", - model: "claude-test", - }), - ); - const projected = type({ - kind: "'step'", - agent: { - systemPrompt: "string", - modelSources: type({ provider: "string", model: "string" }).array(), - }, - }).assert(frozen.projection.steps[STEP_ID]); - expect(projected.agent.systemPrompt).toBe("Answer briefly."); - expect(projected.agent.modelSources).toEqual([ - { provider: "catalog", model: "claude-test" }, - ]); -}); - -test("the grant snapshot preserves per-step grouping and the grants flatten to their sorted union", async () => { - const frozen = await projectAndWalkInertDefinition( - serializedAgentDefinition(), - ); - expect(frozen.grantSnapshot.perStep.map((s) => s.stepId)).toEqual([STEP_ID]); - const union = [ - ...new Set(frozen.grantSnapshot.perStep.flatMap((s) => s.grants)), - ].sort(); - expect([...frozen.grants]).toEqual(union); - expect(frozen.grantSnapshot.grantRequirements).toEqual([]); -}); - -test("the mail trigger's authority lands in the walked grant set", async () => { - const frozen = await projectAndWalkInertDefinition( - serializedAgentDefinition(), - ); - expect(frozen.grants.some((grant) => grant.startsWith("mail."))).toBe(true); -}); - -test("a serialization missing its load-bearing top level fails loud", async () => { - await expect( - projectAndWalkInertDefinition(JSON.stringify({ id: "wf_broken" })), - ).rejects.toThrow("malformed"); -}); diff --git a/packages/workflow-freeze/src/index.ts b/packages/workflow-freeze/src/index.ts deleted file mode 100644 index 6a1683e68..000000000 --- a/packages/workflow-freeze/src/index.ts +++ /dev/null @@ -1,234 +0,0 @@ -// Hub-side projection freeze for hub-authored inert workflow definitions. -// -// A code-sourced deploy freezes its definition through the sidecar -// probe: the sidecar projects the live definition to inert plain data, -// walks its capability surface, and the hub gates and freezes the -// result onto the definition's version row -// (`@intx/hub-sessions`' workflow-probe-gate). A definition the hub -// authors itself — an agent from the Agents page, a template block — -// is already inert JSON, so no sidecar round-trip exists to ride, and -// the bare `ensureWorkflowDefinitionForAsset` those paths used to call -// left `approved_wire_hash`/`grant_snapshot`/`wire_projection` NULL: -// permanently unlaunchable rows (CL-6447, CL-6439). -// -// This module is the probe's hub-local counterpart, built from the -// same platform primitives: `projectLiveToInert` reifies the parsed -// definition exactly as the probe child does, `walkCapabilities` walks -// the same grant surface against the same built-in director registry a -// closure without `interchange.directors` gets, and -// `createDbFrozenApprovalWriter` persists the same all-or-nothing -// freeze. The approval policy is the self-approve analogue the probe -// gate documents for live-authored definitions: the hub authored the -// content, so the grant surface the walk reports IS the approved set, -// and the hash is computed and frozen in the same process — there is -// no shipped hash to tamper-check. - -import { createDefaultDirectorRegistry } from "@intx/agent"; -import type { DBExecutor } from "@intx/db"; -import { workflowDefinition, workflowDefinitionVersion } from "@intx/db/schema"; -import { createDbFrozenApprovalWriter } from "@intx/hub-sessions"; -import type { GrantWalkSnapshot } from "@intx/types"; -import { WorkflowProjectionDefinition } from "@intx/types/sidecar"; -import { computeWireDefinitionHash } from "@intx/types/wire-definition-hash"; -import { projectLiveToInert } from "@intx/workflow"; -import type { WorkflowDefinition } from "@intx/workflow"; -import { walkCapabilities } from "@intx/workflow-deploy"; -import type { CapabilityWalkResult } from "@intx/workflow-deploy"; -import { and, eq } from "drizzle-orm"; -import { type } from "arktype"; - -// The version `ensureWorkflowDefinitionForAsset` projects for a fresh -// definition — the row every freeze targets. Hand-coupled to -// `@intx/hub-sessions`' own `FROZEN_VERSION` the same way the probe -// gate documents. -const FROZEN_VERSION = "1"; - -// The load-bearing top-level fields a serialized definition must carry -// for the projector and the walk to operate. The producers are this -// hub's own builders, so this is a sanity gate that fails loud on a -// malformed serialization, not a full re-validation of a shape the -// projector already fails closed on step by step. -const SerializedWorkflowDefinition = type({ - id: "string", - stepOrder: "string[]", - steps: "object", -}); - -/** Everything a freeze persists, computed without touching the DB. */ -export type InertDefinitionFreeze = { - readonly projection: WorkflowProjectionDefinition; - readonly wireHash: string; - readonly grants: readonly string[]; - readonly grantSnapshot: GrantWalkSnapshot; -}; - -function collectDeploymentGrants(walk: CapabilityWalkResult): string[] { - const grants = new Set(); - for (const declarations of walk.perStep.values()) { - for (const grant of declarations.grants) { - grants.add(grant); - } - } - return [...grants].sort(); -} - -function buildGrantWalkSnapshot( - walk: CapabilityWalkResult, - grantRequirements: WorkflowDefinition["grantRequirements"], -): GrantWalkSnapshot { - const perStep = [...walk.perStep].map(([stepId, declarations]) => ({ - stepId, - grants: [...declarations.grants], - grantEffects: Object.fromEntries(declarations.grantEffects), - })); - return { - perStep, - grantRequirements: [...(grantRequirements ?? [])], - }; -} - -/** - * Project a serialized hub-authored definition to its inert wire form - * and walk its capability surface — the same reify-hash-walk sequence - * the sidecar probe child runs, executed hub-locally over a definition - * that carries no author code. Fails loud on an unresolvable director: - * the runtime does not re-gate `director:`, so a freeze whose grant - * set silently omitted one would approve an incomplete manifest. - */ -export async function projectAndWalkInertDefinition( - workflowJson: string, -): Promise { - const parsed = SerializedWorkflowDefinition(JSON.parse(workflowJson)); - if (parsed instanceof type.errors) { - throw new Error( - `workflow-freeze: serialized definition is malformed: ${parsed.summary}`, - ); - } - // The sanity gate above proves the load-bearing top level; the - // projector and the walk fail closed on any step whose shape lies. - // The producer is the hub's own builder, never external input. - const definition = parsed as unknown as WorkflowDefinition; - - const projection = WorkflowProjectionDefinition.assert( - projectLiveToInert(definition), - ); - const wireHash = await computeWireDefinitionHash(projection); - - const walk = walkCapabilities(definition, createDefaultDirectorRegistry()); - if (walk.unresolvedDirectors.length > 0) { - throw new Error( - `workflow-freeze: definition ${definition.id} names unresolvable ` + - `director(s): ${walk.unresolvedDirectors.join(", ")}`, - ); - } - - return { - projection, - wireHash, - grants: collectDeploymentGrants(walk), - grantSnapshot: buildGrantWalkSnapshot(walk, definition.grantRequirements), - }; -} - -/** - * Freeze a hub-authored inert definition onto a first-class - * `workflow_definition` keyed by `(assetId, wireHash)` — the create - * path. Persists through `createDbFrozenApprovalWriter`, so the ensure - * and the stamp are one transaction and the row can never exist in the - * half-frozen state a bare `ensureWorkflowDefinitionForAsset` leaves. - * The row keeps the schema's `origin: "authored"` default — only a - * folded run's own deploy demotes the sibling it mints to a per-run - * record (CL-6452, `@corbits/folded-runs`' `markRunDeployClone`). - */ -export async function freezeInertWorkflowDefinition( - db: DBExecutor, - input: { readonly assetId: string; readonly workflowJson: string }, -): Promise<{ definitionId: string; wireHash: string }> { - const frozen = await projectAndWalkInertDefinition(input.workflowJson); - const persist = createDbFrozenApprovalWriter(db); - const { definitionId } = await persist({ - assetId: input.assetId, - approvedWireHash: frozen.wireHash, - approvedGrants: frozen.grants, - grantSnapshot: frozen.grantSnapshot, - projection: frozen.projection, - }); - return { definitionId, wireHash: frozen.wireHash }; -} - -/** - * The freeze surface a definition-authoring package consumes without - * carrying the DB executor itself: the composition root binds both - * halves to its one `db` via `createDefinitionFreezer`, and a unit test - * substitutes a recording stub instead of emulating drizzle's chains. - */ -export type DefinitionFreezer = { - freeze(input: { - readonly assetId: string; - readonly workflowJson: string; - }): Promise<{ definitionId: string; wireHash: string }>; - refreeze(input: { - readonly definitionId: string; - readonly workflowJson: string; - }): Promise<{ wireHash: string }>; -}; - -/** Bind both freeze halves to one executor. */ -export function createDefinitionFreezer(db: DBExecutor): DefinitionFreezer { - return { - freeze: (input) => freezeInertWorkflowDefinition(db, input), - refreeze: (input) => refreezeWorkflowDefinitionProjection(db, input), - }; -} - -/** - * Re-freeze an existing definition in place after its asset content - * changed — the mutable-edit counterpart of - * `freezeInertWorkflowDefinition`. Workbench treats a hand-authored - * agent as one definition whose content evolves (instructions edits, - * skill re-pins), so an edit updates the definition's own `wireHash` - * and restamps its frozen version row rather than minting a sibling - * definition per content hash. Also heals rows frozen before the - * projection was recorded: any save re-runs the full freeze. - */ -export async function refreezeWorkflowDefinitionProjection( - db: DBExecutor, - input: { readonly definitionId: string; readonly workflowJson: string }, -): Promise<{ wireHash: string }> { - const frozen = await projectAndWalkInertDefinition(input.workflowJson); - await db.transaction(async (tx) => { - const updated = await tx - .update(workflowDefinition) - .set({ wireHash: frozen.wireHash }) - .where(eq(workflowDefinition.id, input.definitionId)) - .returning({ id: workflowDefinition.id }); - if (updated.length !== 1) { - throw new Error( - `workflow-freeze: expected exactly one definition row for ` + - `${input.definitionId}, updated ${String(updated.length)}`, - ); - } - const stamped = await tx - .update(workflowDefinitionVersion) - .set({ - approvedWireHash: frozen.wireHash, - grantSnapshot: frozen.grantSnapshot, - wireProjection: frozen.projection, - }) - .where( - and( - eq(workflowDefinitionVersion.definitionId, input.definitionId), - eq(workflowDefinitionVersion.version, FROZEN_VERSION), - ), - ) - .returning({ id: workflowDefinitionVersion.id }); - if (stamped.length !== 1) { - throw new Error( - `workflow-freeze: expected exactly one ${FROZEN_VERSION} version ` + - `row for definition ${input.definitionId}, stamped ` + - `${String(stamped.length)}`, - ); - } - }); - return { wireHash: frozen.wireHash }; -} diff --git a/packages/workflow-freeze/test/freeze.drizzle.test.ts b/packages/workflow-freeze/test/freeze.drizzle.test.ts deleted file mode 100644 index 4ff959775..000000000 --- a/packages/workflow-freeze/test/freeze.drizzle.test.ts +++ /dev/null @@ -1,207 +0,0 @@ -// DB-gated coverage for the freeze's persistence half: a create-path -// freeze leaves no half-frozen row (CL-6447's disease — a definition -// whose version row has NULL `wire_projection` is permanently -// unlaunchable), and the in-place re-freeze both follows an edit and -// heals a legacy row frozen before the projection was recorded. -// Runs against its own scratch database, never the developer's. -import { afterAll, beforeAll, expect, test } from "bun:test"; -import postgres from "postgres"; -import { eq } from "drizzle-orm"; - -import { - createDB, - loadFrozenGrantSnapshot, - loadFrozenWireProjection, - type DB, -} from "@intx/db"; -import { asset, tenant, principal, workflowDefinition } from "@intx/db/schema"; -import { ensureWorkflowDefinitionForAsset } from "@intx/hub-sessions"; -import { generateId } from "@intx/hub-common"; - -import { defineAgent } from "@intx/agent"; -import { defineWorkflow, step } from "@intx/workflow"; - -import { setupDatabase, dbTargetFromUrl } from "../../../scripts/db-setup"; -import { e2eDatabaseUrl } from "../../../scripts/e2e/harness"; -import { dbGate } from "../../../scripts/e2e/db-gate"; -import { - freezeInertWorkflowDefinition, - refreezeWorkflowDefinitionProjection, -} from "../src/index"; - -function scratchUrlFor(e2eUrl: string): string { - const url = new URL(e2eUrl); - const database = url.pathname.replace(/^\//, ""); - url.pathname = `/${database}_workflow_freeze_test`; - return url.toString(); -} - -function agentWorkflowJson(systemPrompt: string): string { - const agent = defineAgent({ - id: "agent", - description: "", - systemPrompt, - tools: [], - capabilities: [], - inference: { sources: [{ provider: "catalog", model: "m-test" }] }, - }); - return JSON.stringify( - defineWorkflow({ - id: "wf_agent_freeze_db_test", - trigger: { type: "mail", to: "freeze-db-test@example.test" }, - steps: { - agent: step({ agent, timeout: 60_000, triggers: "unbounded" }), - }, - }), - ); -} - -const databaseUrl = e2eDatabaseUrl(); -const describeIfDb = dbGate(databaseUrl, import.meta.path); - -describeIfDb("freezeInertWorkflowDefinition against Postgres", () => { - const scratchUrl = scratchUrlFor( - databaseUrl ?? "postgres://localhost:5432/unused", - ); - const scratchDatabase = new URL(scratchUrl).pathname.replace(/^\//, ""); - - let db: DB["db"]; - let close: () => Promise; - const tenantId = generateId("tenant"); - const principalId = generateId("principal"); - - beforeAll(async () => { - const maintenanceUrl = new URL(scratchUrl); - maintenanceUrl.pathname = "/postgres"; - const maintenance = postgres(maintenanceUrl.toString(), { - max: 1, - onnotice: () => undefined, - }); - try { - await maintenance.unsafe(`DROP DATABASE IF EXISTS "${scratchDatabase}"`); - } finally { - await maintenance.end(); - } - await setupDatabase(scratchUrl); - - const handle = createDB(dbTargetFromUrl(scratchUrl)); - db = handle.db; - close = handle.close; - - await db.insert(tenant).values({ - id: tenantId, - name: "Freeze Test", - slug: `freeze-test-${tenantId.slice(-8)}`, - domain: `freeze-test-${tenantId.slice(-8)}.example`, - }); - await db.insert(principal).values({ - id: principalId, - tenantId, - kind: "user", - refId: `usr_${tenantId.slice(-8)}`, - status: "active", - }); - }, 60_000); - - afterAll(async () => { - await close?.(); - }); - - async function insertAsset(name: string): Promise { - const assetId = generateId("asset"); - await db.insert(asset).values({ - id: assetId, - tenantId, - kind: "workflow", - name, - displayName: name, - creatorPrincipalId: principalId, - }); - return assetId; - } - - test("a create-path freeze leaves no half-frozen row", async () => { - const assetId = await insertAsset("freeze-create"); - const { definitionId, wireHash } = await freezeInertWorkflowDefinition(db, { - assetId, - workflowJson: agentWorkflowJson("Be helpful."), - }); - - const projection = await loadFrozenWireProjection(db, definitionId); - expect(projection).not.toBeNull(); - const snapshot = await loadFrozenGrantSnapshot(db, definitionId); - expect(snapshot).not.toBeNull(); - - const row = await db.query.workflowDefinition.findFirst({ - where: eq(workflowDefinition.id, definitionId), - }); - expect(row?.wireHash).toBe(wireHash); - }); - - test("a re-freeze follows an edit in place — same definition, new content", async () => { - const assetId = await insertAsset("freeze-edit"); - const created = await freezeInertWorkflowDefinition(db, { - assetId, - workflowJson: agentWorkflowJson("First instructions."), - }); - - const refrozen = await refreezeWorkflowDefinitionProjection(db, { - definitionId: created.definitionId, - workflowJson: agentWorkflowJson("Edited instructions."), - }); - expect(refrozen.wireHash).not.toBe(created.wireHash); - - const row = await db.query.workflowDefinition.findFirst({ - where: eq(workflowDefinition.id, created.definitionId), - }); - expect(row?.wireHash).toBe(refrozen.wireHash); - - const projection = await loadFrozenWireProjection(db, created.definitionId); - expect(JSON.stringify(projection)).toContain("Edited instructions."); - }); - - test("a re-freeze heals a legacy row frozen before the projection was recorded", async () => { - const assetId = await insertAsset("freeze-legacy"); - const workflowJson = agentWorkflowJson("Legacy instructions."); - // The pre-fix write: a bare ensure, no stamp — the permanently - // unlaunchable state CL-6447 reproduced. - const { definitionId } = await ensureWorkflowDefinitionForAsset(db, { - assetId, - wireHash: "legacy-raw-json-hash", - }); - expect(await loadFrozenWireProjection(db, definitionId)).toBeNull(); - - await refreezeWorkflowDefinitionProjection(db, { - definitionId, - workflowJson, - }); - expect(await loadFrozenWireProjection(db, definitionId)).not.toBeNull(); - expect(await loadFrozenGrantSnapshot(db, definitionId)).not.toBeNull(); - }); - - // CL-6452: a freeze produces a launch-authoritative definition. Only - // a folded run's own deploy demotes the sibling it mints to a per-run - // record (`@corbits/folded-runs`' `markRunDeployClone`), so a freeze — - // and any other deploy that ensures a definition — stays authored. - test("a freeze produces a launch-authoritative definition", async () => { - const assetId = await insertAsset("freeze-origin"); - const { definitionId } = await freezeInertWorkflowDefinition(db, { - assetId, - workflowJson: agentWorkflowJson("Authored instructions."), - }); - const authoredRow = await db.query.workflowDefinition.findFirst({ - where: eq(workflowDefinition.id, definitionId), - }); - expect(authoredRow?.origin).toBe("authored"); - - const sibling = await ensureWorkflowDefinitionForAsset(db, { - assetId, - wireHash: "another-deploy-hash", - }); - expect(sibling.definitionId).not.toBe(definitionId); - const siblingRow = await db.query.workflowDefinition.findFirst({ - where: eq(workflowDefinition.id, sibling.definitionId), - }); - expect(siblingRow?.origin).toBe("authored"); - }); -}); diff --git a/packages/workflow-freeze/tsconfig.json b/packages/workflow-freeze/tsconfig.json deleted file mode 100644 index 6bb3f1b88..000000000 --- a/packages/workflow-freeze/tsconfig.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "extends": "./tsconfig.src.json", - "compilerOptions": { - "composite": false, - "noEmit": true, - "disableSourceOfProjectReferenceRedirect": true, - "declaration": false, - "declarationMap": false, - "emitDeclarationOnly": false, - "rootDir": "../.." - }, - "include": ["src", "test"], - "exclude": [], - "references": [ - { - "path": "../../vendor/intx/agent/tsconfig.src.json" - }, - { - "path": "../../vendor/intx/db/tsconfig.src.json" - }, - { - "path": "../../vendor/intx/hub-sessions/tsconfig.src.json" - }, - { - "path": "../../vendor/intx/types/tsconfig.src.json" - }, - { - "path": "../../vendor/intx/workflow-deploy/tsconfig.src.json" - }, - { - "path": "../../vendor/intx/workflow/tsconfig.src.json" - } - ] -} diff --git a/packages/workflow-freeze/tsconfig.src.json b/packages/workflow-freeze/tsconfig.src.json deleted file mode 100644 index 5a611551d..000000000 --- a/packages/workflow-freeze/tsconfig.src.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "extends": "../../tsconfig.base.json", - "include": ["src", "package.json", "src/**/*.json"], - "exclude": ["src/**/*.test.ts", "src/**/*.test.tsx"], - "compilerOptions": { - "types": ["bun"], - "composite": true, - "emitDeclarationOnly": true, - "outDir": "dist", - "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" - }, - "references": [ - { - "path": "../../vendor/intx/agent/tsconfig.src.json" - }, - { - "path": "../../vendor/intx/db/tsconfig.src.json" - }, - { - "path": "../../vendor/intx/hub-sessions/tsconfig.src.json" - }, - { - "path": "../../vendor/intx/types/tsconfig.src.json" - }, - { - "path": "../../vendor/intx/workflow-deploy/tsconfig.src.json" - }, - { - "path": "../../vendor/intx/workflow/tsconfig.src.json" - } - ] -} diff --git a/tsconfig.build.json b/tsconfig.build.json index 569a3ad69..c3f5ef0c4 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -151,9 +151,6 @@ { "path": "./packages/workflow-deploy-source/tsconfig.src.json" }, - { - "path": "./packages/workflow-freeze/tsconfig.src.json" - }, { "path": "./packages/workflow-source/tsconfig.src.json" }, From ef2ae96f36d888b1ca2a58aa4903dcfd6a3441a5 Mon Sep 17 00:00:00 2001 From: Sawyer Date: Wed, 2 Sep 2026 01:53:09 -0700 Subject: [PATCH 5/7] Address review findings (CL-7364) --- apps/hub/src/index.ts | 2 +- bun.lock | 37 ++++++------------- docs/workflow-definition-access.md | 2 +- .../agent-directory/src/definition-asset.ts | 2 - .../src/native-deploy-cutover.test.ts | 15 ++++++++ packages/evals/README.md | 16 ++++---- 6 files changed, 37 insertions(+), 37 deletions(-) diff --git a/apps/hub/src/index.ts b/apps/hub/src/index.ts index 26df2ff46..d0b5a5734 100644 --- a/apps/hub/src/index.ts +++ b/apps/hub/src/index.ts @@ -200,7 +200,6 @@ import { renderWorkflowSourceTree, WORKFLOW_SOURCE_ENTRY, } from "@corbits/workflow-source"; -import { createDefinitionFreezer } from "@corbits/workflow-freeze"; import { createDrizzleDraftStore, createDrizzleRoutineStore, @@ -2637,6 +2636,7 @@ export async function createHub(config: HubConfig) { tenantId, principalId, assetId, + assetName, commitSha, entry: WORKFLOW_SOURCE_ENTRY, }); diff --git a/bun.lock b/bun.lock index edde15867..2ce2c110f 100644 --- a/bun.lock +++ b/bun.lock @@ -71,7 +71,6 @@ "@corbits/webhook-triggers": "workspace:*", "@corbits/workflow-catalog": "workspace:*", "@corbits/workflow-deploy-source": "workspace:*", - "@corbits/workflow-freeze": "workspace:*", "@corbits/workflow-source": "workspace:*", "@intx/authz": "0.3.0", "@intx/crypto": "0.3.0", @@ -1583,26 +1582,6 @@ "typescript": "catalog:", }, }, - "packages/workflow-freeze": { - "name": "@corbits/workflow-freeze", - "version": "0.0.1", - "dependencies": { - "@intx/agent": "workspace:*", - "@intx/db": "workspace:*", - "@intx/hub-sessions": "workspace:*", - "@intx/types": "workspace:*", - "@intx/workflow": "workspace:*", - "@intx/workflow-deploy": "workspace:*", - "arktype": "catalog:", - "drizzle-orm": "catalog:", - }, - "devDependencies": { - "@intx/hub-common": "0.3.0", - "@types/bun": "catalog:", - "postgres": "catalog:", - "typescript": "catalog:", - }, - }, "packages/workflow-source": { "name": "@corbits/workflow-source", "version": "0.0.1", @@ -2383,8 +2362,6 @@ "@corbits/workflow-deploy-source": ["@corbits/workflow-deploy-source@workspace:packages/workflow-deploy-source"], - "@corbits/workflow-freeze": ["@corbits/workflow-freeze@workspace:packages/workflow-freeze"], - "@corbits/workflow-source": ["@corbits/workflow-source@workspace:packages/workflow-source"], "@drizzle-team/brocli": ["@drizzle-team/brocli@0.10.2", "", {}, "sha512-z33Il7l5dKjUgGULTqBsQBQwckHh5AbIuxhdsIxDDiZAzBOrZO6q9ogcWC65kU382AfynTfgNumVcNIjuIua6w=="], @@ -3651,7 +3628,15 @@ "@babel/helper-compilation-targets/semver": ["semver@6.3.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="], - "@corbits/memory-hub/@corbits/memory": ["@corbits/memory@github:corbitsdev/corbits-memory#9e6f213", { "dependencies": { "@intx/agent": "0.2.2", "@intx/authz": "0.2.2", "@intx/hub-api": "0.2.2", "@intx/log": "0.2.2", "@intx/workflow": "0.2.2", "arktype": "^2.1.29", "drizzle-orm": "^0.45.1", "hono": "^4.9.0", "hono-openapi": "^1.3.1", "postgres": "^3.4.7" } }, "corbitsdev-corbits-memory-9e6f213", "sha512-utnM4ZT2zmslcPXYWAAqxlDNLcpGsXFiTOtj8h7+OXnhCP0Eaw8yl25+yCTyHpvt3jcdeG4h5uFsSj7ou0BZCA=="], + "@corbits/artifacts-hub/@corbits/artifacts": ["@corbits/artifacts@github:corbitsdev/corbits-artifacts#81049ed", { "dependencies": { "@hono/standard-validator": "^0.2.3" }, "peerDependencies": { "@intx/types": "^0.2.2", "arktype": "^2.1.29", "drizzle-orm": "^0.45.2", "hono": "^4.12.32", "hono-openapi": "^1.2.0", "postgres": "^3.4.9" } }, "corbitsdev-corbits-artifacts-81049ed", "sha512-oTE0iFDyQdz0ifG1epo39pwaCaYaw19YcKXwfaZqAEQ56a1g9YIozXwH9CG4NaUTwcJKUeYGuNls6oJsMPisCw=="], + + "@corbits/chat-ui/@corbits/react-ui": ["@corbits/react-ui@github:corbitsdev/react-ui#3b12281", { "dependencies": { "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "tailwind-merge": "^3.3.1" }, "peerDependencies": { "@radix-ui/react-dialog": "^1.1.15", "@radix-ui/react-dropdown-menu": "^2.1.16", "@radix-ui/react-slot": "^1.2.3", "@radix-ui/react-tooltip": "^1.2.8", "@tanstack/react-query": "^5.90.2", "lucide-react": "^0.545.0 || ^1.0.0", "react": "^18.2.0 || ^19.0.0", "react-dom": "^18.2.0 || ^19.0.0", "sonner": "^2.0.7" }, "optionalPeers": ["@tanstack/react-query"] }, "corbitsdev-react-ui-3b12281", "sha512-Abvm/DO0Gqg0ITHGT9355ZxyKRPMVJLSSQSjpd3a8qt4JPrSMOLIOS4sX8ZMNNaArIbnY9F+VKrOWkUJUyO4Nw=="], + + "@corbits/context-menu/@corbits/react-ui": ["@corbits/react-ui@github:corbitsdev/react-ui#3b12281", { "dependencies": { "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "tailwind-merge": "^3.3.1" }, "peerDependencies": { "@radix-ui/react-dialog": "^1.1.15", "@radix-ui/react-dropdown-menu": "^2.1.16", "@radix-ui/react-slot": "^1.2.3", "@radix-ui/react-tooltip": "^1.2.8", "@tanstack/react-query": "^5.90.2", "lucide-react": "^0.545.0 || ^1.0.0", "react": "^18.2.0 || ^19.0.0", "react-dom": "^18.2.0 || ^19.0.0", "sonner": "^2.0.7" }, "optionalPeers": ["@tanstack/react-query"] }, "corbitsdev-react-ui-3b12281", "sha512-Abvm/DO0Gqg0ITHGT9355ZxyKRPMVJLSSQSjpd3a8qt4JPrSMOLIOS4sX8ZMNNaArIbnY9F+VKrOWkUJUyO4Nw=="], + + "@corbits/plugins-ui/@corbits/react-ui": ["@corbits/react-ui@github:corbitsdev/react-ui#3b12281", { "dependencies": { "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "tailwind-merge": "^3.3.1" }, "peerDependencies": { "@radix-ui/react-dialog": "^1.1.15", "@radix-ui/react-dropdown-menu": "^2.1.16", "@radix-ui/react-slot": "^1.2.3", "@radix-ui/react-tooltip": "^1.2.8", "@tanstack/react-query": "^5.90.2", "lucide-react": "^0.545.0 || ^1.0.0", "react": "^18.2.0 || ^19.0.0", "react-dom": "^18.2.0 || ^19.0.0", "sonner": "^2.0.7" }, "optionalPeers": ["@tanstack/react-query"] }, "corbitsdev-react-ui-3b12281", "sha512-Abvm/DO0Gqg0ITHGT9355ZxyKRPMVJLSSQSjpd3a8qt4JPrSMOLIOS4sX8ZMNNaArIbnY9F+VKrOWkUJUyO4Nw=="], + + "@corbits/settings-ui/@corbits/react-ui": ["@corbits/react-ui@github:corbitsdev/react-ui#3b12281", { "dependencies": { "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "tailwind-merge": "^3.3.1" }, "peerDependencies": { "@radix-ui/react-dialog": "^1.1.15", "@radix-ui/react-dropdown-menu": "^2.1.16", "@radix-ui/react-slot": "^1.2.3", "@radix-ui/react-tooltip": "^1.2.8", "@tanstack/react-query": "^5.90.2", "lucide-react": "^0.545.0 || ^1.0.0", "react": "^18.2.0 || ^19.0.0", "react-dom": "^18.2.0 || ^19.0.0", "sonner": "^2.0.7" }, "optionalPeers": ["@tanstack/react-query"] }, "corbitsdev-react-ui-3b12281", "sha512-Abvm/DO0Gqg0ITHGT9355ZxyKRPMVJLSSQSjpd3a8qt4JPrSMOLIOS4sX8ZMNNaArIbnY9F+VKrOWkUJUyO4Nw=="], "@esbuild-kit/core-utils/esbuild": ["esbuild@0.18.20", "", { "optionalDependencies": { "@esbuild/android-arm": "0.18.20", "@esbuild/android-arm64": "0.18.20", "@esbuild/android-x64": "0.18.20", "@esbuild/darwin-arm64": "0.18.20", "@esbuild/darwin-x64": "0.18.20", "@esbuild/freebsd-arm64": "0.18.20", "@esbuild/freebsd-x64": "0.18.20", "@esbuild/linux-arm": "0.18.20", "@esbuild/linux-arm64": "0.18.20", "@esbuild/linux-ia32": "0.18.20", "@esbuild/linux-loong64": "0.18.20", "@esbuild/linux-mips64el": "0.18.20", "@esbuild/linux-ppc64": "0.18.20", "@esbuild/linux-riscv64": "0.18.20", "@esbuild/linux-s390x": "0.18.20", "@esbuild/linux-x64": "0.18.20", "@esbuild/netbsd-x64": "0.18.20", "@esbuild/openbsd-x64": "0.18.20", "@esbuild/sunos-x64": "0.18.20", "@esbuild/win32-arm64": "0.18.20", "@esbuild/win32-ia32": "0.18.20", "@esbuild/win32-x64": "0.18.20" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA=="], @@ -3675,7 +3660,9 @@ "@typescript-eslint/eslint-plugin/ignore": ["ignore@7.0.6", "", {}, "sha512-BAg6QkE8W+TuQLrrw0Ugr7HegXduRuuj8/ti2kSOc+jz1dmx8/WNcjr6XGnq5YpDWxFwwaavqD0+jIUOKelTsw=="], - "@workbench/hub/@corbits/memory": ["@corbits/memory@github:corbitsdev/corbits-memory#9e6f213", { "dependencies": { "@intx/agent": "0.2.2", "@intx/authz": "0.2.2", "@intx/hub-api": "0.2.2", "@intx/log": "0.2.2", "@intx/workflow": "0.2.2", "arktype": "^2.1.29", "drizzle-orm": "^0.45.1", "hono": "^4.9.0", "hono-openapi": "^1.3.1", "postgres": "^3.4.7" } }, "corbitsdev-corbits-memory-9e6f213", "sha512-utnM4ZT2zmslcPXYWAAqxlDNLcpGsXFiTOtj8h7+OXnhCP0Eaw8yl25+yCTyHpvt3jcdeG4h5uFsSj7ou0BZCA=="], + "@workbench/hub/@corbits/artifacts": ["@corbits/artifacts@github:corbitsdev/corbits-artifacts#81049ed", { "dependencies": { "@hono/standard-validator": "^0.2.3" }, "peerDependencies": { "@intx/types": "^0.2.2", "arktype": "^2.1.29", "drizzle-orm": "^0.45.2", "hono": "^4.12.32", "hono-openapi": "^1.2.0", "postgres": "^3.4.9" } }, "corbitsdev-corbits-artifacts-81049ed", "sha512-oTE0iFDyQdz0ifG1epo39pwaCaYaw19YcKXwfaZqAEQ56a1g9YIozXwH9CG4NaUTwcJKUeYGuNls6oJsMPisCw=="], + + "@workbench/web/@corbits/react-ui": ["@corbits/react-ui@github:corbitsdev/react-ui#3b12281", { "dependencies": { "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "tailwind-merge": "^3.3.1" }, "peerDependencies": { "@radix-ui/react-dialog": "^1.1.15", "@radix-ui/react-dropdown-menu": "^2.1.16", "@radix-ui/react-slot": "^1.2.3", "@radix-ui/react-tooltip": "^1.2.8", "@tanstack/react-query": "^5.90.2", "lucide-react": "^0.545.0 || ^1.0.0", "react": "^18.2.0 || ^19.0.0", "react-dom": "^18.2.0 || ^19.0.0", "sonner": "^2.0.7" }, "optionalPeers": ["@tanstack/react-query"] }, "corbitsdev-react-ui-3b12281", "sha512-Abvm/DO0Gqg0ITHGT9355ZxyKRPMVJLSSQSjpd3a8qt4JPrSMOLIOS4sX8ZMNNaArIbnY9F+VKrOWkUJUyO4Nw=="], "ajv-formats/ajv": ["ajv@8.20.0", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA=="], diff --git a/docs/workflow-definition-access.md b/docs/workflow-definition-access.md index 8a0dfbf93..782013775 100644 --- a/docs/workflow-definition-access.md +++ b/docs/workflow-definition-access.md @@ -30,7 +30,7 @@ and no update path. Spread: `packages/agent-directory` (7 files), `apps/hub/src/index.ts` (12 sites), `packages/chat/src/platform-adapter.ts` (7), plus `folded-runs`, -`folded-run-one-shot`, `webhook-triggers`, `evals`, `workflow-freeze`, +`folded-run-one-shot`, `webhook-triggers`, `evals`, `routine-launcher`, `skills-mount`. ## What a prototype migration surfaced diff --git a/packages/agent-directory/src/definition-asset.ts b/packages/agent-directory/src/definition-asset.ts index db367b8e4..f9484afa3 100644 --- a/packages/agent-directory/src/definition-asset.ts +++ b/packages/agent-directory/src/definition-asset.ts @@ -132,8 +132,6 @@ export function statusForAgentDefinitionDeployError( return 403; case "conflict": return 409; - case "wire_hash_mismatch": - return 409; case "invalid": return 400; case "unavailable": diff --git a/packages/agent-directory/src/native-deploy-cutover.test.ts b/packages/agent-directory/src/native-deploy-cutover.test.ts index 3fd74efaa..887b9cd36 100644 --- a/packages/agent-directory/src/native-deploy-cutover.test.ts +++ b/packages/agent-directory/src/native-deploy-cutover.test.ts @@ -22,6 +22,14 @@ function tsFilesUnder(dir: string): string[] { }); } +// The composition root that injects every `WorkflowDeployer` this package +// (and `@corbits/agent-workflow-authoring`) calls into — exactly where a +// straggler `@corbits/workflow-freeze` import landed once before (the +// deleted package's own import line survived a rebase in apps/hub/src/ +// index.ts until this ticket's own review caught it). Scanning only this +// package would have missed that regression again. +const HUB_SRC_DIR = path.join(import.meta.dir, "../../../apps/hub/src"); + describe("workflow-freeze cutover", () => { test("no source file in this package imports @corbits/workflow-freeze", () => { const offenders = tsFilesUnder(SRC_DIR).filter((file) => @@ -38,4 +46,11 @@ describe("workflow-freeze cutover", () => { "@corbits/workflow-freeze", ); }); + + test("no source file in apps/hub imports @corbits/workflow-freeze", () => { + const offenders = tsFilesUnder(HUB_SRC_DIR).filter((file) => + readFileSync(file, "utf8").includes("@corbits/workflow-freeze"), + ); + expect(offenders).toEqual([]); + }); }); diff --git a/packages/evals/README.md b/packages/evals/README.md index 8009375b9..3f4cfee31 100644 --- a/packages/evals/README.md +++ b/packages/evals/README.md @@ -47,7 +47,7 @@ fires an actual trigger. | 2 | `agentDefinitionsHaveToolGrants` | **PASS** | The three reviewer definitions materialize via the real install, and the install now also deploys the `code-review` block workflow carrying the `@corbits/github-tools` pin (CL-6405's product fix). The snapshot's `name` is the stable definition handle (`displayName` carries the label), so handle matching is exact. | | 3 | `triggerIsWebhookPerPr` | **PASS** | Install drives start-reviewing against the fake REST origin's repo list; one enabled `webhook_trigger` row mints per repo, bound to the deployed `code-review` definition. | | 4 | `reviewCommentsAttributable` | **SKIP** (product gap) | `WorldSnapshot` has no `reviewComments` field — blocked on CL-6322 Phase 1 (`onTrigger` adoption giving each fired occurrence its own child run id). | -| 5 | `suggestedFixesStructurallyValid` | **FAIL** (gap 1 below) | The launch itself now succeeds: the template-block deploy freezes its definition through `@corbits/workflow-freeze` (CL-6439), so the fired trigger answers 202 with a real run instance instead of `DefinitionProjectionMissingError`. What remains is that a posted review needs genuine model tool calls, i.e. a live `EVAL_PROVIDER_API_KEY` run — plumbing mode's stub credential can never call `github_post_pr_review`. | +| 5 | `suggestedFixesStructurallyValid` | **FAIL** (gap 1 below) | The launch itself now succeeds: the template-block deploy freezes its definition through the native `workflowDeployer.deploy` path (CL-6439, cut over to native deploy in CL-7364), so the fired trigger answers 202 with a real run instance instead of `DefinitionProjectionMissingError`. What remains is that a posted review needs genuine model tool calls, i.e. a live `EVAL_PROVIDER_API_KEY` run — plumbing mode's stub credential can never call `github_post_pr_review`. | | 6 | `outwardGitHubActionsRespectGrantBoundary` | **FAIL** (gap 1 below) | Same blocker as #5. | | 7 | `wholeRunInspectable` | **SKIP** (product gap) | `WorldSnapshot` has no `runs` field. Blocked on CL-6322 Phase 1. | @@ -64,13 +64,13 @@ Closed in the CL-6439 pass: the block-workflow deploy used to record no frozen wire projection, so a webhook-fired launch (`launchWebhookTrigger` -> `readDefinitionProjection`) answered `DefinitionProjectionMissingError` ("No stored launch body for -definition \"code-review\""). The hub's `deployWorkflowSource` binding -now freezes the serialized definition through -`@corbits/workflow-freeze` (the hub-local counterpart of the sidecar -probe gate, shared with the Agents page create path since CL-6447), and -a plumbing-mode run confirms the fired trigger answers 202 with a real -run instance. `packages/workflow-catalog/test/block-workflow-freeze.test.ts` -locks the block source's freezability. +definition \"code-review\""). CL-7364 cut the hub's template-block +deploy binding (`createTemplateBlockRoutes`'s `deployWorkflowSource`) +over from the retired `@corbits/workflow-freeze` package to the native +`workflowDeployer.deploy` path — the same install → sidecar probe → +capability walk → gate → freeze `sessionService.deployWorkflowFromSource` +call the agent-authored deploy path uses — and a plumbing-mode run +confirms the fired trigger still answers 202 with a real run instance. Also closed in the CL-6405 pass: `workflows/code-review` pinned `@corbits/github-tools@0.0.3` while CL-6403 released 0.0.4 (the From a664e20f3fa5611c87d8392993d2aaf939a8544d Mon Sep 17 00:00:00 2001 From: Sawyer Date: Wed, 2 Sep 2026 02:35:38 -0700 Subject: [PATCH 6/7] Fix CI after review pass (CL-7364) --- docs/workflow-model.md | 2 +- packages/evals/README.md | 16 ++++++++-------- scripts/checks/routine-target-inference.ts | 3 +-- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/docs/workflow-model.md b/docs/workflow-model.md index 90fa752ce..64dd36ae0 100644 --- a/docs/workflow-model.md +++ b/docs/workflow-model.md @@ -97,7 +97,7 @@ agent principal. ## Deleted in CL-7364 - Routine target inference from chat membership: `apps/web/src/shell/ - routine-panel.tsx` picks a target only through `DefinitionTargetPicker` +routine-panel.tsx` picks a target only through `DefinitionTargetPicker` now; no `resolveCreateTarget`, `agents[0]?.definitionId`, or "no agent invited" guard remains. `check:routine-target-inference` guards this — it fails on `agents[0]?.definitionId` / `agents[0].definitionId` in diff --git a/packages/evals/README.md b/packages/evals/README.md index 3f4cfee31..e570334b6 100644 --- a/packages/evals/README.md +++ b/packages/evals/README.md @@ -41,15 +41,15 @@ connect card's start-reviewing step after install — so the per-repo grant and `webhook_trigger` row mint for real and the fire-webhook step fires an actual trigger. -| # | Scorer | Result on a scratch-hub run | Why | -| --- | ------------------------------------------ | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| 1 | `githubConnectedViaConnectionsLayer` | **PASS** | Both halves now: the MCP fake connects through the real `POST /mcp-servers` route, and the Plugins PAT proves against the fake REST origin through the real `/:connectorId/complete` (CL-6403's `probeBaseUrls`). | -| 2 | `agentDefinitionsHaveToolGrants` | **PASS** | The three reviewer definitions materialize via the real install, and the install now also deploys the `code-review` block workflow carrying the `@corbits/github-tools` pin (CL-6405's product fix). The snapshot's `name` is the stable definition handle (`displayName` carries the label), so handle matching is exact. | -| 3 | `triggerIsWebhookPerPr` | **PASS** | Install drives start-reviewing against the fake REST origin's repo list; one enabled `webhook_trigger` row mints per repo, bound to the deployed `code-review` definition. | -| 4 | `reviewCommentsAttributable` | **SKIP** (product gap) | `WorldSnapshot` has no `reviewComments` field — blocked on CL-6322 Phase 1 (`onTrigger` adoption giving each fired occurrence its own child run id). | +| # | Scorer | Result on a scratch-hub run | Why | +| --- | ------------------------------------------ | --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 1 | `githubConnectedViaConnectionsLayer` | **PASS** | Both halves now: the MCP fake connects through the real `POST /mcp-servers` route, and the Plugins PAT proves against the fake REST origin through the real `/:connectorId/complete` (CL-6403's `probeBaseUrls`). | +| 2 | `agentDefinitionsHaveToolGrants` | **PASS** | The three reviewer definitions materialize via the real install, and the install now also deploys the `code-review` block workflow carrying the `@corbits/github-tools` pin (CL-6405's product fix). The snapshot's `name` is the stable definition handle (`displayName` carries the label), so handle matching is exact. | +| 3 | `triggerIsWebhookPerPr` | **PASS** | Install drives start-reviewing against the fake REST origin's repo list; one enabled `webhook_trigger` row mints per repo, bound to the deployed `code-review` definition. | +| 4 | `reviewCommentsAttributable` | **SKIP** (product gap) | `WorldSnapshot` has no `reviewComments` field — blocked on CL-6322 Phase 1 (`onTrigger` adoption giving each fired occurrence its own child run id). | | 5 | `suggestedFixesStructurallyValid` | **FAIL** (gap 1 below) | The launch itself now succeeds: the template-block deploy freezes its definition through the native `workflowDeployer.deploy` path (CL-6439, cut over to native deploy in CL-7364), so the fired trigger answers 202 with a real run instance instead of `DefinitionProjectionMissingError`. What remains is that a posted review needs genuine model tool calls, i.e. a live `EVAL_PROVIDER_API_KEY` run — plumbing mode's stub credential can never call `github_post_pr_review`. | -| 6 | `outwardGitHubActionsRespectGrantBoundary` | **FAIL** (gap 1 below) | Same blocker as #5. | -| 7 | `wholeRunInspectable` | **SKIP** (product gap) | `WorldSnapshot` has no `runs` field. Blocked on CL-6322 Phase 1. | +| 6 | `outwardGitHubActionsRespectGrantBoundary` | **FAIL** (gap 1 below) | Same blocker as #5. | +| 7 | `wholeRunInspectable` | **SKIP** (product gap) | `WorldSnapshot` has no `runs` field. Blocked on CL-6322 Phase 1. | ### Remaining gaps, precisely diff --git a/scripts/checks/routine-target-inference.ts b/scripts/checks/routine-target-inference.ts index c3dfe1902..793f9b79c 100644 --- a/scripts/checks/routine-target-inference.ts +++ b/scripts/checks/routine-target-inference.ts @@ -27,8 +27,7 @@ const AGENTS_ZERO_DEFINITION_ID_PATTERN = /\bagents\[0\](?:\?\.|\.)\s*definitionId\b/g; const WORKFLOW_JSON_LITERAL_PATTERN = /(["'`])workflow\.json\1/g; -const WORKFLOW_JSON_ALLOWED_FILE = - "packages/workflow-source/src/index.ts"; +const WORKFLOW_JSON_ALLOWED_FILE = "packages/workflow-source/src/index.ts"; export async function scanFiles( root: string, From e16d6fb5b1495b8337673c5b8097dce942097b30 Mon Sep 17 00:00:00 2001 From: Sawyer Date: Wed, 2 Sep 2026 04:00:07 -0700 Subject: [PATCH 7/7] Remove duplicated retarget-authorization check (CL-7364) --- packages/routines/src/routes.ts | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/packages/routines/src/routes.ts b/packages/routines/src/routes.ts index 04bf85276..8567d38a4 100644 --- a/packages/routines/src/routes.ts +++ b/packages/routines/src/routes.ts @@ -889,27 +889,6 @@ export function createRoutineRoutes( const effectiveDefinitionAssetId = body.definitionAssetId ?? existing.definitionAssetId; - if ( - body.definitionAssetId !== undefined && - body.definitionAssetId !== existing.definitionAssetId - ) { - const rejection = await rejectUnlaunchableTarget( - deps, - tenant.id, - principal.id, - body.definitionAssetId, - ); - if (rejection !== undefined) { - return c.json( - makeErrorEnvelope({ - code: rejection.code, - userMessage: rejection.userMessage, - }), - rejection.status, - ); - } - } - if ( body.trigger !== undefined && !(await webhookTriggerValid(