Skip to content

Coding-agent subagents A0: spike — detached sync /runs prompt leaves on the #370 VM and the #426 K8s stack #379

Closed as not planned

Description

@pdettori

Part of the Coding-agent subagents epic (#378). Item A0: it decides whether Track A goes ahead. It builds on #370's VM, and runs the same probe on the #426 K8s stack.

Goal

Prove on the #370 VM, and on the #426 K8s stack (deploy/k8s, Kind or OCP), that a synchronous POST /runs {kind:"prompt", configRef} keeps running after its client disconnects, and that its result can be read later with a fresh session token. Record a go/no-go for Track A's mechanism: a coding-agent subagent is a prompt leaf fired as a sync /runs from a detached local process.

Current state (verified on main @ 24c6f5e)

  • Disconnect handling:
    • /turn wires res.on('close') to an abort (packages/knative-server/src/server.ts:293-302), so mocactl run can't detach.
    • /runs doesn't. handleRunLeafParsed runs runLeaf to the end, then writeResult, then responds (server.ts:624-667).
  • Result records:
    • Under authentication tenant is refused (server.ts:834), so the key is the plain session id. It's written at :663 and read by /runs/status at :677.
    • The TTL is 24 h (LEAF_RESULT_TTL_SECONDS, server.ts:49).
    • A missing record reads as queued (:678-680).
  • Authentication:
    • /runs authenticates like /turn (MI1 R7). It needs a session token that names the session: 5 min (packages/control-plane/src/main.ts:81), minted with POST /v1/sessions/{id}/token, and checked when the request starts.
    • Async is refused with 501 async_runs_unavailable (server.ts:838-850).
  • Bundle:
    • configRef in a /runs body is accepted under authentication today. MI1 S3's configRef_forbidden isn't built.
    • Only prompt leaves read it (harness/src/run-leaf.ts:468, inside runPromptLeaf, :361).
  • Sandbox routing on P6:
    • Prompt leaves lease through selectPoolSandbox and the relay (ADR-0028 amendment; deploy/vm/env/supervisor.env.example:13-22). The pool cap is 4 (:22).
    • On saturation, sync /runs waits a bounded time and then returns 503 without writing a record (server.ts:638-658).
  • P6 admission counts only /turn (packages/knative-server/src/worker.ts:37, :117), so a leaf on /runs isn't tracked as in flight.

Scope

On the VM (or the compose trial), and again on the #426 K8s stack, with one logged-in subject:

  1. Create a session and a session token. POST a 3–5 minute research prompt leaf with a promoted configRef. Kill the client after 10 s.
  2. Poll /runs/status?sessionId= with a fresh session token until responded. Confirm from the answer, and the worker logs if needed, that a bundle skill was used and that curl/git ran in the sandbox.
  3. Run 6 leaves at once, above cap 4, and record what saturation looks like (a 503 before start, or a wait).
  4. Restart sh-supervisor while a leaf is running and record the outcome. Expected: the leaf is lost and status stays queued. On K8s, the equivalent is deleting the moca-supervisor pod.
  5. Optional: repeat steps 1–2 on the P4 tier if VM demo D: wire the P4 microVM worker into P6 and run its first real harness turn #369 has landed.

Acceptance

  • A findings note in docs/notes/ with the go/no-go and evidence for each behavior above, per substrate. The go/no-go can differ per substrate only with a stated reason.
  • If it's a no-go, the note names the fallback. For example, keep a laptop-side connection, which turns the demo into "quit Claude Code" rather than "close the lid".

Out of scope

  • Code changes (A1 pins the behavior; B4 replaces it).

Depends on

References

Working conventions (for a fresh session)

  • Workspace: git fetch, then create a worktree from rossoctl/main (never local main), under .worktrees/. Populate and build pi-fork (git submodule update --init --recursive && cd pi-fork && npm ci && npm run build), then pnpm install. A worktree without the pi-fork build does not typecheck.
  • Plans: write the plan with superpowers:writing-plans into docs/plans/<date>-<slug>.md. Plans are gitignored and never committed. Write it in chunks, one append per task.
  • Pre-flight table: list every process entrypoint, systemd unit, env example and shell/Go launcher whose boot contract changes, not only TypeScript call sites.
  • Tests: Redis on 6379 must be up. Use each package's own node_modules/.bin/vitest. vitest can exit non-zero with every test green, so grep the log for Errors. Redirect long output to /tmp/kagenti/.... make lint skips untracked files.
  • Commits: git commit -s with Assisted-By: Claude (Anthropic AI) <[email protected]>, never Co-Authored-By.
  • Shared KVM rig: alert the owner before using it, record a manifest of what you install, and verify cleanup.
  • Don't push or open PRs without the owner's go-ahead.

Activity

  1. added
    enhancement
    on Sep 30, 2026
  2. changed the title [-]Claude Code subagents A0: spike — detached sync /runs prompt leaves on the #370 VM[/-] [+]Claude Code subagents A0: spike — detached sync /runs prompt leaves on the #370 VM and the #426 K8s stack[/+] on Oct 5, 2026
  3. changed the title [-]Claude Code subagents A0: spike — detached sync /runs prompt leaves on the #370 VM and the #426 K8s stack[/-] [+]Coding-agent subagents A0: spike — detached sync /runs prompt leaves on the #370 VM and the #426 K8s stack[/+] on Oct 13, 2026
  4. pdettori commented on Nov 16, 2026

    @pdettori
    MemberAuthor

    Closing as superseded.

    Step 3 (saturation) and step 4 (restart) belong as one line each in #380's contract text rather than in a separate spike.

  5. added this to the v0.11.0 milestone on Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions