Repository navigation
Conversation
GPT 6.1 Review — 🔴 changes requested (blocking)GPT 6.1 found at least one blocking issue that must be resolved before merging This comment is updated in place on each push. BLOCKING -- test/test_cli_restart_headless.py:561 -- Expected failures accept headless-restart regressions
[BLOCK-MERGE] 9faee13 Adjudication (Opus 5.5) — is blocking on each finding proportionate?F1 (fenced): The required conditions are rare and the failure is visible.
🏷️ Fenced finding(s) machine-flagged as likely edge caseThe security fence keeps these findings blocking regardless of adjudication; the only clearance path is a human override. The annotate-only pass judged the condition combination each one requires extreme, and pre-drafted the override rationale below. A repository writer must independently verify a rationale before posting it — it is machine-authored, and a wrong override on a security-class finding ships exactly the class the fence exists to stop.
Replace False positive or not applicable? A repository writer can comment: |
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks. Bearer auth only on Notes
[DESIGN-REVIEWED] 9faee13 Description read[DESCRIPTION-READ] fc384ec246ba554f8c04537ce2169f91841c2de1599ff09d1ac1c9b2ace06ce1 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. The Not checked: whether Notes
What this change shipsInventory (9 items) — 6 justifiedIntent: a program on the same machine calls the gateway's
[FIRST-PRINCIPLES-REVIEWED] 9faee13 Description read[DESCRIPTION-READ] 8c5f6d603b757e4a4db24c55ed0f25310d64e612cbecd5c74c6b0f4991f39fcc That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — 🔴 changes requested (blocking)Reviewed
BLOCKING — src/kiro_crew/dashboard/crew_api_models.py:38 [BLOCK-MERGE] 9faee13 Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
69ed1c8 to
6fcf9e4
Compare
|
Pushed GPT review, blocking
First Principles notes
Design notes
|
6fcf9e4 to
dae7b8e
Compare
|
Pushed New test for the loopback fix. The test that read the source of Checked against a real gateway (this head, a fresh Linux machine, installed in a venv, its own data home): Headless, started with
Normal mode, every request carrying
Not checked on that machine: a streaming reply, which is not part of this pull request. |
|
Disposition for the review round on The gap. The repair routing for this repository asks that a finding from the GPT lane is repaired by a sub-agent pinned to a GPT-family model, and one from an Opus-family lane by an Opus-family sub-agent. I did not do that for this round. The working session that owns this pull request made every repair itself. It runs a Claude-family model (the session reports Claude Fable 5.2); no model-pinned sub-agent was used and no GPT-family model touched the code. The fixes are tested and are not being redone for form. From here on, each finding goes to a sub-agent pinned to the family the routing names, and the disposition will say which model served it. GPT 6.1 review lane
First Principles lane (notes, PASS) — both taken in Design lane (notes, PASS) — by the working session, in The listener test added after that round answers a request from the maintainer side, not a review-lane finding. |
dae7b8e to
d366be7
Compare
|
Disposition for the review of GPT 6.1 review lane
Start paths checked for the same hole (headless must reach the one path that binds loopback and mounts
These verdicts come from reading the source, not from running each launcher. Found by a test run against an earlier head, not by a review lane — headless answered 404 for every path outside
CI on The description above still words headless as serving only |
d366be7 to
a296ceb
Compare
|
Pushed A headless gateway stays headless across a CLI restart — raised from the maintainer side, not by a review lane; fixed in
Other ways a gateway comes back, read from the source (not run):
CI on Signature pins — The description is updated to this head. |
|
Replies to the two First Principles notes on Item 6, "delete
Item 8, "remove the mode record, or do not fail the boot when the write fails" — kept.
|
a296ceb to
a9ff9e4
Compare
|
Disposition for the reviews of Opus 5.5 review lane
GPT 6.1 review lane — all three repaired by a sub-agent pinned to GPT 6 Astra (served model unverified); the working session read the diff and reran the tests.
Design note (a proxy that adds its own Where a bearer on
|
a9ff9e4 to
5d218e5
Compare
|
Disposition for the review of GPT 6.1 review lane
Every message in the restart path that could name the dashboard, read from the source:
The headless boot itself does not reach the dashboard URL or the open-browser branch. |
5d218e5 to
5243bd9
Compare
9ee9067 to
75b7ccd
Compare
|
Disposition for the GPT 6.1 review of Blocking: The suggested fix (await the ordinary write before serving and refuse the start on failure) is still not available here: an ordinary start does no new work before it listens, and nothing is awaited between the listener and the ready line. A maintainer chose to narrow the restart instead. With no live gateway of the data home, a record that says headless cannot be told apart from one left behind by an ordinary gateway whose write failed. Both name a process that is gone. The lock file does not settle it either: it keeps only a pid, with no start identity, and a pid repeats across starts in a container. So the restart no longer guesses:
The refusal prints one line: So a headless gateway that crashed is no longer brought back by The decision is still one pure function. Tests, all in-process: its full table; the same rows through the foreground restart (nothing stopped, nothing spawned on a refusal) and through the service path; an undetermined lock probe kept apart from "no live gateway". Sixteen mutations of the rule were each caught. Repaired by a sub-agent pinned to |
75b7ccd to
6e12afb
Compare
|
Disposition for the Opus 5.5 Review finding on The finding is right. What changed
The class, not the line. The sub-agent listed every place that reads the headless flag ( Tests (
Specs: Not covered: the tests judge a login through The branch was rebased onto main with no conflict. 968 test files of the pre-push list ran locally; the 8 failures are ones that also fail on an unmodified main on this machine. |
6e12afb to
5ea7d68
Compare
|
Dispositions for the reviews on First Principles Review, note on item 9 (a dashboard cookie is pinned to its first address after a restart) — fixedThe note is right.
The repair ran on a sub-agent pinned to First Principles Review, blocker on items 5–8 (headless mode has no named harm) — waiting for a maintainerNot changed in this push. The choice between naming the harm in the description and an owner decision is the maintainer's. GPT 6.1 Review, downgraded finding at
|
A client other than the dashboard could not call the gateway: /v1 read its credential only from ?token= and the session cookie, and the gateway always served the dashboard. kirocrew gateway --headless serves /api/ and /v1/ alone, on loopback, with no pages, no browser and no sign-in link. A /v1/ path now takes its credential from Authorization: Bearer and refuses ?token=; the dashboard's own cookie still works there, and /api/ and the frozen /v1/chat/completions are unchanged. crew_api_auth.verify_bearer is the one place a bearer credential is judged. kirocrew token --bearer prints a session credential for such a client, and GET /v1/models lists the agents and Bots a turn can name.
The RFC's status line and the index row said only the Owner roster route was built.
5ea7d68 to
6b812e5
Compare
|
Disposition for the GPT 6.1 Review finding on The finding is right. A This is the fourth finding with the same root, after the stale record, the record without a pid, and the restart with no live gateway. Each time the restart guessed a mode while it could not tell which gateway it was looking at. This change removes the guess for the one state that was left: a live lock holder whose identity the record does not confirm. The rule now (foreground restart only;
What does not change: nothing is added to the gateway's boot path; the wait is in the CLI process. A gateway that is already listening is judged on the first look with no wait, including one started by an older version that left no record. A holder that never listens and is never named (for example a Tests ( Checks before this push: the full pre-push list (968 test files, 41,902 passed) ran after a rebase with no conflict. The 7 failures also fail on an unmodified main ( Not covered: the race was not reproduced against a real gateway; the tests model the holder, the record and the listeners in process. |
Merges main. Removes the gateway-mode.json record and both boot writes of it; a CLI restart of a foreground gateway reads the headless argument from the argv of the process holding this data home. Two rare lock states are pinned by xfail tests and deferred to #40328.
|
One sentence in the frozen Before:
After:
Why: Nothing else in |
class: a CLI restart decides the gateway's mode from a record the gateway writes about itself, instead of from the running gateway
The search has 25 hits on the judged head and none on 9faee13. resolution: removed -- gateway-mode.json, both boot writes of it and the restart waits on it are deleted; the restart reads the mode from the live lock holder's command line What replaced the record, and its limits:
The earlier dispositions on this pull request carry no marker, so the round count does not read them. The repair was written by a sub-agent pinned to claude-opus-5.5; the served model is unverified. |
Problem / Motivation
Goal: A Kiro Crew gateway can run with no dashboard, and a program on the same machine can call its
/v1API with a credential in theAuthorizationheader.Today a client other than the dashboard cannot use the gateway's
/v1routes. Token auth reads a credential only from?token=and the session cookie, so a stock OpenAI client, which sendsAuthorization: Bearer, gets a 401. The gateway also always serves the dashboard pages, and its only credential for a local program is a sign-in link that works for five minutes and has to be opened in a browser.Why it matters
The Crew API RFC (rfc-crew-api.md, status
partial) says requests carry a bearer credential and that an existing OpenAI client works by changing its base URL. Neither is true on main. Every later Crew API route, and every app that brings its own interface, needs this first.Not a goal
POST /v1/responses. It follows in its own pull request, built on this one.crew_api_auth.verify_bearerandcrew_api_auth.OWNER_ONLY_PUBLIC_ROUTESare where they plug in./api/*routes orPOST /v1/chat/completionsread their credential.What changed (motivation → approach → change)
Goal → approach → what was built:
/v1/. On a Crew API path (every/v1/path except the frozen/v1/chat/completions) token auth now readsAuthorization: Bearer <credential>and hascrew_api_auth.verify_bearerjudge it. The accepted credential is the session token the cookie already carries, checked the same way: signature in constant time, expiry, the revocation counter, the logout list. A one-time link is refused as not a session. A bearer request then runs the same pin check, app-scope check and audit as a cookie request; nothing is exchanged and no cookie is set. A header that fails is not rescued by a cookie sent beside it.?token=refused on/v1/. A URL is kept in logs and history, so a credential there is refused with a 401 whether or not it is valid.Authorizationheader a/v1/path still reads the session cookie, which is how the dashboard page calls/v1/crew/owner/bots.kirocrew token --bearer. Prints a session credential alone, for a client with no cookie jar. It asksGET /api/token/local?kind=session, which passes the same three gates as the link mint (loopback or same-principal socket, the local secret, the owner-process check). The same caller could already get this session by opening its link once and reading the cookie, so no boundary moves.kirocrew gateway --headless. Off by default. It starts the full gateway and adds one middleware, placed after the app and relay web-origin dispatch so an app at its own origin is still served, that answers 404headlessfor the dashboard's own page and the routes that can serve files outside the frontend build, named in one list (DASHBOARD_RESOURCESindashboard/headless.py), and for a path that matches no route and that the dashboard would answer with its page shell. The shared public build directories/assets/,/fonts/and/vendor/stay served. Every other registered route is served through the normal chain, so a route added later (local authorization, an app or embed route) is not dropped; a wrong method stays 405 and an unknown/api/or/v1/path gets what it gets on an ordinary gateway. The page fallback and the sign-in fallbacks serve no page on a headless gateway. No browser is opened, no sign-in link is printed. The primary socket is created on127.0.0.1whateverdashboard.urlorKIROCREW_BINDnames, and no direct tailnet listener is started; with the Shared Crew preview on, the access set that judgestailscale servelogins is still installed.--headlesswith--slack-onlyis refused before anything listens (exit 2 from the CLI; the gateway's constructor refuses the pair for every other caller), because--slack-onlystarts the reduced server, which has no/v1. A headless start does not fall into the browser-only sign-in server. What keeps--headlessacross a restart: the CLI restart of a foreground gateway, and the in-app restart and the restart after an update, which re-exec with the gateway's own arguments. The CLI restart keeps it by reading, before it stops anything, the command line of the process that holds this data home'sgateway.lock(cli_restart_headless.live_gateway_headless) and parsing it with the gateway's own argument parser; nothing is recorded on disk. When a gateway of this home is alive and its arguments cannot be established, the restart refuses and stops nothing. The decision table, per platform, is indocs/system-specs/modules/cli.mdunder the restart command. What does not: a gateway installed withkirocrew service installcannot be headless, because the systemd unit and the launchd agent carry a fixed command with no headless option; a follow-up pull request adds that. A gateway the desktop app supervises cannot be headless either. Two rare lock states in which a live headless gateway is restarted as an ordinary one, and one race shared with main, are deferred tokirocrew restartcan bring a live headless gateway back with the dashboard in rare lock states #40328 and pinned by twoxfail(strict=True)tests. Nothing in the restart path was run on Windows, on macOS, or on a btrfs or overlayfs data home.GET /v1/models. The first Public route, so the bearer path can be used end to end: the agents and Bots a turn can name, in the OpenAI list shape with acrewobject per row. Owner only for now.The alternative for the credential was to accept the existing sign-in link as a bearer. It was rejected: a link is printed and posted, and main deliberately refuses a link wherever a session is expected.
Backwards compatibility
Breaking:
?token=on a/v1/path other than/v1/chat/completionsnow answers 401. Writer sweep on origin/main @ 438cee9: the/v1/routes there are the Owner routes under/v1/crew/owner/and, after this change,GET /v1/models; no caller insrc/orwebsite/src/sends?token=to any of them.Reader: website/src/api/client/agents.ts:the roster read of
/v1/crew/owner/bots-- crew page -- sends the session cookie and no?token=;test_the_dashboard_cookie_still_works_on_the_crew_apiReader: src/kiro_crew/dashboard/token_auth_app_scope.py:the app-token refusal on
/v1/crew/owner/*-- app -- an app token in the header is still refused403 owner_only;test_an_app_token_in_the_header_is_still_held_to_its_scopeReader: src/kiro_crew/dashboard/openai_compat.py:api_completions -- app --
/v1/chat/completionsis outside the rule and keeps?token=;test_the_frozen_chat_completions_route_keeps_its_query_tokenTests
test/test_crew_api_bearer.py: no credential 401; malformed, empty, bad-signature and tampered bearer 401; a one-time link 401; a logged-out session 401;?token=on/v1/401 even when valid and whatever else is sent; a failing header is not rescued by a valid cookie; a valid bearer reaches the handler and sets no cookie; the middleware obeysverify_bearer; the cookie still works on/v1/;/api/ignores the header;/v1/chat/completionskeeps?token=.test/test_gateway_headless.py: the realstart_dashboardwithheadless=TrueandKIROCREW_BIND=0.0.0.0opens real sockets on127.0.0.1/::1only and starts no tailnet listener, and the same boot withoutheadlesskeeps both; walking the live route table of a headless boot, every resource in the removed list is refused and every other resource is not; routes at/.well-known/oauth-authorization-serverand/oauth/*reach their handlers;/chatand/settings/xanswer 404headlesswith no page and no redirect; a wrong method stays 405; an unknown/api/or/v1/path answers as on an ordinary boot; a 404 raised by a kept route is not turned into the page; the gateway's constructor refusesheadlesswithno_dashboard.test/test_cli_restart_headless.py: a live gateway whose command line parses with--headless(an abbreviation and every launch shape included) restarts with--headless; one that parses without it restarts with the same arguments as before; the text--headlessinside another argument's value does not count; a live gateway whose arguments cannot be read or parsed exits 1 before anything is stopped or started; a lock that is held with no pid named falls back to the fresh run record, and refuses without one; a probe that cannot tell whether the lock is held refuses when a Kiro Crew process listens on the port or no lookup tool exists; the mode is read before the stop;--portnaming another home's gateway does not change the mode. The lock guard after the stop is the real one. Two tests markedxfail(strict=True)pin the two states deferred tokirocrew restartcan bring a live headless gateway back with the dashboard in rare lock states #40328.test/test_gateway_headless.py,test/test_crew_api_models.py,test/test_crew_api_bearer.py(added with the review repair): the real_init_dashboard()handsheadlessand the loopback-only flag tostart_dashboard, with a non-headless control;GET /v1/modelsregistered throughowner_routekeeps each refusal through the real auth chain over a loopback socket (no credential 401 with the challenge, an app token403 owner_onlywith no challenge and no catalog read, the owner's bearer 200 withX-Request-Idand noSet-Cookie), and a catalog error comes back as a contract error.test/test_local_token_session_kind.py:kind=sessionmints a token that is a session and not a link; without it the mint is still a link; a wrong secret is refused the same way.test_crew_api_bearer.py,test_local_token_session_kind.py,test_token_auth_tailnet_pin.py,test_shared_crew_tailnet_direct.py): with tailnet identity enforced, a bearer from a login off the allowlist or from an unattributed peer is refused as the cookie is; a session minted withkind=sessionis bound to its peer on first use and refused from another address; an app token sent as a bearer keeps its app scope; an app token that may not call/v1/modelsgets403 owner_onlywith no challenge.test/test_crew_api_models.py: the list shape and headers; an app token gets403 owner_onlyand nothing is read; a Bot shadows a template of its name.test/test_cli_server_more_coverage_client.py,test/test_cli_gateway_flags.py:--bearerasks for a session and prints it alone;--headlesspasses through;--headless --slack-onlyexits 2 with a one-line error and starts nothing, and each flag alone still starts.test/test_token_auth_credential_scope.py: the app-token refusal on an Owner route now sends the token in the header.?token=refusal removed, a link accepted as a bearer, the cookie fallback restored, the verifier skipped, or the headless middleware disabled, tests in these files fail.Manual verification
Covered by the real-machine run below.
Real-machine verification
Machine: throwaway cloud dev machine, Amazon Linux 2023, x86_64, 8 vCPU / 30 GB. The build ran from a venv with its own
KIROCREW_HOMEand port.Before (main ae93f16):
kirocrew gateway --headless->error: unrecognized arguments: --headless(rc 2);kirocrew token --bearer->error: unrecognized arguments: --bearer;GET /v1/modelswithAuthorization: Bearer <owner token>-> 401;GET /-> 200After, on an earlier head (5243bd9):
kirocrew gateway --headless --port 6495 --no-tunnel --no-crons-> boot prints the API address and no sign-in link;lsof -nP -iTCP -sTCP:LISTEN(the machine has noss) ->127.0.0.1:6495only;kirocrew gateway --headless --slack-only-> rc 2,--headless cannot be combined with --slack-only, nothing listens;GET /,/chat,/favicon.ico-> 404headless;GET /api/health-> 200;GET /v1/modelswith no credential -> 401 withWWW-Authenticate: Bearer error="invalid_token"; wrong bearer -> 401;?token=<valid session>-> 401; a sign-in link as bearer -> 401;Authorization: Bearer $(kirocrew token --bearer)-> 200 with noSet-Cookie; the credential does not appear in the gateway log; the stockopenaiPython client with onlybase_urlandapi_keyset:client.models.list()-> 16 models, and a wrong key ->AuthenticationError401A CLI restart was run once on that earlier head and brought the gateway back headless on
127.0.0.1. On that head the restart took the mode from a record on disk. The current head has no such record and reads the live gateway's command line instead, so that run does not verify the current restart code.Not verified on a real machine on the current head: the CLI restart of a headless gateway,
/assets/,/fonts/and/vendor/staying served on a headless gateway, andGET /v1/modelsregistered throughowner_route. In-process tests cover them. The restart was not rerun because the test machine cannot be reached until its owner renews the sign-in. The headless boot, its bind and the 404 for the dashboard page are unchanged in code since the run above.Cleanup: the machine was deleted after the run
Related Issues
Deferred from this pull request: #40328 (two rare lock states in which a CLI restart brings a headless gateway back with the dashboard, and one race shared with main).
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...); PR Hygiene does not count commitsContribution License Agreement
Contributed under the project's Apache-2.0 license.