Skip to content

[BE-0056] feat(serve): web UI AWS SSO sign-in for the Bedrock provider#166

Draft
0x0c wants to merge 10 commits into
mainfrom
claude/funny-kilby-b0597f
Draft

[BE-0056] feat(serve): web UI AWS SSO sign-in for the Bedrock provider#166
0x0c wants to merge 10 commits into
mainfrom
claude/funny-kilby-b0597f

Conversation

@0x0c

@0x0c 0x0c commented Jun 21, 2026

Copy link
Copy Markdown
Member

What

Adds AWS SSO (IAM Identity Center) sign-in to the bajutsu serve web UI for the Bedrock AI
provider, plus its roadmap item (BE-0056). From the Settings panel you enter a profile, approve
the verification link in your browser, and serve points spawned record / crawl jobs at the
resulting SSO session — instead of running aws sso login in the shell before launching serve.

This PR contains both the roadmap proposal (roadmaps/proposals/BE-0056-…) and a first
implementation slice.

Why

BE-0053 made Bedrock a selectable provider and delegated auth to the AWS credential chain, but left
credential acquisition out of band — awkward for a remote, self-hosted serve (BE-0016 Tier A),
where aws sso login opens a browser on the wrong host, and for short-lived SSO sessions that
expire with no in-UI signal.

Implementation

  • bajutsu/serve/sso.pySsoEngine seam + types + NativeSsoEngine driving the boto3
    sso-oidc device-authorization flow and persisting the token via botocore's own
    SSOTokenLoader (so the cache key/format are exactly what the credential chain reads back). boto3
    is imported lazily, so the default serve/CLI path stays server-free (test_import_guard).
  • ServeState.sso_engine injectable seam; operations sso_info / sso_login_start /
    sso_login_poll / sso_logout, env-only (set AWS_PROFILE, never to disk — mirrors
    set_provider / set_api_key). Inherited by spawned jobs via _spawn_env, so re-sign-in needs
    no serve restart
    (each job is a fresh subprocess that re-resolves the chain).
  • Routes /api/sso, /api/sso/login[/<handle>], /api/sso/logout on both the stdlib and
    FastAPI servers; the login/logout POSTs are admin paths (BE-0051 auth / CSRF).
  • Settings-panel UI (Bedrock only): profile + Sign in, verification URL + user code, poll to
    completion, session status + Sign out. The link opens in your browser, so remote serve works.
  • Tests (tests/serve/test_http_sso.py) drive the full start → pending → complete → status →
    sign-out flow via an injected fake engine — gate-green without AWS. docs/cli.md + ja mirror.

make check is green (ruff, mypy strict, 1000 tests, coverage 88.9%).

Scope / follow-ups

  • The native engine's AWS calls need validation against a real IAM Identity Center setup (they
    can't run on the Linux gate); the wiring, operations, and UI are gate-tested through the fake.
  • v1 assumes an existing aws configure sso profile; single-operator (per-user identity on a shared
    server is left to BE-0015 / BE-0016).
  • CLI-delegation engine (aws sso login), the second engine the proposal describes, is a
    follow-up behind the same SsoEngine interface.
  • BE-0056 is kept Status: Proposal; flip to Accepted, in progress / Implemented on merge.

🤖 Generated with Claude Code

0x0c and others added 2 commits June 21, 2026 17:08
New proposal under the AI provider configuration topic: start an AWS SSO (IAM Identity Center) sign-in from the bajutsu serve web UI to obtain the AWS credentials the Bedrock provider needs, instead of running 'aws sso login' in the shell before launching serve. Extends BE-0053 (which delegated auth to the AWS credential chain) into the UI, including remote serve (BE-0016 Tier A) via the SSO device-authorization flow. Adds a new 'AI provider configuration' section to the Proposals index in both languages and to build_roadmap_index.py.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions github-actions Bot enabled auto-merge June 21, 2026 08:09
@github-actions github-actions Bot changed the title [BE-XXXX] docs(roadmap): propose web UI AWS SSO sign-in for Bedrock credentials [BE-0056] docs(roadmap): propose web UI AWS SSO sign-in for Bedrock credentials Jun 21, 2026
0x0c and others added 2 commits June 21, 2026 17:11
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add an AWS SSO (IAM Identity Center) device-authorization sign-in to the serve
web UI Settings panel: enter a profile, approve the verification link in the
browser, and serve sets AWS_PROFILE (in memory, never to disk) so spawned
record/crawl jobs resolve Bedrock credentials through that SSO session — no
serve restart on re-sign-in (each job is a fresh subprocess).

