Skip to content

feat(enterprise): show a sign-in screen when an enterprise start has no sign-in - #26818

Merged
bolichen97 merged 2 commits into
mainfrom
fix/ee-signin-only-gateway
Nov 1, 2026
Merged

bolichen97 merged 2 commits into
mainfrom
fix/ee-signin-only-gateway

Conversation

@iamwhatever

@iamwhatever iamwhatever commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

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 login command and a start URL they must look up.

Not a goal

  • The desktop app (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.
  • The kiro-cli sign-in fallback. That is a separate PR.
  • Any change to the oss edition.

What changed (motivation → approach → change)

Symptom: a signed-out enterprise start exits with no UI. Cause: boot_platform fails on the missing sign-in before any server binds, and cli.main exits 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 on 127.0.0.1. Routes are an allow-list (ALLOWED_ROUTES plus /assets/ and /fonts/): the SPA shell and static files, /api/theme/boot, /api/health, /api/live, a synthetic GET /api/kiro-prerequisite with enterprise_sign_in_only: true, and GET /api/kas-login plus POST /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 the dashboard.server facade). The sign-in handlers keep their owner check. POST /api/kas-login/device accepts only provider: "idc"; a personal account has no organisation profile, so the boot after it would only exit. The printed link names 127.0.0.1, never localhost. 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-open or headless start can still sign in late.
  • When it applies (applies): enterprise build, the failure's recorded cause is CAUSE_NO_SIGN_IN, and signed_in() (the shared resolver kiro_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.
  • After a sign-in lands: the page shows "Signed in. Start Kiro Crew again." The app then stops and closes its socket. The terminal prints the same line plus the start command, and the process exits 0. No gateway starts in that process. The sign-in link carries the dashboard's boot claim, 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's GatewayLock while 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_first in the boot-failure branch, gateway only. doctor and the kas sign-in verbs behave as before.
  • website/electron/gateway-supervisor.js: sets KIROCREW_DESKTOP_GATEWAY=1 on the gateway it spawns.
  • website/src/components/KiroPrerequisiteGate.tsx and KasLoginGate.tsx: on enterprise_sign_in_only, render KasLoginGate organisationOnly (Company SSO alone, already open). Once the status says enterprise_signed_in_restart, show "Signed in. Start Kiro Crew again.", which stays after the app exits.
  • Desktop: a desktop-spawned gateway never reaches the sign-in screen (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.
  • Specs: docs/system-specs/modules/platform-context.md ("Sign-in-only app (RFC D5)") and governance.md ("Signing in first").

Backwards compatibility

Compatible: only an enterprise gateway start with no sign-in changes, from an exit to a sign-in screen; every other start, and every oss start, 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; only idc can start; cross-site POST refused; the app binds 127.0.0.1 only and prints a 127.0.0.1 link; only "no sign-in" opens the screen (other composition failures, desktop, sandbox, --test-mode, --json-ready exit); an unreadable vault counts as signed in; a busy port exits; Ctrl-C exits 130. After sign-in: the page reads enterprise_signed_in_restart before 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.
  • Local: 401 pytest passed, 1155 vitest passed (i18n style checks against origin/main included); 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 real KiroPrerequisiteGate with 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):

Company SSO form, empty, dark

Company SSO form, empty, light

After the user types their portal URL, Continue is enabled:

Company SSO form, filled, dark

The moment between the sign-in landing and the next status read:

Just after sign-in

Once the sign-in landed, with the start command to copy; this stays on screen after the sign-in app exits:

Signed in, start again

@iamwhatever
iamwhatever requested review from a team and KiroCrewCaptain as code owners October 31, 2026 19:58
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 31, 2026
@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

