Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion VENDORED.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,25 @@ sidecar withheld the ack, and the hub redelivered forever
inbound mail carrying no conversation text on the parked-resume path rather
than delivering an empty string that throws inside `agent.send` and fails the
step with `retriesExhausted`; the gate is the new pure helper
`hasConversationText`. `vendor/intx/inference-catalog`'s own local
`hasConversationText`. `vendor/intx/workflow` (CL-6326, CL-6324) gives
`onTrigger` an `onBodyFailure?: "end" | "continue"` policy: absent or `"end"`
preserves terminal-is-final, while `"continue"` lets a long-lived section
re-arm past a `failed` body occurrence instead of one bad turn permanently
ending the section. Cancellation is unaffected — it reflects a drain/operator
decision, not a turn-level error — and the failed occurrence stays on the
run's durable audit log either way, so the policy makes it non-fatal, never
silent. The live→inert projector carries the field too, so an authored policy
survives the child→hub projection the deploy gate hashes rather than being
dropped on the way. `vendor/intx/hub-sessions` (CL-6324) adds a third
code-sourced deploy front, `deployAdoptedCodeSourcedWorkflow`, which deploys
onto shared capacity while adopting an anchor `workflow_run` row the caller
already owns. Neither upstream front can: `deployWorkflowFromSource` inserts
its anchor row, which collides with a folded run's existing one, and threads
no credential cipher; `deployPreparedCodeSourcedWorkflow` updates a
pre-existing row and threads the cipher but only under the
allocation-ownership lock, so it cannot run on shared capacity. The new front
composes the same private halves and follows the prepared front's semantics
minus that lock. `vendor/intx/inference-catalog`'s own local
modification also repoints the `./models` subpath's exports, not just the
root export.
Each package's `VENDORED-FROM` file restates its own delta.
Expand Down
4 changes: 2 additions & 2 deletions scripts/checks/kill-dates.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ vendor/intx/harness | sawyer | 2026-09-14 | af9b270a297ae1dc6d8684da9005ec9d3d62
vendor/intx/hub-agent | sawyer | 2026-09-14 | 6402193dfe48dce3525c9b233bd6974e566df57ff5bc209128633af92abe8b17
vendor/intx/hub-api | sawyer | 2026-09-14 | 7d82a625c852b9e9bb13fd59e71c6c45be792bcbb9ebb5994586e97840dc66c1
vendor/intx/hub-common | sawyer | 2026-09-14 | 0e2d71d4754713538d7fd6451c8648c6b277390abfc888e605499fc004ce0349
vendor/intx/hub-sessions | sawyer | 2026-09-05 | daaf9b2626e3fe66c530d025621c2067ac05716846deb9864c1a3400f6518b29
vendor/intx/hub-sessions | sawyer | 2026-09-05 | 446cd132ccf9d0cad9c2128bd7bb28b21bcacfea5430f6302de55dabf1043115
vendor/intx/inference | sawyer | 2026-09-14 | f91ac6a6b9621888276c5d2c90bd8a0ff8f9c6d3ce3ad67dd3ba57fdd9c01b0f
vendor/intx/inference-catalog | sawyer | 2026-09-14 | 6e2ef3af83eafafdf1b773725afcb724cbb712604266919ecd1d67d50ff8016a
vendor/intx/log | sawyer | 2026-09-14 | 17ba64f2ff751b640dd2db9eb034450876c435f43641b022fbc4a2e9aa9da04d
Expand All @@ -32,7 +32,7 @@ vendor/intx/pack-transport | sawyer | 2026-09-14 | 94578a75112059d31960abdc0b121
vendor/intx/storage-isogit | sawyer | 2026-09-14 | a89b58687b8738620ce664e81a99250cba7b3bbaddbe0904661778fafef8d586
vendor/intx/tool-packaging | sawyer | 2026-09-14 | a4f446a5712f906986ddc02b3a9fb133018d15ac661052026527263d942d0249
vendor/intx/types | sawyer | 2026-09-14 | 21833d272f619f31371e80d752e22bdf8e1d31839169d7faec71240fb2db1139
vendor/intx/workflow | sawyer | 2026-09-14 | 326a9e10693d5587cc35f9db0a7830b8037b2a81852b9b8bdd7bc276a5eb66fd
vendor/intx/workflow | sawyer | 2026-09-14 | ebcacbf8668f21bf336e6d91fcaa9d2a0cf4e06478797cffb5ecdc9c88d3abfc
vendor/intx/workflow-deploy | sawyer | 2026-09-14 | ee75c87a3f8141eaa83068ec29731f064b7f27ef108919aac81419755b9bc1e3
vendor/intx/workflow-host | sawyer | 2026-09-14 | 6522cf5c3efcd8b482e0db418bfa3be350034c76cd63fa9fdd55d6e6718907f6