- bajutsu/serve/sso.py: SsoEngine seam + types + NativeSsoEngine (boto3 sso-oidc
  device flow, botocore SSOTokenLoader for the token cache; boto3 imported lazily
  so the default serve/CLI path stays server-free).
- ServeState.sso_engine injectable seam; operations sso_info / sso_login_start /
  sso_login_poll / sso_logout (env-only, mirroring set_provider / set_api_key).
- Routes /api/sso, /api/sso/login[/<handle>], /api/sso/logout on both the stdlib
  and FastAPI servers (BE-0051 auth; the login/logout POSTs are admin paths).
- Settings-panel UI (Bedrock only): profile + Sign in, verification URL + code,
  poll to completion, session status + Sign out.
- tests/serve/test_http_sso.py drives the full flow via a fake engine (gate-green
  without AWS). docs/cli.md + ja mirror updated.

The native engine's AWS calls need validation against a real IAM Identity Center;
the serve wiring, operations, and UI are gate-tested through the injected fake.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@0x0c 0x0c changed the title [BE-0056] docs(roadmap): propose web UI AWS SSO sign-in for Bedrock credentials [BE-0056] feat(serve): web UI AWS SSO sign-in for the Bedrock provider Jun 21, 2026
Comment thread bajutsu/serve/sso.py Fixed
Comment thread bajutsu/serve/sso.py Fixed
Comment thread bajutsu/serve/sso.py Fixed
Comment thread bajutsu/serve/sso.py Fixed
0x0c added a commit that referenced this pull request Jun 21, 2026
Three open PRs were each handed BE-0056 (#166, #169, #170); none had
merged, so the roadmap-id-repair workflow — which only fires when a
colliding item is already on main — never ran. Resolve the collision by
hand: #166 (web-ui-aws-sso-login, opened first) keeps BE-0056, and this
item moves to the next free ID. BE-0057 is taken on main and BE-0058
goes to #169, so this becomes BE-0059. Regenerated the index tables.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
0x0c added a commit that referenced this pull request Jun 21, 2026
Three open PRs were each handed BE-0056 (#166, #169, #170); none had
merged, so the roadmap-id-repair workflow — which only fires when a
colliding item is already on main — never ran. Resolve the collision by
hand: #166 (web-ui-aws-sso-login, opened first) keeps BE-0056, and this
item moves to the next free ID. BE-0057 is taken on main, so this item
becomes BE-0058 (#170 takes BE-0059). Regenerated the index tables.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
0x0c and others added 3 commits June 21, 2026 23:48
…597f

# Conflicts:
#	bajutsu/templates/serve.js
…effect)

CodeQL flagged the Protocol method '...' stubs as 'statement has no effect'. Replace them with one-line docstrings, matching the existing serve Protocols (SessionStore / LogBus / RunExecutor / ScenarioStore) — silences the finding and is the codebase convention. No behavior change (Protocol methods are never called).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…597f

# Conflicts:
#	bajutsu/templates/serve.js
@0x0c 0x0c marked this pull request as draft June 21, 2026 23:16
auto-merge was automatically disabled June 21, 2026 23:16

Pull request was converted to draft

0x0c added 2 commits June 23, 2026 07:09
…597f

# Conflicts:
#	bajutsu/serve/handler.py
…597f

# Conflicts:
#	scripts/build_roadmap_index.py
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.

1 participant