Skip to content

CL-6324 step 3: the sidecar deploys from the closure - #99

Closed
TheGreatAxios wants to merge 3 commits into
cl-6324-deployathead-convertfrom
cl-6324-sidecar-closure
Closed

CL-6324 step 3: the sidecar deploys from the closure#99
TheGreatAxios wants to merge 3 commits into
cl-6324-deployathead-convertfrom
cl-6324-sidecar-closure

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Contributor

The execution host comes off the retired workflow.json lineage. A deploy
materializes the frame's frozen closure, evaluates the pinned code, and runs
that; the boot-time restore replays the same pin through the same helper, so
both paths reach the runnable definition by one computation rather than two
that can drift.

bun run typecheck exits 0 repo-wide on this branch — the 24 sidecar errors
the conversion table named are gone.

What landed

  • Closure staging (workflow-host-wiring/closure-staging.ts): the durable
    per-deployment source stores (siblings of the reclaimed instance dir, so they
    survive a restart with no re-delivery), the mount resolution both paths derive
    from the pin alone, and the apply. Injectable, so a test stands in for
    fetch + SRI-verify + layout + evaluate without publishing a package.
  • CLOSURE_PACKAGE_DIR exists, threaded on the frozen substrate env, so the
    run child evaluates the pinned code and re-verifies its projection against
    DEFINITION_HASH — now the hub's approvedWireHash, never a sidecar
    recompute. A frame carrying no approved hash fails closed.
  • The probe answers. createWorkflowProbeExecutor is wired at the boot edge,
    so workflow.probe.request returns a real inert projection, its advisory grant
    set, and its wire hash instead of workflow.probe.error.
  • Child spawns are in-memory. createWorkflowSpawnChild /
    createWorkflowSpawnSuspendableChild are gone; a rung lifts its inline children
    to refs and serves grandchildren from that map, so no rung reads a definition
    off disk at any depth. An onTrigger body's sources.json is still staged (an
    in-process body child loses its env across a restart); its definition is not.
  • The record carries the pin. referencedDefinitionHashes is gone;
    approvedWireHash and sourceRef are required, so an unrestorable record
    fails at the scan boundary rather than half-restoring.
  • WORKFLOW_DEFINITION_REPO_ID/_REF are gone. What survives is
    WORKFLOW_DEFINITION_ID: identity for the run-authenticated capabilities route
    a step tool calls, never a repo to read from.

Vendoring

Four modules are near-verbatim copies of upstream's own sidecar at 4ed8baf4
the probe handler, the closure materializer, the closure apply, and the inline
source-asset delivery — plus bin/workflow-probe-child. VENDORED.md moves the
apps/sidecar row to that commit and records the two adaptations the fork's
module layout forced (host-platform resolution lives in this fork's
tool-materialization.ts; the probe child's shebang drops upstream's intx-src
condition, which workbench forbids).

Green

  • bun run typecheck — exit 0, repo-wide
  • apps/sidecar — 138 pass, 0 fail
  • packages/folded-runs — 44 pass, 0 fail
  • packages/chat — 509 pass, 0 fail
  • bun run lint — 0 errors (14 pre-existing warnings)

Not proven — the honest part

No run has executed end to end on these rails. The task asked for a
RunStarted proof; it did not fit, because it needs a real published or
committed source package plus a live hub, and the box went to porting the
source-ref lane into a fork that never had it (upstream's sidecar at the prior
pin already had workflow-closure-apply, workflow-closure-materialization,
source-asset-delivery, and the probe handler; workbench's had none of them).

The remaining wire, in order:

  1. The MCP credential-handle defect from step 2 still stands — mcp:<slug> is
    not a legal ToolCredentialHandle, so any MCP-pinned launch fails closed at
    render time. Gates a real chat launch, not the deploy path.
  2. Nothing has driven a real renderAgentRuntimeSourceTree output through the
    deploy: every test injects the closure materializer, so the actual
    fetch/SRI/layout/evaluate path is exercised only by upstream's tests at the
    vendored pin.
  3. The probe has never been driven by a hub. The executor is wired and
    typechecks; no workflow.probe.request frame has reached it.
  4. The pinned tool-package arm was left in place deliberately. Upstream went
    all-source-tools (req.agent.toolFactories); workbench's agent-runtime pins
    tool packages instead, so materializeStepTools stays. Whether the
    source-format deploy still stages a tool-packages-manifest.json for those
    pins is the first thing an end-to-end run will answer.

Stacked on cl-6324-deployathead-convert.

Sawyer Cutler added 3 commits August 20, 2026 01:03
The deploy frame no longer carries a definition, so every sidecar test
that built one now stages a source-ref pin and registers what the pinned
closure evaluates to through an injected materializer. The lifecycle
suite asserts the new contract directly: an onTrigger body's sources.json
is staged and its definition is not, the child's env carries the
materialized closure dir and the hub-approved wire hash, and the durable
record carries the pin a restore re-materializes from. The step-coverage
gate moves with it -- the frame's arktype can no longer narrow a table it
cannot see, so coverage is checked against the closure-derived
definition.
The sidecar no longer writes a definition into its deploy tree and reads
it back. A deploy materializes the frame's frozen closure, evaluates the
pinned code, and runs THAT; the boot-time restore re-materializes the same
pin and re-derives the same definition, so both paths reach the runnable
definition by one computation. The child gets the closure dir plus the
hub-approved wire hash it re-verifies its own projection against, and the
durable record carries the pin a restore replays.

The pieces that make it executable:

- Closure staging (`workflow-host-wiring/closure-staging.ts`) owns the
  durable per-deployment source stores, the mount resolution both paths
  derive from the pin alone, and the apply. Injectable so a test can stand
  in for fetch + SRI-verify + layout + evaluate.
- A `WorkflowProbeExecutor` is wired at the boot edge, so a probe answers
  with a real inert projection and its wire hash instead of the hub-link's
  rejecting placeholder. Its airlocked child, the closure materializer, the
  closure apply, and the inline source-asset delivery come from upstream's
  own sidecar at `4ed8baf4` (see VENDORED.md).
- Child spawns are in-memory: a rung lifts its inline children to refs and
  serves grandchildren from that map, so no rung reads a definition off
  disk at any depth.
- `WORKFLOW_DEFINITION_REPO_ID`/`_REF` are gone. What survives is
  `WORKFLOW_DEFINITION_ID` — identity for the run-authenticated
  capabilities route a step tool calls, never a repo to read from.
Closes the three sidecar rows on the conversion table and records what
the conversion did not prove: no run has executed end to end, the MCP
credential-handle defect still gates a real launch, every test injects
the closure materializer, and the pinned tool-package arm was left in
place deliberately where upstream went all-source-tools.
@TheGreatAxios

Copy link
Copy Markdown
Contributor Author

Landed via the stack tip: PR #108 (merge fbf0852) contains this branch's commits in full.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant