Skip to content

Coding-agent subagents B7: gates v2 — gates on prompt/solve leaves, decision API, deadlines #393

Closed

Description

@pdettori

Part of the Coding-agent subagents epic (#378). Item B7, milestone B-M2. Depends on B2 (#387) and B4 (#389).

Goal

Any subagent can stop and ask its owner. The owner answers through one control-plane call from any logged-in client, with no envelope to keep and no session token to juggle. A gate that nobody answers resolves by a deadline.

Current state (verified on main @ 24c6f5e)

  • Only converge leaves can gate: request_approval is registered only in realProduceVerdict (harness/src/run-leaf.ts:706, :830).
  • The paused record carries gateId and gate: {summary, proposed_action} (packages/knative-server/src/server.ts:692-696).
  • Resume means the client resends the whole envelope with an inline decision (ADR-0020, run-leaf.ts:104) over data-plane /runs, with a session token. An async resume gets the 501.
  • No deadline (ADR-0016 leaves timeouts to the orchestrator, and here the orchestrator may be a closed laptop).
  • P4 microVM tier: WorkspaceIdle=30min deletes a HITL session's workspace mid-session, silently #338: on the P4 tier, WorkspaceIdle=30min deletes a parked session's workspace.

Scope

  1. request_approval available to prompt and solve leaves, opt-in per turn, through the shared turn core (executeTurn).
  2. A control-plane POST /v1/sessions/{id}/decision {gateId, action, feedback}. It checks the pending gateId and queues the resume as an async turn built from the stored turn record.
  3. A gate deadline with a default action (reject or abort), stored in the turn record and fired without an always-on watcher. For example, enforce it at the next dequeue or through a scheduled sweep; justify the choice against scale-to-zero.
  4. Resolve P4 microVM tier: WorkspaceIdle=30min deletes a HITL session's workspace mid-session, silently #338 for parked sessions: keep the workspace while paused, or re-converge on resume, and document which.

Acceptance

  • A prompt subagent stops, and a decision through the API resumes it asynchronously.
  • A stale gateId is refused.
  • The deadline fires the default action.
  • A P4 session parked for more than 30 min resumes correctly.

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions