Repository navigation
feat(enterprise): show a sign-in screen when an enterprise start has no sign-in - #26818
Conversation
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS No blocker. The blind reader read the URL field and Continue correctly and would use them, and every state the diff adds has a screenshot. Notes
[UX-REVIEWED] 6a97dba Description read[DESCRIPTION-READ] 56b7ca7b72f8acb2b11c91aa1753f727e46dd6002ebf4d63ed01ea9073441fff That sha256 names everything this verdict read: the PR description, plus the 8 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 |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: a separate allow-listed app that never composes the platform is the right shape, and the decision to make the user restart after sign-in is explained. Notes
[DESIGN-REVIEWED] 6a97dba Description read[DESCRIPTION-READ] 9d3958f64ac33b320564d4c3bdc4ce2899320f003ddfe7f0f1bfc1dc9118aaf6 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 Every sign-in item answers the defect in #26817 and sits inside accepted RFC D5. Two places depart from D5's wording, and that is a coverage question, not a blocker. Notes
What this change shipsInventory (9 items) — 6 justifiedIntent: a signed-out enterprise user signs in from a screen instead of hitting a dead-end exit. This is a FIX. The patch also carries main's dashboard-frame and fold-watch hunks from #26953. The head lacks them and the base has them, so they are not counted here.
[FIRST-PRINCIPLES-REVIEWED] 6a97dba Description read[DESCRIPTION-READ] e26884341af3e53647593aef02cfbc6d5eee5ce944cc1b9b52f1985915fc37d9 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
bolichen97
left a comment
There was a problem hiding this comment.
Reviewed at f8f00c2.
The direction is right: a signed-out enterprise start should give the user a way to sign in, and keeping the sign-in app to an explicit allow-list on 127.0.0.1, Company SSO only, with every other dashboard route tested as 403 or 404, is a careful shape. I am leaving a comment rather than approving, because the Opus lane's blocking findings hold at this head and this adds a new listener on the sign-in path.
I confirmed the first two Opus findings in the code:
ALLOWED_ROUTEShas no/api/token/local, and the desktop supervisor mints its token through that route (website/electron/local-token.js). A signed-out desktop start would load the dashboard with no token, so the SPA's prerequisite read is refused with "Token required" and the sign-in screen never appears. Before this change the user at least saw the refusal in the start-failure window.- In
cli.py,_serve_sign_in_firstruns before_resolve_gateway_args, so--test-mode(no browser, auto port, ready line) is not applied to the sign-in app. A harness on a fresh enterprise home would wait for a ready line that never comes. - The owning specs still say the opposite of what ships:
platform-context.mdsays "A signed-out start still exits" and "a failed boot never serves anything". They should describe the sign-in-only app, its allow-list and its boundary in this PR.
Two process checks are also red. PR Policy wants a screenshot of the new screen, and PR Hygiene wants the template headings (Problem / Motivation, Why it matters, Not a goal, What changed). Both clear by editing the description.
Since this is a new user-facing flow on the sign-in path, the design call for it stays with a maintainer.
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
bolichen97
left a comment
There was a problem hiding this comment.
Re-reviewed at 42c6014 (last reviewed f8f00c2).
The three points from my last review are addressed:
- Desktop start: instead of adding
/api/token/localto the allow-list, the desktop supervisor now setsKIROCREW_DESKTOP_GATEWAY=1, and a signed-out gateway launched that way exits with its refusal as before, so the start-failure window still shows it. The allow-list stays as narrow as it was. This keeps the sign-in app out of the desktop until that handoff is built. --test-modeand--json-readynow return before the sign-in app starts, so a scripted start gets the old refusal exit.platform-context.mdandgovernance.mdnow describe the sign-in-only app, and no longer say a signed-out start always exits.
The two red process checks are green now: the description has the template headings, and screenshots of the screen are attached. Every AI lane reports no blocking finding at this head.
I found no new issues. Because this adds a new listener and a new screen on the sign-in path, the design call stays with a maintainer, so I am leaving this as a comment.
bolichen97
left a comment
There was a problem hiding this comment.
Re-reviewed at 48edbe5 (last reviewed 42c6014).
The new commit is a three-line follow-up:
_serve_sign_in_firstreads the owner id withload_credentials(propagate=False), so this read no longer pushes credentials into the process environment before the real boot.sign_in_then_bootruns the sign-in loop on anasyncio.Runnercontext instead ofasyncio.run, so the loop is closed cleanly before the real gateway boots.
Neither changes what the sign-in app serves or who can reach it. I found no new issues. The design call on the sign-in screen stays with a maintainer, so this is a comment. CI on this head is still running.
48edbe5 to
ddd032c
Compare
ddd032c to
948124e
Compare
bolichen97
left a comment
There was a problem hiding this comment.
Re-reviewed at 4e92fc0 (last reviewed 56cc4ef).
This head changes what happens after a sign-in. Before, the sign-in app stopped and the same process booted the real gateway on the same port. Now:
sign_in_then_bootis replaced bysign_in_then_exit. Once a sign-in is stored, the status read returnsenterprise_signed_in_restart: true, and the page shows "Signed in. Start Kiro Crew again." The app waits up to 15 s for the page to read that, then stops and closes its socket.sign_in.resolve()then checks the sign-in. If the next start could not use it (lapsed, no profile, unreadable), the process exits with that cause. Otherwise it prints the start command and exits 0.- No gateway starts in the sign-in process, so no listening socket is handed from the sign-in app to the gateway. The next start loads the rules on the normal path.
- The sign-in link's token carries the
bootclaim, so its session ends with this process and no other session in the data home is touched. _serve_sign_in_firstholds the data home'sGatewayLockwhile the screen is up. A second start sees a live holder and exits with the usual message.main()is reworked to match:_serve_sign_in_firsteither exits or returns, and any other failure still goes torefuse_policy_boot. The specs inplatform-context.mdandgovernance.mdnow describe the exit-0-then-restart flow.
This narrows the security surface: no port hand-off, a session bound to the process, and one process per data home. The cost is one more step for the user, who has to start Kiro Crew again after signing in.
I found no defects in the delta. This changes the shape of the sign-in flow, so the design call stays with a maintainer, and this is a comment.
4e92fc0 to
3de912e
Compare
bolichen97
left a comment
There was a problem hiding this comment.
Re-reviewed at 3de912e (last reviewed 4e92fc0).
The design is signed off by a maintainer: after sign-in the process exits and the user starts again, with one process per data home. This head keeps that design. It adds the start command to the "Signed in" page with a copy button, through a new enterprise_start_command status field and a start_command() helper that the terminal line now shares. That part looks good.
I am not approving yet. The GPT lane's blocking finding is still open at this head, and I confirmed it in the code:
signed_in()returns true for everyselect()refusal except "no sign-in", includingCAUSE_NOT_ELIGIBLE(a sign-in with no organisation profile).- In
serve_until_signed_in, that true setssignedright away. The status read then returnsenterprise_signed_in_restartandenterprise_start_command, and the page shows "Signed in" with the command. sign_in.resolve()runs only after the app has stopped. It rejects that sign-in, so the restart the page just offered fails.
The sign-in page only accepts idc, so this needs a personal sign-in made from the terminal while the screen is open. The fix is still small: run sign_in.resolve() off the loop before signed.set(). Publish success only when it passes, and send an unusable sign-in down the refusal path with no "Signed in" page.
PR Readiness is red on this head because of that lane, and the backend, Windows and E2E shards are still running. I will approve once the lane clears.
3de912e to
dc94a44
Compare
bolichen97
left a comment
There was a problem hiding this comment.
Re-reviewed at dc94a44 (last reviewed 3de912e). The design is signed off by a maintainer.
The GPT blocking finding from 3de912e is fixed at this head:
serve_until_signed_innow runssign_in.resolve()off the loop beforesigned.set(). A lapsed, profile-less or unreadable sign-in raisesSignInErrorthere, so the page is never told "signed in".sign_in_then_exitcatches thatSignInErrorand exits throughrefuse_bootwith the cause and its fix.- The new test
test_an_unusable_sign_in_is_never_published_as_successmakesresolve()fail withCAUSE_NOT_ELIGIBLEand checks that the success flag stays unset and the port is freed.
I found no new issues. The GPT lane is still running on this head, and its sticky comment still shows the verdict for 3de912e. I will approve once it reports on this head.
dc94a44 to
24ef594
Compare
bolichen97
left a comment
There was a problem hiding this comment.
Re-reviewed at 24ef594 (last reviewed dc94a44). The design is signed off by a maintainer.
New in this head: _restart_args collects this start's launch flags (--slack-only, --no-crons, --no-tunnel, --no-open, --port, --approval), leaving out the one-shot --seed flags. start_command(start_args) adds them to the restart command on the "Signed in" page and in the terminal line. That part looks right.
I am not approving yet. The GPT lane's blocking finding holds, and I confirmed it in the diff. start_command builds the command from _launcher(), gateway and the launch flags only, and the gateway has no flag for the data home: it comes from KIROCREW_HOME alone. So a start with a non-default KIROCREW_HOME signs in to that home's vault, but the command it offers starts the default home. If that home is signed out too, the user gets another sign-in screen.
Fix: when the active data home is not the default, put it in front of the command, as KIROCREW_HOME=<path> on POSIX or $env:KIROCREW_HOME=<path>; on Windows, quoted by render_command. A test with a non-default home would pin it.
bolichen97
left a comment
There was a problem hiding this comment.
Approving at 2ac455d. The design is signed off by a maintainer, and the code review found no blocking issues.
The GPT finding from 24ef594 is fixed: start_command now puts the active KIROCREW_HOME in front of the restart command (KIROCREW_HOME=<path> on POSIX, $env:KIROCREW_HOME = <path>; on Windows, both quoted), so the restart reads the vault that holds the new sign-in. test_the_restart_command_names_the_data_home_it_signed_in covers both forms and the no-home case.
Gates at this head: every AI lane passes, no check is red, there is no conflict and no change request. Only test jobs and PR Readiness are still running; auto-merge waits for them. More than 20 files change; I read every PR hunk across the reviews of this PR.
…no sign-in A signed-out enterprise gateway start no longer exits with no UI. When the boot failure is recorded as 'no sign-in' and nobody is signed in, it serves a sign-in-only app on 127.0.0.1 (allow-listed routes behind the dashboard's Host, CSRF and token checks; Company SSO only; no platform, agent, cron or session). Once signed in, the page and terminal say 'Signed in. Start Kiro Crew again.', the sign-in session is revoked and the process exits 0; the next start loads the rules. Any other failure, test or scripted starts and desktop-spawned gateways exit as before. oss unchanged.
bolichen97
left a comment
There was a problem hiding this comment.
Re-reviewed at 726ba35 (last approved at 2ac455d). The design is signed off by a maintainer and this head does not change it.
I am not re-approving yet, because the Opus lane blocks on two points and both hold at this head:
- The printed sign-in link expires and cannot be replaced.
serve_until_signed_inmints one token withgenerate_token, whose link window isLINK_WINDOW_SECS(300 s), prints the link once, then loops onsigned_in()with no limit. On a start that opens no browser (--no-open,dashboard.auto_open_browseroff, headless SSH), a user who opens the link after 5 minutes gets a page whose requests are refused. Neither/api/token/localnor/api/auth/refreshis on the allow-list, so the page cannot recover, and the process keeps the port and the gateway lock until it is killed. Fix: mint and print a fresh link before the window runs out, or stop with a clear "link expired, start again" message once it passes with no sign-in. - In
test_enterprise_signin_gateway.py,while not apps: await asyncio.sleep(0)has no deadline and does not check whether the task already failed. Ifserve_until_signed_inraises before it builds the app, the test spins until the global timeout instead of failing at that line. Fix: wait withawait_until, and stop when the task finishes.
Once these are fixed and CI is green, I will approve again.
The sign-in link is accepted only within LINK_WINDOW_SECS. A --no-open or headless start whose user opened it later had no way to get a new one. The page-read test now waits with a limit that also notices the task ending.
bolichen97
left a comment
There was a problem hiding this comment.
Approving at 6a97dba. The design is signed off by a maintainer, and the code review found no blocking issues.
Both Opus findings from 726ba35 are fixed:
- The sign-in link is renewed.
serve_until_signed_inmints the link through alink()helper and, while nobody has signed in, prints a fresh one_LINK_MARGIN_SECSbeforeLINK_WINDOW_SECSruns out, without opening the browser again. A test sets the margin to the whole window so every tick renews. - The test that waited on
while not appsnow usesasync_wait_until(lambda: apps or task.done()), so it has a deadline and stops if the task fails first.
Gates at this head: every AI lane reports no blocking findings, no check is red, and the branch merges cleanly with main. Only a desktop build, coverage combine and PR Readiness are still running; auto-merge waits for them. More than 20 files change; I read every PR hunk across the reviews of this PR.
Fixes #26817
Problem / Motivation
Goal: A signed-out enterprise first run shows a sign-in screen instead of exiting with no UI.
An enterprise build with nobody signed in exits before any port binds. The user gets one generic error line and no screen to sign in from. Found in the enterprise smoke test on 2026-10-29 (problems P3 and P6).
Why it matters
Every new enterprise user starts signed out. Today their first start is a dead end: a terminal line naming a
kirocrew kas logincommand and a start URL they must look up.Not a goal
website/electron) sign-in. A desktop-spawned gateway keeps exiting as before; its window cannot mint a token from the sign-in app yet. That is a separate PR.ossedition.What changed (motivation → approach → change)
Symptom: a signed-out enterprise start exits with no UI. Cause:
boot_platformfails on the missing sign-in before any server binds, andcli.mainexits on that failure. RFC D5 (docs/request-for-change/rfc-crew-enterprise-edition.md, accepted, amended in #25833) asks for a sign-in-only gateway instead.Approach: a separate, minimal aiohttp app rather than the full dashboard with its gate closed. The rules did not load, so the full gateway would start agents, crons and channels with no rules applied. The small app composes no platform and starts nothing.
Change:
src/kiro_crew/enterprise_signin_gateway.py(new): the sign-in app on127.0.0.1. Routes are an allow-list (ALLOWED_ROUTESplus/assets/and/fonts/): the SPA shell and static files,/api/theme/boot,/api/health,/api/live, a syntheticGET /api/kiro-prerequisitewithenterprise_sign_in_only: true, andGET /api/kas-loginplusPOST /api/kas-login/{device,poll,cancel}. The outermost middleware answers 404 to anything else, WebSocket upgrades included. Then the dashboard's own deny-audit, Host, CSRF and token middlewares run (imported through thedashboard.serverfacade). The sign-in handlers keep their owner check.POST /api/kas-login/deviceaccepts onlyprovider: "idc"; a personal account has no organisation profile, so the boot after it would only exit. The printed link names127.0.0.1, neverlocalhost. A link is accepted only for 5 minutes (LINK_WINDOW_SECS), so while nobody has signed in the terminal prints a fresh one 30 s before the last one stops working (the browser is not reopened). A--no-openor headless start can still sign in late.applies): enterprise build, the failure's recorded cause isCAUSE_NO_SIGN_IN, andsigned_in()(the shared resolverkiro_crew.enterprise_sign_in.select, feat(enterprise): one sign-in for the start check, policy fetch and account lock #26100) still finds none. A lapsed, unreadable or profile-less sign-in, any other composition failure,--test-mode/--json-ready, a Crew agent sandbox and a desktop-spawned gateway (KIROCREW_DESKTOP_GATEWAY) all exit as before.bootclaim, so its session dies with the process, and no other session is revoked. A sign-in the next start could not use (lapsed, no profile, unreadable) exits with its own cause instead of claiming success. The sign-in app holds the data home'sGatewayLockwhile it serves.A restart is needed after sign-in. An earlier revision of this PR kept the sign-in app's listening socket open and handed it to the full gateway, so the same tab could carry on. Review found the hand-off kept opening new gaps: a port another local user could take in the gap before the rebind, a socket still open on several failure paths, and a bind check that ran before any rules existed. A fresh start avoids all of them. The sign-in process never runs a gateway or loads the rules, and the next start takes the normal, already-reviewed boot path with the new sign-in.
src/kiro_crew/cli.py:_serve_sign_in_firstin the boot-failure branch,gatewayonly.doctorand thekassign-in verbs behave as before.website/electron/gateway-supervisor.js: setsKIROCREW_DESKTOP_GATEWAY=1on the gateway it spawns.website/src/components/KiroPrerequisiteGate.tsxandKasLoginGate.tsx: onenterprise_sign_in_only, renderKasLoginGate organisationOnly(Company SSO alone, already open). Once the status saysenterprise_signed_in_restart, show "Signed in. Start Kiro Crew again.", which stays after the app exits.KIROCREW_DESKTOP_GATEWAY), so it never exits 0 from here. The shell treats any exit of its gateway child, 0 included, as a start failure (gateway-supervisor.js,child.on("exit")), and it has no relaunch path for this, so nothing new is built.docs/system-specs/modules/platform-context.md("Sign-in-only app (RFC D5)") andgovernance.md("Signing in first").Backwards compatibility
Compatible: only an enterprise
gatewaystart with no sign-in changes, from an exit to a sign-in screen; every other start, and everyossstart, is unchanged.Removes nothing: the diff adds a start path and a component prop; no route, key or function is removed.
Tests
test/test_enterprise_signin_gateway.py: walks every route the full dashboard registers (over 300, MCP routes included); with and without the owner token, every route off the allow-list answers 403 or 404. Also: WebSocket upgrade refused; sign-in API needs the owner token; onlyidccan start; cross-site POST refused; the app binds127.0.0.1only and prints a127.0.0.1link; only "no sign-in" opens the screen (other composition failures, desktop, sandbox,--test-mode,--json-readyexit); an unreadable vault counts as signed in; a busy port exits; Ctrl-C exits 130. After sign-in: the page readsenterprise_signed_in_restartbefore the app stops, the port is free again, the process exits 0 and prints the start command, the sign-in link stops validating once its process is gone while other sessions keep working, an unusable sign-in exits with its cause, the screen takes the gateway lock, and the CLI starts no gateway in that process.website/src/test/KiroPrerequisiteGate.enterprise.test.tsx: the sign-in-only status shows the Company SSO form alone; the restart message shows and stays after the app's polls start failing.origin/mainincluded); tsc, eslint, mypy, black, isort, flake8 clean.Proof: not provable -- other: new feature path; the tests cover new behaviour, not a reverted fix.
Manual verification
Screens rendered with
website/capture/shoot-enterprise-sign-in-only.mjs, mounting the realKiroPrerequisiteGatewith the sign-in-only status. A full sign-in against a real Identity Center was not run.Screenshots / video
First run, as a signed-out user opens it: the URL field is empty and Continue is disabled (dark, then light):
After the user types their portal URL, Continue is enabled:
The moment between the sign-in landing and the next status read:
Once the sign-in landed, with the start command to copy; this stays on screen after the sign-in app exits: