[Story-1220] WS launch path for atlas_intake_review — clerk-rail routing + run.accepted frame (ADR-110 T8)

Story 1220Epic None6 files · +332/−15

PR #311 · pramaan-io/pramaan-functions · merged 2026-06-12

Why this matters

The client fires a launch command — and hears nothing back. No run.accepted, no receipt, no proof the run is live.

Story nine-eighty-eight

Wrong rail — run queued, nobody home.

The fix — Clerk rail, form ID, run accepted — every atlas intake lands on the right counter, and the client always gets its receipt.

How it flows

sequenceDiagram
  autonumber
  participant client as Client
  participant router as Router
  participant worker as Worker
  client->>router: launch + form_id
  router->>router: pick clerk queue client for atlas_intake_review
  router-->>worker: enqueue on clerk rail
  router->>client: run.accepted
  client->>client: resume context

router_ws.py + settings.py

Methodin → outwhat it does
_clerk_queue_client() → AgentsRunQueueClientreturns the queue client bound to the clerk rail
_queue_client_for(agent_key) → AgentsRunQueueClientpicks the right queue client for a given agent key
resolved_clerk_runs_queue_url() → strresolves the clerk queue URL from settings

What changed, file by file

WebSocket router that wires the launch path for atlas_intake_review; adds a clerk-rail queue client and a per-agent queue client picker so the run lands on the right rail and the client gets a run.accepted frame.

new methodsignature
_clerk_queue_client() → AgentsRunQueueClient
_queue_client_for(agent_key) → AgentsRunQueueClient
New fields: form_id : str | None

Agent command models that carry a form_id field, so each launch command is stamped with the form it belongs to and the router can route it accordingly.

New fields: form_id : str | None

App settings that add a configurable clerk runs queue URL and a resolver for it, so the clerk rail's address is not hardcoded into the router.

new methodsignature
resolved_clerk_runs_queue_url() → str
New fields: clerk_runs_queue_url : str | None

Files changed (6)

File±
docs/walkthroughs/story-1220-walkthrough.html+46
src/app_api/router_ws.py ★+59 −4
src/shared/agent_commands.py ★+19 −9
src/shared/settings.py ★+12
tests/unit/test_agent_commands.py+77
tests/unit/test_router_ws.py+119 −2