Skip to content

docs: ADR 0252 — HTTP steer endpoint - #874

Merged
kantord merged 5 commits into
mainfrom
add-more-adrs
Aug 31, 2026
Merged

kantord merged 5 commits into
mainfrom
add-more-adrs

Conversation

@kantord

@kantord kantord commented Aug 31, 2026

Copy link
Copy Markdown
Member

What

The decision record for the HTTP steer endpoint follow-up ADR 0232 named on the way out. Docs only — no production code.

Adds ADR 0252 and its index entry.

Why

Mid-run steer is gRPC-only today. ADR 0232 states this explicitly:

gRPC-only v1. ... HTTP/SSE and ACP steer are deferred — ... a unary POST .../steer (mirroring approve/cancel) is the cheap follow-up shape.

approve and cancel already have unary HTTP endpoints; steer does not — not because of a hard limit, just because the "cheap follow-up" was never filed as tracked work. It now is: #873.

The decision

  • POST /v1/sessions/{id}/steer + POST /v1/sessions/{id}/steer-cancel, mirroring the existing approve/cancel HTTP routes and the cancel-child hyphenation convention.
  • Same request contract as the gRPC oneof arm (steer text, client-minted message_id, optional expected_run_id).
  • Same SteerOutcome enum over HTTP as the gRPC ack; a stale expected_run_id is a 409 application/problem+json, code stale_run_control, reusing the ADR 0248 registry.
  • No engine change — purely a new transport entry point into the existing Service.Steer/Service.CancelSteer calls. The steer inbox, mutex, and promote-on-terminal-race mechanics in ADR 0232 are untouched.
  • Deliberately minimal on the promoted-run case: the response carries just the new run_id; the client polls/attaches separately to follow it. Not mandating a specific attach mechanism keeps this small endpoint independent of Scenario 7 (WatchSessionEvents, not yet built).
  • ACP steer stays out of scope — a structurally different problem (no mid-run channel in the protocol at all), not a small transport add like this one.

Verification

  • go test ./docs/lint/... — green.
  • No production code, so task test is unaffected.

Refs #873, #821.


Fully or partially written by an AI agent.

@kantord
kantord marked this pull request as ready for review August 31, 2026 13:04

@samuv samuv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed against the code on main (a1f987db). The decision is right and the surface it assumes does exist — worth landing. Four specifics don't match the implementation, and one of them specifies a liveness bug rather than a trade-off. Details inline.

What checks out

  • 0252 is the next free number — 0251-multimodal-steer is the highest on main.
  • "No change to the engine" is true. Service.Steer (internal/adapter/server/service.go:3672) and Service.CancelSteer (:3781) exist with exactly the shape assumed.
  • stale_run_control -> codes.Aborted / 409 exists (internal/adapter/server/errorcodes.go:80), and the mapping is more complete than the ADR claims — see the note on L58.
  • Independence from Scenario 7 holds. HTTP handlers use hand-written body structs (approveBody), not proto, so there's no harness.proto edit and no contracts/gen contention with sdk/07.

Findings, severity order

  1. L92-99 — blocking. The promoted-run case as specified wedges the run. Service.Steer returns a registered run that "the caller must drain + FinishRun"; returning just a run id leaves nothing draining its event channel, and its events never reach the durable log. HTTPHandler.approve already solves this and is the precedent to copy.
  2. L50. The request contract drops parts, contradicting both its own "same request contract as the gRPC frame" claim and ADR 0251 (multimodal steer). A day-one capability regression for exactly the browser clients this endpoint is for.
  3. L67. "Discover it by 404ing" runs against the feature registry landed in #823. This is #821-family work, so by that registry's own contract it owes a row.
  4. L47. steer-cancel is backwards from the cancel-child convention the bullet cites. Minor — but the string is permanent once published.

Plus two mechanical items noted on the README line (rebase source + stale llms.txt).

Findings 1 and 2 are the ones worth fixing in the ADR text before it becomes the spec someone implements — 1 because it specifies a wedge, 2 because it locks in a regression. 3 and 4 are cheap. Not requesting changes, since none of this touches the decision itself.

Comment thread docs/adr/0252-http-steer-endpoint.md Resolved
Comment thread docs/adr/0252-http-steer-endpoint.md Resolved
Comment thread docs/adr/0252-http-steer-endpoint.md Resolved
Comment thread docs/adr/0252-http-steer-endpoint.md Resolved
Comment thread docs/adr/0252-http-steer-endpoint.md Resolved
Comment thread docs/adr/README.md Resolved
kantord and others added 3 commits August 31, 2026 15:57
Extends ADR 0232's named deferral: POST /v1/sessions/{id}/steer +
steer-cancel, mirroring approve/cancel, reusing the RFC 9457 registry
for stale-control rejection. No engine change — pure transport
addition over the existing Service.Steer/Service.CancelSteer calls.

Docs only; implementation tracked separately.