UX-level review of 6a97dba8169bb05e175acc725d743ba3baf47ea0 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

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

  • enterprise_start_command_hint: the blind reader said "I don't know what a terminal is… This is where I'd get stuck." Name the terminal the user already has open, e.g. "Run this in the terminal you started Kiro Crew from, then open the link it prints."
  • The restart screen (shot-05) keeps the side panel headline "Your crew is almost ready." next to "Start Kiro Crew again", and the reader "couldn't tell if that means I moved to a new step." Give this screen a side-panel line that says sign-in is complete.
  • The waiting spinner (shot-04) has no visible label, and the reader said "There's no text saying what it's waiting for." Add one short visible line, e.g. "Checking your sign-in…".

[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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 6a97dba8169bb05e175acc725d743ba3baf47ea0 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

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

  • enterprise_boot.py module docstring says the sign-in path "then boots again and exits here on any failure". That describes the dropped socket-hand-off design. The process now exits 0 after sign-in and never boots again, so fix the docstring to match.

[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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 6a97dba8169bb05e175acc725d743ba3baf47ea0 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

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

  • Item 3: oversized? No. Inherited? Partly. D5 reads "After the user signs in, the resolver runs again with D4's rules, then the rules fetch runs". The PR instead says "the process exits 0" and the user starts again. The description gives a reason for the restart (the socket hand-off kept opening gaps), but it does not name the departure from D5 as a departure.
  • Item 2: inherited from a premise, not from D5. D5 asks for a screen "naming both ways to sign in". _kas_handler returns 400 organisation_sign_in_required for any provider other than idc. The stated reason, "a personal account has no organisation profile", is sound but is not recorded in the RFC.
  • Item 5: a sibling copy. The SSH_CONNECTION or SSH_CLIENT check is now written inline in 5 places (grepped: cli.py:150, service_boot.py:1372, dashboard/urls.py:525, doctor_checks/services.py:459, auth/shape.py:37). Subtraction: call auth.shape._is_ssh_remote() in place of the new inline copy.

What this change ships

Inventory (9 items) — 6 justified

Intent: 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.

  1. Signed-out enterprise gateway start serves a sign-in screen on 127.0.0.1 instead of exiting — justified
  2. Only Company SSO is offered; personal sign-in is refused — inherited
  3. After sign-in the process exits 0 and asks for a restart — inherited
  4. The terminal prints a fresh link before the 5-minute window ends — justified
  5. The browser opens only when the normal gateway would open it — justified
  6. A desktop-spawned gateway still exits, via the new KIROCREW_DESKTOP_GATEWAY env var — justified
  7. --test-mode, --json-ready and sandboxed starts exit as before — justified
  8. The sign-in screen holds the data home's GatewayLock — justified
  9. The restart command repeats the launch flags and KIROCREW_HOME — justified

[FIRST-PRINCIPLES-REVIEWED] 6a97dba

Description read

[DESCRIPTION-READ] e26884341af3e53647593aef02cfbc6d5eee5ce944cc1b9b52f1985915fc37d9

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 6a97dba8169bb05e175acc725d743ba3baf47ea0 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 6a97dba

Verdict parsed from the review's SHA-scoped output markers for commit 6a97dba8169bb05e175acc725d743ba3baf47ea0.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 6a97dba8169bb05e175acc725d743ba3baf47ea0 false-positive: <reason, 20 to 500 characters>

@bolichen97 bolichen97 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 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:

  1. ALLOWED_ROUTES has 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.
  2. In cli.py, _serve_sign_in_first runs 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.
  3. The owning specs still say the opposite of what ships: platform-context.md says "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.

@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 6a97dba8169bb05e175acc725d743ba3baf47ea0 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 6a97dba

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 6a97dba8169bb05e175acc725d743ba3baf47ea0 false-positive: <reason, 20 to 500 characters>

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention labels Oct 31, 2026

@bolichen97 bolichen97 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.

Re-reviewed at 42c6014 (last reviewed f8f00c2).

The three points from my last review are addressed:

  1. Desktop start: instead of adding /api/token/local to the allow-list, the desktop supervisor now sets KIROCREW_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.
  2. --test-mode and --json-ready now return before the sign-in app starts, so a scripted start gets the old refusal exit.
  3. platform-context.md and governance.md now 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.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention labels Oct 31, 2026

@bolichen97 bolichen97 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.

Re-reviewed at 48edbe5 (last reviewed 42c6014).

The new commit is a three-line follow-up:

  • _serve_sign_in_first reads the owner id with load_credentials(propagate=False), so this read no longer pushes credentials into the process environment before the real boot.
  • sign_in_then_boot runs the sign-in loop on an asyncio.Runner context instead of asyncio.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.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 31, 2026
@iamwhatever
iamwhatever force-pushed the fix/ee-signin-only-gateway branch from 48edbe5 to ddd032c Compare October 31, 2026 23:13
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 31, 2026
@iamwhatever
iamwhatever force-pushed the fix/ee-signin-only-gateway branch from ddd032c to 948124e Compare November 1, 2026 00:00
@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Nov 1, 2026
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Nov 1, 2026

@bolichen97 bolichen97 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.

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_boot is replaced by sign_in_then_exit. Once a sign-in is stored, the status read returns enterprise_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 boot claim, so its session ends with this process and no other session in the data home is touched.
  • _serve_sign_in_first holds the data home's GatewayLock while 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_first either exits or returns, and any other failure still goes to refuse_policy_boot. The specs in platform-context.md and governance.md now 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.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 1, 2026
@iamwhatever
iamwhatever force-pushed the fix/ee-signin-only-gateway branch from 4e92fc0 to 3de912e Compare November 1, 2026 06:26
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Nov 1, 2026

@bolichen97 bolichen97 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.

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 every select() refusal except "no sign-in", including CAUSE_NOT_ELIGIBLE (a sign-in with no organisation profile).
  • In serve_until_signed_in, that true sets signed right away. The status read then returns enterprise_signed_in_restart and enterprise_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.

@iamwhatever
iamwhatever force-pushed the fix/ee-signin-only-gateway branch from 3de912e to dc94a44 Compare November 1, 2026 07:00
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Nov 1, 2026

@bolichen97 bolichen97 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.

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_in now runs sign_in.resolve() off the loop before signed.set(). A lapsed, profile-less or unreadable sign-in raises SignInError there, so the page is never told "signed in".
  • sign_in_then_exit catches that SignInError and exits through refuse_boot with the cause and its fix.
  • The new test test_an_unusable_sign_in_is_never_published_as_success makes resolve() fail with CAUSE_NOT_ELIGIBLE and 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.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 1, 2026
@iamwhatever
iamwhatever force-pushed the fix/ee-signin-only-gateway branch from dc94a44 to 24ef594 Compare November 1, 2026 07:43
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Nov 1, 2026

@bolichen97 bolichen97 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.

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
bolichen97 previously approved these changes Nov 1, 2026

@bolichen97 bolichen97 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 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.

@bolichen97
bolichen97 enabled auto-merge (squash) November 1, 2026 09:04
…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 bolichen97 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.

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:

  1. The printed sign-in link expires and cannot be replaced. serve_until_signed_in mints one token with generate_token, whose link window is LINK_WINDOW_SECS (300 s), prints the link once, then loops on signed_in() with no limit. On a start that opens no browser (--no-open, dashboard.auto_open_browser off, headless SSH), a user who opens the link after 5 minutes gets a page whose requests are refused. Neither /api/token/local nor /api/auth/refresh is 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.
  2. 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. If serve_until_signed_in raises before it builds the app, the test spins until the global timeout instead of failing at that line. Fix: wait with await_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 bolichen97 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 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:

  1. The sign-in link is renewed. serve_until_signed_in mints the link through a link() helper and, while nobody has signed in, prints a fresh one _LINK_MARGIN_SECS before LINK_WINDOW_SECS runs out, without opening the browser again. A test sets the margin to the whole window so every tick renews.
  2. The test that waited on while not apps now uses async_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.

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.

Enterprise: a signed-out first run exits with no sign-in screen

3 participants