Expand Down
2 changes: 1 addition & 1 deletion vendor/intx/hub-sessions/VENDORED-FROM
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Source: https://github.com/faremeter/interchange (packages/hub-sessions)
Commit: 4ed8baf4789d4b51fcff7f03e1f6146ab45b9f2b
License: LGPL-2.1-only (see vendor/intx/LICENSE)
Local modifications: exports map repointed from the upstream intx-src condition to direct TypeScript source resolution (types/default -> ./src/...); dist references removed. CL-5879: event-collector.ts's inference.usage case (previously falling into the "not persisted" default) now forwards {turnId, provider, model, usage} to an optional `onUsage` callback, threaded through event-collector-registry.ts's EventCollectorRegistryConfig as `onUsage(agentAddress, tenantId, sessionId, usage)` — the collector's own turn/tenant state is the only place these identifiers meet an inference.usage event. No persistence added upstream; the app wires the callback to @corbits/insights' usage sink. Terminal-anchor pack acceptance: hub-session-lookups.ts's receiveWorkflowRunPack no longer gates the anchor lookup on liveWorkflowRunStatuses — the ownership gate is the exported pure helper ownsWorkflowRunRepo (self-anchored row with a routable address), so a terminal run can still land the inbox-enqueue and markConsumed-rejection packs that retire mail which arrived in its teardown window. Upstream's live-status gate made that pair unresolvable: pack rejected as path_violation -> ack withheld -> hub redelivers, forever.
Local modifications: exports map repointed from the upstream intx-src condition to direct TypeScript source resolution (types/default -> ./src/...); dist references removed. CL-5879: event-collector.ts's inference.usage case (previously falling into the "not persisted" default) now forwards {turnId, provider, model, usage} to an optional `onUsage` callback, threaded through event-collector-registry.ts's EventCollectorRegistryConfig as `onUsage(agentAddress, tenantId, sessionId, usage)` — the collector's own turn/tenant state is the only place these identifiers meet an inference.usage event. No persistence added upstream; the app wires the callback to @corbits/insights' usage sink. Terminal-anchor pack acceptance: hub-session-lookups.ts's receiveWorkflowRunPack no longer gates the anchor lookup on liveWorkflowRunStatuses — the ownership gate is the exported pure helper ownsWorkflowRunRepo (self-anchored row with a routable address), so a terminal run can still land the inbox-enqueue and markConsumed-rejection packs that retire mail which arrived in its teardown window. Upstream's live-status gate made that pair unresolvable: pack rejected as path_violation -> ack withheld -> hub redelivers, forever. CL-6324: a third code-sourced deploy front, `deployAdoptedCodeSourcedWorkflow` (plus the `deployAdoptedWorkflowFromSource` service method and its `AdoptingWorkflowDeployer` type), deploys onto shared capacity while ADOPTING an anchor `workflow_run` row the caller already owns. Upstream's two fronts cannot: `deployWorkflowFromSource` INSERTs its anchor (a primary-key collision against a folded run's existing row) and threads no `credentialCipher`, and `deployPreparedCodeSourcedWorkflow` does both correctly but only under the allocation-ownership lock. The new front composes the same private halves (`emitSourceRefDeployFrame`, `buildInertProjectionStepSources`) and follows the prepared front's semantics minus the allocation lock: ownership is the anchor row's own tenant plus self-anchoring, checked before the frame and re-asserted on the guarded UPDATE that stamps `definitionId`/`publicKey`. See VENDORED.md and docs/revendor-inventory.md.
3 changes: 3 additions & 0 deletions vendor/intx/hub-sessions/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@ export {
SessionLaunchError,
bridgeOrchestratorDeployContent,
deployCodeSourcedWorkflow,
deployAdoptedCodeSourcedWorkflow,
type SessionService,
type DeployWorkflowDefinitionResult,
type DeployWorkflowFromSourceParams,
type DeployPreparedCodeSourcedWorkflowParams,
type InstallAndApproveWorkflowSourceParams,
type PreparedWorkflowDeployer,
type AdoptingWorkflowDeployer,
type DeployAdoptedWorkflowFromSourceParams,
type DeployCodeSourcedWorkflowArgs,
} from "./session-service";
export {
Expand Down
175 changes: 175 additions & 0 deletions vendor/intx/hub-sessions/src/session-service.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
// Co-located coverage for the ADOPTING shared-capacity code-sourced deploy
// (CL-6324's vendored seam). The two upstream code-sourced fronts cannot deploy
// onto a run the caller already owns: `deployWorkflowFromSource` INSERTs a fresh
// anchor row (a PK collision against a folded run's existing row) and threads no
// `credentialCipher`, while `deployPreparedCodeSourcedWorkflow` does both right
// but hard-requires an `allocationTarget`. `deployAdoptedCodeSourcedWorkflow` is
// the third front: it adopts the pre-existing anchor under an ownership check
// and threads the cipher, with no allocation lock.
//
// The fakes here stand in for the two collaborators the front actually touches:
// the sidecar router (which returns the supervisor key on the deploy ack) and
// the drizzle handle. A real Postgres is out of scope -- what is under test is
// the front's own composition, and a fake `db` is the only way to assert the
// negative that matters: that no INSERT is ever issued.
import { describe, expect, test } from "bun:test";

import {
deployAdoptedCodeSourcedWorkflow,
type DeployCodeSourcedWorkflowArgs,
} from "./session-service";

const TENANT = "tnt_adopt";
const ANCHOR_RUN_ID = "run_adopted_anchor";
const DEPLOYMENT_DOMAIN = "runs.example.test";
const DEFINITION_ID = "wdef_frozen";
const SUPERVISOR_KEY = "pk_supervisor";

type CapturedDeploy = {
agentAddress: string;
workflow: { credentials?: unknown };
};

type FakeDb = {
handle: DeployCodeSourcedWorkflowArgs["db"];
inserts: number;
updates: { set: Record<string, unknown> }[];
};

/**
* A drizzle-shaped stub covering exactly the surface the adopting front uses:
* the two `query.*.findFirst` guards, the `update(...).set(...).returning()`
* stamp, and an `insert` that records any call so the no-duplicate-anchor
* assertion can fail loud rather than silently pass.
*/
function fakeDb(options: { anchorExists: boolean }): FakeDb {
const state: FakeDb = {
handle: undefined as unknown as DeployCodeSourcedWorkflowArgs["db"],
inserts: 0,
updates: [],
};
const returningRows = options.anchorExists ? [{ id: ANCHOR_RUN_ID }] : [];
const handle = {
query: {
workflowDefinition: {
findFirst: () => Promise.resolve({ id: DEFINITION_ID }),
},
workflowRun: {
findFirst: () =>
Promise.resolve(
options.anchorExists ? { id: ANCHOR_RUN_ID } : undefined,
),
},
},
insert: () => {
state.inserts += 1;
return { values: () => Promise.resolve(undefined) };
},
update: () => ({
set: (values: Record<string, unknown>) => {
state.updates.push({ set: values });
return {
where: () => ({ returning: () => Promise.resolve(returningRows) }),
};
},
}),
};
state.handle = handle as unknown as DeployCodeSourcedWorkflowArgs["db"];
return state;
}

function deployArgs(
db: FakeDb,
captured: CapturedDeploy[],
overrides?: { credentialBindings?: readonly unknown[] },
): DeployCodeSourcedWorkflowArgs {
const projection = {
id: "wf_adopted",
triggers: [{ type: "manual" }],
stepOrder: [],
steps: {},
...(overrides?.credentialBindings !== undefined
? { credentialBindings: overrides.credentialBindings }
: {}),
};
const args = {
approved: {
approval: {
ok: true,
definitionId: DEFINITION_ID,
approvedWireHash: "sha256:frozen",
approvedGrants: new Set<string>(),
projection,
},
projection,
closure: { entries: [] },
},
sidecarRouter: {
sendAgentDeploy: (
agentAddress: string,
_config: unknown,
workflow: { credentials?: unknown },
) => {
captured.push({ agentAddress, workflow });
return Promise.resolve({ publicKey: SUPERVISOR_KEY });
},
},
agentAddress: `${ANCHOR_RUN_ID}@${DEPLOYMENT_DOMAIN}`,
config: { sources: [], defaultSource: "default", principalId: "prn_x" },
sources: {},
db: db.handle,
tenantId: TENANT,
anchorRunId: ANCHOR_RUN_ID,
deploymentDomain: DEPLOYMENT_DOMAIN,
source: { kind: "registry", registry: "npm" },
};
return args as unknown as DeployCodeSourcedWorkflowArgs;
}

describe("deployAdoptedCodeSourcedWorkflow", () => {
test("adopts a pre-existing anchor run and stamps it, inserting nothing", async () => {
const db = fakeDb({ anchorExists: true });
const captured: CapturedDeploy[] = [];

const result = await deployAdoptedCodeSourcedWorkflow(
deployArgs(db, captured),
);

expect(result.publicKey).toBe(SUPERVISOR_KEY);
expect(db.inserts).toBe(0);
expect(db.updates).toHaveLength(1);
expect(db.updates[0]?.set).toEqual({
definitionId: DEFINITION_ID,
publicKey: SUPERVISOR_KEY,
});
});

test("threads the credentialCipher through to the launch frame", async () => {
const db = fakeDb({ anchorExists: true });
const captured: CapturedDeploy[] = [];
const args = deployArgs(db, captured, {
credentialBindings: [{ id: "cred_a", as: "API_KEY" }],
});

// Without a cipher the binding-bearing definition must fail closed; the
// cipher is the only thing that lets credential material reach the frame.
await expect(deployAdoptedCodeSourcedWorkflow(args)).rejects.toThrow(
/no credentialCipher was supplied/,
);
expect(db.inserts).toBe(0);
expect(captured).toHaveLength(0);
});

test("refuses to adopt an anchor run this tenant does not own", async () => {
const db = fakeDb({ anchorExists: false });
const captured: CapturedDeploy[] = [];

await expect(
deployAdoptedCodeSourcedWorkflow(deployArgs(db, captured)),
).rejects.toThrow(/no adoptable anchor/);
// Fail closed BEFORE the sidecar sees a frame: a refused adoption must
// leave no deployed-but-unanchored agent behind.
expect(captured).toHaveLength(0);
expect(db.inserts).toBe(0);
});
});
Loading
Loading