Refs #873, #821.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Per samuv's review: fix the promoted-run wedge (drain via the same
approve-handler REHYDRATE precedent instead of handing back a bare
run_id), carry multimodal parts in the request contract (ADR 0251),
add a feature-registry row instead of discover-by-404ing (PR #823),
and rename steer-cancel to cancel-steer to match the cancel-child
verb-first convention.

Fully or partially written by an AI agent.

Co-Authored-By: Claude <[email protected]>
@kantord

kantord commented Aug 31, 2026

Copy link
Copy Markdown
Member Author

Addressed all four findings, rebased onto main:

  1. Promoted-run wedge (blocking) — fixed. The HTTP handler now follows approve's existing REHYDRATE-path precedent: relay the promoted run as SSE when the client can flush, else drain it in the background into the durable log and deregister it. Never a bare run_id with nothing consuming it.
  2. Dropped parts — fixed. Request contract now carries the same parts array the HTTP prompt body already accepts, matching ADR 0251.
  3. Discoverability via 404 — fixed. This ADR now adds a FeatureHTTPSteer = "http_steer" row to PR feat(server): add GetCompatibilityInfo, the feature registry, and --deployment-id #823's feature registry instead.
  4. steer-cancel naming — fixed, renamed to cancel-steer to match cancel-child's verb-first convention.

Also regenerated llms.txt after the rebase. Thanks for the thorough pass — #1 in particular would have been a nasty one to hit in implementation.

Fully or partially written by an AI agent.

kantord and others added 2 commits August 31, 2026 16:10
Per samuv's review thread on the 409 bullet: name both refusal
paths funneling through stale_run_control explicitly (an
expected_run_id naming a non-current run, and strict steer's
deliberate non-promotion on a terminal named run) rather than
leaving the second implicit.

Fully or partially written by an AI agent.

Co-Authored-By: Claude <[email protected]>
Per samuv's review thread: state explicitly that steer parts reuse
toContentParts/session.NewContent/ValidateMediaParts and the same
ProviderCapabilities() gate as the ACP prompt path, not a second
validation path.

Fully or partially written by an AI agent.

Co-Authored-By: Claude <[email protected]>

@samuv samuv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving — all six findings from my earlier review are addressed, and I verified the fixes against the code rather than the replies.

  • Promoted-run wedge (the blocking one): the new bullet quotes Service.Steer's own "must drain + FinishRun" and follows HTTPHandler.approve's REHYDRATE precedent — flusher → relayRunSSE, no flusher → background drain into NewRunEventRecorder + deregister + ack. The promoted run's events now reach the durable log either way.
  • Multimodal: parts added, routed through toContentParts → session.NewContent + session.ValidateMediaParts, gated by the same ProviderCapabilities() check the ACP prompt path uses. No second validation path.
  • Discoverability: FeatureHTTPSteer = "http_steer" in allFeatures; the 404-probing line is gone.
  • Route naming: cancel-steer, and it now states the rule ("the verb leads, the noun follows") rather than only citing the precedent.
  • The two refusals: spelled out, and it flags case 2 as the one that inverts the promotion default described later in the same document — clearer than what I asked for.
  • Mechanical: rebased, llms.txt regenerated.

Two things worth calling out beyond the checklist. First, the Consequences section was corrected alongside the Decision — I hadn't asked for that, and skipping it would have left the document contradicting itself (the old bullet declared the wedge an accepted cost). The residual it now states — that a client wanting to keep watching the promoted run past this response still polls/attaches, "not a correctness gap" — is accurate. Second, all six newly-cited symbols exist in non-test code, go test ./docs/lint/... passes, and CI is green across all seven non-skipped checks including Docs (matlatl).

One narrow thing left for the implementing PR (#873), not a blocker on the decision record: on the promoted + flusher path the response body is text/event-stream, so there is nowhere for the 200 JSON SteerOutcome body this ADR promises — yet that is precisely the path where a client most needs too_late + promoted + the new run id. relayRunSSE already takes a notice parameter that emits a pre-flight event ahead of the run's own stream (the prompt path passes RecoverNotice through it), so the mechanism exists; it just needs naming somewhere. Arguably an implementation detail rather than an ADR-level decision, which is why it is not blocking here.

@kantord
kantord merged commit aea3342 into main Aug 31, 2026
22 checks passed
@kantord
kantord deleted the add-more-adrs branch August 31, 2026 15:21
kantord added a commit that referenced this pull request Aug 31, 2026
Per samuv's review: fix the "over HTTP" transport category error
(the vendored automocker covers unary gRPC, not the hand-written
JSON HTTP endpoints), name the sdk/typescript/ ordering dependency
on #821 and the missing TS CI gate, correct #618's tense (open, not
merged) and adopt its SPDX-guard pattern scoped to sdk/, and record
the header rewrite as an authorized relicense (Stacklok holds
copyright on both sides) rather than a bare header edit.

Also reframes scope explicitly: the SDK's own testability (near-term
deadline) and Studio's eventual HTTP/JSON mocking needs (later,
architecture undecided) are separate, coexisting concerns. This ADR
only needs to unblock the former.

Rebased onto main (#874 merged) and regenerated llms.txt.

Fully or partially written by an AI agent.

Co-Authored-By: Claude <[email protected]>
kantord added a commit that referenced this pull request Aug 31, 2026
* docs: ADR 0253 — SDK mocking testkit

Vendor (not npm-depend on) the proven unary Connect-RPC handler
pattern + AutoAPIMock core; defer streaming/bidi mocking (Converse,
the stale-run-control race) as a named residual. Lives inside
mecatl's own SDK tree for now, no shared package yet.

Docs only; implementation tracked separately.

Refs #872.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* docs: address review feedback on ADR 0253, rebase onto main

Per samuv's review: fix the "over HTTP" transport category error
(the vendored automocker covers unary gRPC, not the hand-written
JSON HTTP endpoints), name the sdk/typescript/ ordering dependency
on #821 and the missing TS CI gate, correct #618's tense (open, not
merged) and adopt its SPDX-guard pattern scoped to sdk/, and record
the header rewrite as an authorized relicense (Stacklok holds
copyright on both sides) rather than a bare header edit.

Also reframes scope explicitly: the SDK's own testability (near-term
deadline) and Studio's eventual HTTP/JSON mocking needs (later,
architecture undecided) are separate, coexisting concerns. This ADR
only needs to unblock the former.

Rebased onto main (#874 merged) and regenerated llms.txt.

Fully or partially written by an AI agent.

Co-Authored-By: Claude <[email protected]>

---------

Co-authored-by: Claude Sonnet 5 <[email protected]>
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.

2 participants