Skip to content

fix(acp): name the fix when pi is signed out or goose key is in keyring - #14411

Merged
iamwhatever merged 1 commit into
mainfrom
fix/acp-sandbox-auth-hints
Sep 28, 2026
Merged

iamwhatever merged 1 commit into
mainfrom
fix/acp-sandbox-auth-hints

Conversation

@iamwhatever

@iamwhatever iamwhatever commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A pi user who is not signed in, and a goose user whose key sits in the system keyring, are told the one step that makes chat work inside Crew.

Two harnesses fail with advice that does not work:

Harness When it fails What the user saw
pi (not signed in) session/new one wasted respawn, then JSON-RPC error: {'code': -32000, 'message': 'Authentication required: Configure an API key or log in with an OAuth provider.', ...}
goose (key saved in the system keyring, goose's default) first session/prompt "Your session has expired. goose has no provider configured. Run goose configure ..."

The goose user already ran goose configure. Running it again stores the key in the keyring again, so the chat never works and nothing says why.

Why it matters

Both are a first chat that fails on a normal setup. pi's frame names no fix. goose's message sends the user in a loop: the keyring is goose's recommended storage, and Crew's sandboxed child cannot reach it.

Not a goal

  • Letting the sandboxed child reach the session bus or the keyring. The bus stays closed.
  • Changing any credential mask or forwarding more environment variables.
  • The "Your session has expired." prefix _format_acp_error puts before goose's prompt-time message; that arm is shared with every harness.

What changed (motivation → approach → change)

Symptom: pi showed a raw frame; goose showed a fix that cannot work. Root cause: pi's signed-out words were not declared in host_auth, and goose's message did not know the sandbox hides the keyring.

pi: src/kiro_crew/agent_sdk/host_auth.py now declares pi's phrase Configure an API key or log in with an OAuth provider as its signed_out_signature. Copied from a live pi-acp 0.0.34 run with an empty pi home. The startup ladder in src/kiro_crew/acp/client.py then fails fast with pi's own signed_out_message.

goose: its signed_out_message now names the keyring case and the fix: GOOSE_DISABLE_KEYRING=true goose configure, which saves the key to secrets.yaml, the one store goose reads inside the sandbox. Measured: inside Crew's sandbox, busctl --user answers "Permission denied". goose 1.52.0 with no reachable bus logs "Keyring unavailable. Using file storage for secrets." and answers the prompt with Authentication required. With the key in secrets.yaml, the same run reaches its provider.

No mask, bus or environment rule changes. The sandbox stays as strict as it is.

Backwards compatibility

Compatible: only pi's startup answer with its own declared phrase, and goose's signed-out text, change. Every other harness keeps today's messages and retry.

Tests

  • test/test_acp_pi_backend.py: pi's live signed-out frame raises a non-transient AcpError with pi's message after ONE spawn, and not the Kiro sign-in type; kiro-cli meeting the same words still retries.
  • test/test_acp_goose_backend.py: goose's live Authentication required prompt frame formats to a message naming GOOSE_DISABLE_KEYRING=true goose configure, the keyring and secrets.yaml.
  • Mutation-checked: with the host_auth.py change reverted, the pi startup test and the goose keyring test fail.
  • The 18 test files that touch host_auth plus the goose and pi backend files: 3255 passed.

Manual verification

pi: drove pi-acp 0.0.34 over stdio with an empty PI_CODING_AGENT_DIR; session/new returned the frame above, with authMethods offering terminal login.

goose: drove goose acp 1.52.0 over stdio with a scratch config home and no session bus. With GOOSE_PROVIDER: openai and no key: session opens, prompt answers -32000 Authentication required. With OPENAI_API_KEY in secrets.yaml: prompt ends end_turn.

Not run inside a real Crew sandbox: the Dev Fleet pod tool was not enabled on the test host, and a Crew sandbox cannot nest another.

Related Issues

N/A — found while reviewing why pi and goose basic chat fail inside Crew's sandbox.

Pattern harvest

Rule candidate: review-prompt
Pattern: a sign-in remedy that names a store the sandboxed child cannot reach

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@iamwhatever
iamwhatever requested a review from a team as a code owner September 27, 2026 07:40
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Sep 27, 2026
@github-actions

github-actions Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — ✅ PASS

Design-level review of 4512866456f2734e1adf8b6a3ef8e5b048711629 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Verify pi-acp releases newer than 0.0.34 still emit the declared phrase — signature drift silently reverts to the raw-frame-plus-respawn behavior.

[DESIGN-REVIEWED] 4512866

@github-actions

github-actions Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ no blocking findings

GPT 5.6 completed its review of 4512866456f2734e1adf8b6a3ef8e5b048711629 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 4512866

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 4512866456f2734e1adf8b6a3ef8e5b048711629: <one-sentence reason>

@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 Sep 27, 2026
@github-actions

github-actions Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — ✅ PASS

Premise-level review of 4512866456f2734e1adf8b6a3ef8e5b048711629 — 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/CONCERNS are advisory.

First-Principles-Verdict: PASS

Verify pi-acp's phrase never appears in a retryable error — a match now makes any pi failure terminal after one spawn, 401/403 included, by declared design.

Not justified as shipped

  • Item 2 — undeclared: the description names only "the startup ladder in src/kiro_crew/acp/client.py", but reports_signed_out is also consumed by _format_acp_error (client.py:5080), so mid-session pi errors carrying the phrase (401/403, no model — per the diff's own comment) now reformat to pi's sign-in message too. Harm-free rider: same defect, same declared phrase.

What this change ships

Inventory (3 items) — 2 justified

Intent: a signed-out pi user and a keyring-only goose user each see the one step that makes chat work — a FIX.

  1. A signed-out pi fails fast after one spawn with pi's own sign-in message instead of a raw JSON-RPC frame and a wasted respawn — justified
  2. Mid-session pi errors carrying the same phrase also reformat to the sign-in message — undeclared (description names only the startup ladder)
  3. goose's signed-out error now names the keyring case and GOOSE_DISABLE_KEYRING=true goose configure instead of the goose configure loop — justified

Both items fill the pre-existing signed_out_signature/signed_out_message seam (host_auth.py:269, reports_signed_out host_auth.py:856 — 2 prior declarations, 2 client consumers counted); no new field, key or surface. Grepped keyring|keychain across all nine declarations: goose is the only keyring-backed store, so the "remedy names an unreachable store" cause has 0 unfixed siblings. Provenance is live captures (pi-acp 0.0.34, goose 1.52.0) plus tests this PR adds that the description reports mutation-checked against base.

[FIRST-PRINCIPLES-REVIEWED] 4512866

@github-actions

github-actions Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5 Review — ✅ no blocking findings

Reviewed 4512866456f2734e1adf8b6a3ef8e5b048711629 — this comment is updated in place on each push.

Review details

The new goose signed-out message states a Linux-only measurement as a universal fact about the sandbox.

FINDING — src/kiro_crew/agent_sdk/host_auth.py:587 — a macOS operator whose goose provider is unconfigured hits signed_out_signature="Failed to resolve provider" → ensure_ready raises signed_out_message(goose) verbatim to the chat error card, asserting "its key is in the system keyring, which Kiro Crew's sandbox cannot open", which is false on that host: the measurement in the comment above is a D-Bus one (busctl --user), while _build_seatbelt_profile emits (version 1)\n(allow default) plus only file-read*/file-write*/file-link denies with no ~/Library entry and no mach-service rule (sandbox.py:8395-8497), so the Keychain is reachable — and the remedy it then prescribes, `GOOSE_DISABLE_KEYRING=true goose configure`, both moves an OS-protected key into the plaintext secrets.yaml this module itself calls "plain text" (line 549) and is a POSIX-shell env prefix that does not parse in cmd.exe or PowerShell, where no platform gate stops agent.acp_backend: goose → Fix: qualify the keyring clause to the host it was measured on (or state it as the second possibility rather than a fact about "Kiro Crew's sandbox"), keeping "none is configured" — the condition the declared signature actually detects — as the primary cause, and name the variable separately from the command ("set GOOSE_DISABLE_KEYRING=true, then run goose configure").

[OPUS-REVIEWED] 4512866

Verdict parsed from the review's SHA-scoped output markers for commit 4512866456f2734e1adf8b6a3ef8e5b048711629.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 4512866456f2734e1adf8b6a3ef8e5b048711629: <one-sentence reason>

@iamwhatever
iamwhatever force-pushed the fix/acp-sandbox-auth-hints branch from 9000d25 to 8664de7 Compare September 27, 2026 08:13
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 27, 2026
@bolichen97

Copy link
Copy Markdown
Contributor

Maintainer sweep (2026-09-27, on behalf of @bolichen97): #14340 is now on main as bde52f5, and this branch (which carried #14340's commit f6c6152 as its base) is dirty against main. Please drop the carried commit and rebase to the single commit described in the body; I will approve on the new head -- everything else was green.

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Sep 27, 2026
@iamwhatever
iamwhatever force-pushed the fix/acp-sandbox-auth-hints branch from 8664de7 to dc5ada2 Compare September 27, 2026 17:18
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Sep 27, 2026
@github-actions

github-actions Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Fable 5) — ⏭️ skipped

Revision 4512866456f2734e1adf8b6a3ef8e5b048711629 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Advisory — does not block merge.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: checking Automated validation is still running labels Sep 27, 2026
@iamwhatever
iamwhatever force-pushed the fix/acp-sandbox-auth-hints branch from dc5ada2 to 068f353 Compare September 28, 2026 06:16
@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 merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Sep 28, 2026
… keyring

pi-acp answers session/new with -32000 'Authentication required: Configure
an API key or log in with an OAuth provider.' Crew retried once and then
showed the raw JSON-RPC frame. Declare that phrase as pi's signed-out
signature so the startup ladder fails fast with pi's own sign-in message.

goose keeps provider keys in the OS keyring by default. Crew's sandboxed
child cannot reach the session bus, so goose falls back to secrets.yaml,
finds no key, and answers the first prompt with 'Authentication required'.
Its signed-out message said to run 'goose configure', which only stores
the key in the keyring again. Name the keyring case and the file-storage
switch (GOOSE_DISABLE_KEYRING=true goose configure) instead.

Builds on #14340's signed_out_signature mechanism.
@iamwhatever
iamwhatever force-pushed the fix/acp-sandbox-auth-hints branch from 068f353 to 4512866 Compare September 28, 2026 07:01
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 28, 2026
@iamwhatever
iamwhatever enabled auto-merge (squash) September 28, 2026 16:24
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Rebased onto main: the carried #14340 commit is dropped and the branch is now the single commit 4512866 (3 files). All checks are green. Ready for your approval.

@iamwhatever
iamwhatever merged commit e5868d1 into main Sep 28, 2026
97 checks passed
@iamwhatever
iamwhatever deleted the fix/acp-sandbox-auth-hints branch September 28, 2026 19:56
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Sep 28, 2026
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.

3 participants