Repository navigation
docs: record archetype A's P6 equivalent as shipped (#690) - #764
Conversation
Review nit on leaf-drain-loop.ts: the non-blocking claim means an armed-but-idle loop polls every 250 ms, which is about 8 Redis commands/s per turn worker (XAUTOCLAIM + XREADGROUP), multiplied by SH_WORKERS and by replicas -- where it used to be one BLOCK 5000 every 5 s. The arithmetic is right; the load is not worth a curve at M1's scale (one VM or one compose stack against a single Redis, a fraction of one percent of a Redis core). An exponential idle backoff also costs pickup latency for a submission landing on an idle fleet and delays the reclaim scan that leads every claim, so it is recorded as a shortcut with its upgrade trigger rather than taken now. DEFAULT_IDLE_BACKOFF_MS now carries the arithmetic, the upgrade condition and the note that idleBackoffMs is already injectable (no new knob needed), and spec §5.3 states the aggregate instead of "a few commands a second". Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: cwiklik <[email protected]>
Three documents still asserted on main that async fan-out has no P6 consumer. rossoctl#717 landed the drain loop, so each one was wrong in a way an operator would act on: - `docs/concepts/dispatch-archetypes.md`: archetype A's row said the path does not run on P6. Replaced the combined A/C section with a shipped-path section -- how to turn the drain on per deployment, the submission and collection routes, what changed from the KEDA path, and the three named limits (single tenancy, deploy/k8s unproven, turn_exp in M2). - `docs/reference/http-api.md`: the `async: true` bullet said the consumer "is not" implemented. It now states the two conditions under which the replacement route works, and the control-plane route table lists the async-turn routes, which it never did. - `docs/adrs/0041`: the accepted-cost bullet owed archetype A in full. Discharged for `MOCA_TENANCY=single`, with a dated revision recording what shipped and what the two remaining limits are. rossoctl#690's scope item 1 (the migration guide) is moot: that guide was deleted with the path in rossoctl#691. Its mention of a `LEAF_RESULT_TTL_SECONDS` replacement is also moot -- the same variable and default serve both the sync and async paths, so the docs say that rather than invent a successor. The configuration reference already documents `SH_ASYNC_DRAIN` and the drain's two prerequisites; rossoctl#717 did that work. Also carries the cherry-picked round-three nit fix from PR rossoctl#717 (the idle backoff's rationale), which was pushed 38 minutes after that PR merged and so never reached main. Refs rossoctl#686 Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: cwiklik <[email protected]>
Review of rossoctl#764 against the code found one wrong instruction and an incomplete sweep. Wrong: the archetype A section said the drain "writes the result where `GET /runs/status` already looks". It does not. The drain writes `leaf:result:<sessionId>:<turnId>` (leaf-job-runner.ts:202-208, the `claimed.turnId` argument) and `/runs/status` reads `leaf:result:<sessionId>` with no turn id (server.ts:1168), so an operator following that sentence polls a route that answers `{"status":"queued"}` on a finished turn forever. Spec section 10 already records `/runs/status` as untouched; the docs now say so too, here and in leaf-and-envelope.md. Incomplete: four more documents still asserted the path is unimplemented, including the README, which is the one a user reads first -- `README.md` (three places), `docs/get-started/index.md` ("not supported yet"), `docs/reference/maturity-and-lifecycle.md` (the Kubernetes criteria row and "Removed paths"), and `docs/reference/leaf-and-envelope.md` ("the drain loop that does so is rossoctl#389"). Each now states the shipped path with its two conditions and points at the concepts doc for the operator steps, rather than repeating them. Also from the review: - ADR-0041's new revision claimed the drain "runs on" deploy/k8s and then walked that back two paragraphs later. It now says runs on vm and compose, wired on k8s, and states the two limits once instead of restating what the concepts doc already carries. - "the result once one exists" was imprecise: the handler withholds a result until the record is terminal (turn-handlers.ts:208-211), deliberately, so a dead worker's result is not served as an answer. - Bumped the preview banners on the two reference pages whose async content this change touches; they still read 2026-10-12. Refs rossoctl#686, rossoctl#690 Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: cwiklik <[email protected]>
ingpaolodettori-dev
left a comment
There was a problem hiding this comment.
Docs-only follow-up to #717 (closes #690): flips archetype A from "not on P6" to "works, opt-in" across README, ADR-0041, dispatch-archetypes, get-started, http-api, leaf-and-envelope and maturity-and-lifecycle, plus the cherry-picked #717 idle-backoff comment. I checked the operator claims against main d15b807: SH_ASYNC_DRAIN gating and its log-and-stay-off prerequisites (leaf-drain-loop.ts:83-102), the per-deployment wiring (supervisor.env.example, compose SH_ASYNC_DRAIN: ${SH_ASYNC_DRAIN:-}, the k8s moca-settings optional key), the 429/501/409 codes (control-plane errors.ts), the shared SH_TURNS_PER_WORKER cap (asyncLeafCap), the one-hour record margin (TURN_RECORD_TTL_MARGIN_SECONDS), the async_queue_depth/async_oldest_age_ms counters and MIN_IDLE_MS = 90 s. All of them hold.
One suggestion, inline: /runs/status does answer for an async turn's session. It just answers wrong.
Author: cwiklik (MEMBER, maintainer)
Areas reviewed: Docs, one TS comment
Agent/IDE config (.claude/.vscode): none
Commits: 3, all signed off
CI status: all 17 checks green
Assisted-By: Claude Code
| and unimplemented). A worker claims one queued turn at a time, runs it through the same `runLeaf` the | ||
| synchronous route uses, and writes the result under that turn's own key, read back by | ||
| `GET /v1/sessions/{id}/turns/{turnId}`. The data plane's `GET /runs/status` is deliberately | ||
| untouched and never answers for an async turn (spec §10): it reads the session-wide result key, and |
There was a problem hiding this comment.
suggestion: "never answers for an async turn" undersells what a caller will see. handleLeafStatus (server.ts:1161-1171) reads leaf:result:<sessionId> and answers 200 {status:'queued'} when that key is missing. So an orchestrator that ports its KEDA-era polling to GET /runs/status?sessionId=… gets queued forever. If the same session ever ran a sync /v1/runs leaf, it gets that leaf's result instead, which looks like a real answer. Suggest saying so directly, e.g. "…never reports an async turn: it answers queued (or the session's last synchronous result), so poll GET /v1/sessions/{id}/turns/{turnId} instead". The same wording is at leaf-and-envelope.md:128.
There was a problem hiding this comment.
Fixed in 3bc49da. You are right that "never answers" reads like a failure the caller would notice, and it is not one: the missing-key branch returns 200 {"status":"queued"}, and the stale-sync-result case is the dangerous one because it looks like a real answer. Both spots now say that explicitly and point at the turn route. Wording is slightly longer than your suggestion because the sync-result case needed its own clause.
Review of rossoctl#764 was right that "never answers for an async turn" undersells the hazard. handleLeafStatus (server.ts:1161-1171) returns 200 {"status":"queued"} when leaf:result:<sessionId> is missing, so an orchestrator that ports its KEDA-era polling to /runs/status gets `queued` forever rather than an error it would notice. Worse, if that session ever ran a synchronous /v1/runs leaf, the key exists and the route returns that leaf's result, which reads like a real answer for the async turn. Both places that carried the old wording now say so, and point at GET /v1/sessions/{id}/turns/{turnId}. Refs rossoctl#686, rossoctl#690 Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: cwiklik <[email protected]>
ingpaolodettori-dev
left a comment
There was a problem hiding this comment.
Follow-up to our 619f47e review. 3bc49da closes the one suggestion. I checked the new wording against the code. handleLeafStatus (server.ts:1161) answers 200 {"status":"queued"} when leaf:result:<sid> is missing. The sync /v1/runs writer (server.ts:1140) writes that session-wide key, and the async drain (turn-claim.ts:165) writes the per-turn leaf:result:<sid>:<turnId> key. So both the "queued forever" claim and the "stale sync result" claim are accurate. No further comments.
Author: cwiklik (MEMBER, maintainer)
Areas reviewed: Docs. Incremental diff only, 619f47e..3bc49da
Agent/IDE config (.claude/.vscode): none
Commits: 1 new, signed off
CI status: green except deploy-scripts, which hit the job's 5-minute timeout. The diff is docs-only, so please re-run that job.
Assisted-By: Claude Code
Closes #690. Refs #686.
Three documents on
mainstill assert that async fan-out has no P6 consumer. #717 landed thedrain loop, so each of them is now wrong in a way an operator would act on.
What changed
docs/concepts/dispatch-archetypes.md— archetype A's table row went from "Neither runs on P6today" to Works, opt-in:
SH_ASYNC_DRAIN=1,MOCA_TENANCY=single. The combined A/C section isreplaced by a shipped-path section:
--role=turnworker (--role=leafstaysreserved and unimplemented), where
SH_ASYNC_DRAIN=1goes per deployment (supervisor.env,.env, themoca-settingsConfigMap), and the concurrency story: a worker runs one queuedleaf at a time, and claims it only while its total in-flight count — async plus interactive — is
below
SH_TURNS_PER_WORKER.POST /v1/sessions/{id}/turns→202,GET …/{turnId}for state andresult,
DELETEto cancel whilequeued, with the 429/501/409 codes named.scale-to-zero and queue-depth scaling are dropped, so fan-out width is
SH_WORKERS× replicas,sized ahead of the load, and queue depth is an operational metric.
deploy/k8swired but unproven (P6 async fan-out: wire the async leaf consumer into deploy/k8s (Kind and OCP overlays) #688),turn_expin M2.docs/reference/http-api.md— theasync: truebullet no longer says "the consumer that drainsthe queue is not" implemented; it states the two conditions under which the replacement route works.
The control-plane route table now lists the async-turn routes, which it never did.
docs/adrs/0041— the accepted-cost bullet owed archetype A in full. It is now discharged forMOCA_TENANCY=single, with a dated2026-11-12revision recording what shipped and the two limitsthat keep it short of a full clear. The 2026-11-06 revision's "nothing is implemented yet" is
reconciled so the two agree.
Two of #690's scope items are moot, not done
docs/migrating-from-knative.md, which was deleted with the path inchore: remove the deprecated Knative/KEDA deployment path (ADR-0041) #691. Nothing to point at the epic.
LEAF_RESULT_TTL_SECONDS. Nothing does — the same variable and the same24 h default serve the sync
/runspath and the async drain alike, so the docs say that ratherthan invent a successor.
SH_ASYNC_DRAINand the drain's two prerequisites;feat(knative-server): async leaf worker on P6 (#389 M1) #717 did that work, so it needed no change here.
Note on the extra commit
This branch also carries
9693ff3e, cherry-picked: the round-three nit fix from #717 (the idlebackoff's load rationale, in the constant's own comment and spec §5.3). It was pushed 38 minutes
after #717 merged, so it never reached
main. Verified withgit merge-base --is-ancestor— it is not an ancestor ofmain.Testing
Docs only, no code change.
SKIP=hadolint-docker make lintis clean (prettier realigns the touchedmarkdown tables on the first pass).
Assisted-By: Claude Code