Skip to content

feat(stt): offer Codex as an experimental dictation provider - #26076

Merged
Pearcekieser merged 1 commit into
mainfrom
pearcekieser/codex-stt
Nov 8, 2026
Merged

Pearcekieser merged 1 commit into
mainfrom
pearcekieser/codex-stt

Conversation

@Pearcekieser

@Pearcekieser Pearcekieser commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Offer Codex as an optional, experimental speech-to-text provider that uses an existing Codex ChatGPT login on a voice-capable Codex install.

People who already sign in to Codex can't use it for dictation or recorded voice messages today. They have to set up a separate speech backend.

Why it matters

Codex 0.163.0 and later recognises speech for ChatGPT accounts that have voice through its experimental app-server realtime transport. Offering it as a provider adds dictation for those users without a new key, and the selected chat agent stays whatever it was.

Not a goal

  • Changing the default speech provider or the selected agent harness.
  • Playing Codex voice replies, or forwarding spoken requests into Codex tasks.
  • Supporting API-key Codex logins, or Bedrock-backed Codex builds, which don't serve realtime voice.
  • Getting around account voice availability, plan limits or provider retention rules.

What changed (motivation → approach → change)

Voice settings now offer Codex (OpenAI, experimental). The page says that audio goes to OpenAI, explains each setup problem, and hides the language picker because Codex detects the language itself.

Surface Result
pages/settings/SttSettings.tsx, lib/sttProviders.ts, website/src/i18n The new option, translated setup errors and the hosted-audio notice.
config/sections_stt.py, docs/configuration.md codex is a valid stored provider. The default stays local.
stt/codex.py, stt/codex_rpc.py, stt/codex_media.py, dashboard/stt_adapted_stream.py, acp/client_spawn_env.py, agent_sdk/__init__.py, agent_sdk/backends_launch.py Live dictation runs through the existing microphone WebSocket, which already does redaction, audit, caps and recovery, and finds Codex through the codex-acp adapter's resolution, reached through kiro_crew.agent_sdk.
transcribe.py, transcribe_local.py Recorded clips go to the same provider through the shared decoder, capped at 300 seconds.
test/test_codex_stt*.py, test/fixtures/codex_voice.json, setup.cfg, extras.py Offline wire mocks and an optional voice-codex media extra, registered with its install hint.
config-baseline.json Regenerated for the new codex provider value.
packaging/build-desktop.sh, website/electron/test/packaging.test.js Sealed desktop builds bundle the media extra without needing the local recogniser.

Only the user's input transcript becomes text. The adapter sends five RPC methods and nothing else. It sets clientManagedHandoffs, declines every server request, and refuses Codex builds older than 0.163.0, so dictated words never start a Codex task.

Dictation runs the same codex the Codex model provider runs. A new helper next to _resolve_codex_acp_bin() in acp/client_spawn_env.py returns the command the codex-acp adapter would start: CODEX_PATH when it is set, made absolute and checked, otherwise the @openai/codex script the adapter depends on, found from the adapter's real install path with the Node it runs under. There is no second search ladder and no provenance check, because Crew runs as the user, the provider is opt-in, and this is the provider's own trust model. An adapter that resolves to a launcher shim with no locatable Codex CLI reports stt_codex_cli_unresolved and names CODEX_PATH; nothing installed reports stt_codex_missing.

The app-server child runs inside the agent sandbox through sandboxed_spawn_argv_async, through the same wrap_argv launcher and with the same credential mask the provider uses for codex-acp. The decision to run it is the provider's own predicate, sandbox.credential_mask_applies(mode), which enforce_sandbox_floor also uses. Settings reads it before any install step, and CodexRpc.start reads it again before the spawn. Where it is False (no sandbox backend, or a gateway already inside a Crew sandbox, whose nested passthrough would drop the mask), dictation fails with stt_codex_sandbox_unavailable. This PR changes no sandbox file. One difference from the provider remains: with agent.sandbox=off the provider refuses to start, while dictation still runs Codex confined at standard (it takes the operator's tier when that is cc or strict). The child gets no session-bus variables. Windows has no agent sandbox, so the Windows desktop bundle does not ship the voice-codex extra.

If the Codex child exits, sends a malformed or oversized line, fails a write, does not answer a request, or the connection does not come up in time, the user gets the retryable stt_codex_failed. CodexRpc.write() classifies every write failure, call() and start() classify their timeouts, and the reader queues a private kiro_crew/transport_failed event that the child cannot forge. Only a real Codex error maps to stt_codex_voice_unavailable. The stream sends a Codex session's error code to the client only when it is one of the seven stt_codex_* codes in stt.codex.SESSION_ERROR_CODES, which run_codex_session passes to _drive_helper_session as relayed_codes. Any other code is sent as stt_session_failed. A registered provider keeps main's RELAYED_SESSION_ERROR_CODES list.

To end a session the adapter sends session.close and keeps reading late transcript text until session.closed. The owning speech spec explains the wire contract and how to mock it.

Backwards compatibility

Compatible: every existing provider value and the local default stay valid, and voice-codex is optional. Existing decoder callers keep their duration bound.

The new extra_hidden_dirs on the Codex dictation spawn hides the same credential paths from the Codex child that the Codex model provider hides from codex-acp. The spawn is new in this PR and has one caller:

Reader: src/kiro_crew/stt/codex_rpc.py:CodexRpc.start -- chat -- the dictation child keeps ~/.codex visible, so the ChatGPT login still works (test/test_codex_stt.py::test_rpc_login_env_and_process_cleanup)

Removes nothing. The language picker is hidden only while Codex is selected.

Tests

  • test/test_codex_media.py covers the WebRTC peer, track frames and SDP answer with stand-in aiortc and av modules, and the paced PCM buffer.
  • test/test_codex_stt.py and test/test_codex_stt_stream.py mock Codex at the process, sandbox and peer boundaries. They need no Codex binary, WebRTC package, microphone or login.
  • They cover the login and version checks, denied server requests, transcript filtering and dedup, and the length cap on transcript item ids. They also cover the session.close handshake with late transcript text, recorded audio, and process cleanup.
  • Resolution tests cover CODEX_PATH (relative, non-executable, script), the adapter's bundled Codex CLI, a shim-resolved adapter and nothing installed. Spawn tests cover the sandbox tier the child gets, the refusal before any spawn where the credential mask would not apply (no backend, or inside a Crew sandbox), and removal of the launcher file. One spawn test uses the provider's real credential mask and checks the full argv and strip_python_env.
  • test/test_spawn_audit.py now sees the Codex spawn routed through the sandbox, so it no longer needs a benign-spawn entry.
  • The speech seam and dispatch tests cover the new provider next to the built-ins and edition providers.
  • website/src/test covers the label, the setup errors and the hosted-audio notice in the provider-vocabulary, settings-surface and retention-note tests.
  • The complete local profile ran on an earlier head (3c268b4). The backend related run had 27,329 passed, 120 skipped and 3 failed, and the same three nodes also fail on a clean main worktree on this host. They are a launch-copy steering test, an auto-improvement private-store test and a CI-kernel JUnit test, all caused by this host's scratch paths and Btrfs lock identities. Semgrep on the diff and the flake-pattern ratchet pass.

Manual verification

  • In a Dev Fleet pod built at 066b2ed400, with the provider set to Codex, Settings showed not installed (stt_codex_missing) while no codex-acp adapter was reachable. After the adapter was installed into the pod's worktree, clicking the composer microphone in Chromium with a fake audio device made /api/ws/stt answer stt_codex_login_required, because this host's Codex login is not a ChatGPT login. Both states are real. The screenshots below come from this run.
  • In a Dev Fleet pod on an earlier head (3c268b4), before the binary lookup moved to the adapter's, selecting Codex is saved and reported as ready. Streaming one second of synthetic PCM through /api/ws/stt started the sandboxed app-server, which used Codex 0.165.0 on a Bedrock-backed login. The dashboard received stt_codex_login_required ("Sign in to Codex with ChatGPT using codex login."), and the launcher file and temp directory were removed afterwards.
  • A ChatGPT-login run on Codex 0.163.0, with synthetic speech only, returned a transcript and a confirmed session.closed. It also showed that silence and a user turn don't finalize a session, which is why the client sends session.close and waits for session.closed.
  • No physical microphone was used. Other operating systems, other accounts and billing weren't tested.

Screenshots / video

Taken in a Dev Fleet pod built at 066b2ed400, with the provider set to Codex. Neither state was stubbed.

Settings with Codex not installed (stt_codex_missing):

Voice settings showing Codex not installed

Dictation started while Codex is not signed in with ChatGPT (stt_codex_login_required):

Composer error asking to sign in to Codex with ChatGPT

Taken in a Dev Fleet pod built at 3c268b4. Voice settings with Codex selected and ready, showing the "Codex (OpenAI, experimental)" label and the retention notice:

Voice settings with Codex selected

The provider picker open:

Provider picker open

Related Issues

Closes #26075

Merge order with #29221, which changes which codex the provider's app-server runs: either PR can merge first. Dictation must keep running the provider's binary, so the PR that merges second makes resolve_codex_cli() follow the provider's lookup. If #29221 merges first, I will do that on this PR.

Checklist

  • At most two commits, with a Conventional Commits title
  • Existing tests pass and new tests added for new functionality
  • Self-review and local reviews completed
  • Documentation updated
  • No secrets, credentials, or internal references in the diff

@Pearcekieser
Pearcekieser requested review from a team and KiroCrewCaptain as code owners October 30, 2026 03:34
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 30, 2026
@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Nothing blocks: the provider is opt-in, the default stays local, the sandbox and credential mask are reused rather than changed, and turning it off means picking a different provider.

Notes

  • Codex is hard-coded into core: transcribe.py, stt_stream.api_ws_stt, batch_duration_cap_secs, provider_splits_oversized and _prereq_commands each check == "codex". That runs beside the speech_providers registration seam that edition providers already use. As a registered provider with owns_session_limit and its own relayed_codes, it would need no core branches. The cost is that every later external STT provider gets the same per-branch copy.
  • When agent.sandbox=off, dictation still confines Codex at standard, but the Codex model provider refuses to start at all. That asymmetry is deliberate. Record it in the speech spec as a decision, so a later "parity" fix doesn't quietly flip one side.

[DESIGN-REVIEWED] 5c9aa7a

Description read

[DESCRIPTION-READ] 577ad760d1e9a1b81c31d089274148a947ae110bc2bca1494a9e59edc374817d

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 30, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

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

UX-Verdict: PASS

Nothing blocks. The blind reader correctly identified the new "Codex (OpenAI, experimental)" provider option and was willing to pick it. The screenshots show the hidden language picker and the hosted-audio notice.

Notes

  • retention_codex doesn't answer the question its heading asks ("Is my audio kept?"). The reader said it "does tell me my voice leaves my computer, but not whether it is kept." The tooltip text "{{productName}} does not save live dictation audio" does answer it, so open the visible line with that: "Not by Kiro Crew. Audio goes to OpenAI through your Codex ChatGPT sign-in, and your OpenAI account's retention rules apply."
  • unavailable_codex_login and unavailable_codex_missing give terminal commands without saying where to run them. The reader asked how to "use codex login" and found "no sign-in button". Say "run codex login in a terminal" and show the commands in a monospace font.
  • unavailable_codex_extra says "the gateway's Python environment" but never says what to do next. Add the install step, for example "Install it with pip install 'kiro-crew[voice-codex]', then restart Kiro Crew."

[UX-REVIEWED] 5c9aa7a

Description read

[DESCRIPTION-READ] 4d1dcd07730bc8fd26e87afe3c1edb19f7e3922bd0044f0b615d126134978326

That sha256 names everything this verdict read: the PR description, plus the 7 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 30, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 5c9aa7a0229fe47b2cd5503fc01eeeb34050c521 — 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

Opt-in addition with the local default unchanged, so no product-shape decision is needed. Two small surfaces could be smaller.

Notes

  • Item 1 — inherited: Codex is wired in as a core built-in through 8 provider == "codex" / tuple-membership sites across transcribe.py (4), stt_stream.py (2), core_stt_settings.py (1) and sections_stt.py (1). The implemented rfc-pluggable-speech-providers names this cost directly: "Each new built-in provider today edits the same five sites. A registry turns that into one registration." The registry is edition-only today, so this is a note, not a duplicate.
  • Item 8 — zero consumers: agent_sdk re-exports CODEX_CLI_ADAPTER_MISSING, but stt/codex.py reads only CODEX_CLI_UNRESOLVED and CODEX_CLI_OVERRIDE_UNUSABLE. The only readers outside the defining sites are tests (grepped CODEX_CLI_ADAPTER_MISSING in ^\+ lines of the patch). Subtraction: drop CODEX_CLI_ADAPTER_MISSING from agent_sdk/__init__.py's import and __all__.

What this change ships

Inventory (10 items) — 8 justified

Intent: let people already signed in to Codex use it for dictation and voice-message transcription without setting up another speech backend — ADDITION.

  1. Voice settings offer "Codex (OpenAI, experimental)" as a provider — inherited, eight hard-coded branch sites
  2. Live mic dictation runs through Codex — justified
  3. Recorded clips transcribed through Codex, capped at 300 s — justified
  4. Language picker hidden while Codex is selected — justified
  5. Hosted-audio notice and translated setup errors — justified
  6. New optional voice-codex extra (aiortc) — justified
  7. macOS/Linux desktop bundles now ship aiortc — justified
  8. Public Codex CLI resolver honouring CODEX_PATH, exported via agent_sdk — zero consumers for one exported constant
  9. Edition-provider stream driver moved to stt_adapted_stream.py — undeclared, rides along (needed for the line cap)
  10. Error-code allowlist that each helper session can set for itself — justified

[FIRST-PRINCIPLES-REVIEWED] 5c9aa7a

Description read

[DESCRIPTION-READ] 9003ad23f73026b303cfbf5c7b76bd8a065ac1d28babe097b4e4f1b2f02b1338

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 30, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 5c9aa7a0229fe47b2cd5503fc01eeeb34050c521 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 5c9aa7a

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

@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 5c9aa7a0229fe47b2cd5503fc01eeeb34050c521 — this comment is updated in place on each push.

Review details

No findings.

Notes:

  • website/src/lib/sttProviders.ts:33 — the docstring still says "All three of them do… all three" above a list that now has four entries, codex included.

[OPUS-REVIEWED] 5c9aa7a

Verdict parsed from the review's SHA-scoped output markers for commit 5c9aa7a0229fe47b2cd5503fc01eeeb34050c521.

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

@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 30, 2026
@Pearcekieser
Pearcekieser force-pushed the pearcekieser/codex-stt branch from 91fcdae to f100401 Compare October 30, 2026 04:42
@github-actions github-actions Bot added readiness: checking Automated validation is still running merge conflict Branch has merge conflicts with its base — author must resolve before merge 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 30, 2026
@Pearcekieser

Pearcekieser commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=93c0e8604331: availability() must not report Codex ready when its spawn is refused

fixed in 5b0a01e: availability() now returns stt_codex_sandbox_unavailable, with its own UI string, whenever the Codex child could not be confined on this host, so Settings no longer offers a provider that can never record.
The check is sandbox_wrap.no_backend_refuses_spawn(mode, require_confinement=True); it shares the no-backend verdict with wrap_argv, and CodexRpc.start runs the same check and refuses with the same code before preparing a spawn.
Covered by test/test_codex_stt.py (availability returns the code when the check refuses or raises; start refuses before sandboxed_spawn_argv_async).

@Pearcekieser
Pearcekieser force-pushed the pearcekieser/codex-stt branch from f100401 to 5b0a01e Compare October 30, 2026 05:43
@Pearcekieser

Pearcekieser commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=b846373731a2: reject the sandbox helper's unconfined fallback

fixed in 5b0a01e: the Codex child never runs unconfined. CodexRpc.start calls sandbox_wrap.no_backend_refuses_spawn(mode, require_confinement=True) off-loop immediately before sandboxed_spawn_argv_async and raises stt_codex_sandbox_unavailable when it refuses, so no preparation or spawn happens.
require_confinement refuses the off tier and every no-backend host even when agent.sandbox_allow_unsandboxed_exec permits passthrough, which covers Windows by default; only a real backend or the nested Kiro Crew sandbox is accepted. availability() uses the same check, and the Windows desktop bundle no longer installs voice-codex.
Covered by test/test_codex_stt.py (refusal with backend none plus the opt-in, start never calling the sandbox or the spawn).

@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Sensitive Change Review

  • No sensitive path changed; nothing to check.

@github-actions github-actions Bot removed the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 30, 2026
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 5b0a01e
  • What rule changed: No sandbox rule changed. sandbox_wrap.py gains a read-only pre-check, no_backend_refuses_spawn(mode, *, require_confinement=False), and the no-backend verdict inside wrap_argv moved into a shared helper _no_backend_refuses(floor_mandates_sandbox, opted_in) that returns the same expression it replaced. sandbox.py only adds both names to its type-checking forward list.
  • Before -> after (what was allowed/blocked, now): wrap_argv allows and refuses exactly the same spawns as before; the extracted helper is the identical floor_mandates_sandbox or not opted_in expression at the same call site. New: the Codex dictation provider asks the pre-check with require_confinement=True before it spawns, and refuses itself (code stt_codex_sandbox_unavailable) whenever no confining backend exists, including when agent.sandbox_allow_unsandboxed_exec would let wrap_argv pass a spawn through unconfined. That only makes the Codex child stricter than other spawns.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): If the pre-check disagreed with wrap_argv, the Codex provider could show as unavailable on a host that has a sandbox, so a user could not pick Codex dictation; other providers, agents and tools are unaffected because nothing else calls the pre-check. No secret or command path is loosened.
  • Evidence checked (which sandbox result proves it): An independent read-only Opus verifier traced every wrap_argv branch (sandbox_wrap.py around lines 638-1058) against the pre-check and found the same verdict in each, with require_confinement=True refusing every branch where wrap_argv would run unconfined (mode off, no backend, Windows). On this Linux host the real Codex 0.165.0 binary was started through sandboxed_spawn_argv_async in standard mode; it answered initialize and account/read, and its launcher file and temp cwd were removed.
  • No regression:
    • Tools still work (which tools/commands were run, result): The sandboxed Codex app-server ran initialize and account/read and returned the coded login refusal for a Bedrock login; a Dev Fleet pod ran synthetic PCM through /api/ws/stt to the same result; local, Transcribe and agent spawns are unchanged because wrap_argv logic is byte-identical.
    • Backward compatible (old config / old data / old callers still work, how checked): no_backend_refuses_spawn is new with a default that changes nothing, wrap_argv's signature and behaviour are unchanged, and existing stored stt.provider values and the local default stay valid, checked by the speech seam and config baseline tests.
    • Existing tests (which suites passed on this head): test/test_codex_stt.py, test/test_codex_media.py, test/test_codex_stt_stream.py, test/test_spawn_audit.py, test/test_sandbox_refactor_facade.py, test/test_sandbox_first_party_exec.py, test/test_sandbox_unsandboxed_exec_consent.py, test/test_extras.py and test/test_config_baseline.py all pass locally, plus mypy over src/kiro_crew.
  • How to undo: Revert this PR's single commit; the pre-check has no other caller, and restoring the inline expression in wrap_argv is a one-line change.

@Pearcekieser
Pearcekieser force-pushed the pearcekieser/codex-stt branch from 5b0a01e to 63b8fcb Compare October 30, 2026 06:13
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 63b8fcb
  • What rule changed: No sandbox rule changed. sandbox_wrap.py gains a read-only pre-check, no_backend_refuses_spawn(mode, *, require_confinement=False), and the no-backend verdict inside wrap_argv moved into a shared helper _no_backend_refuses(floor_mandates_sandbox, opted_in) that returns the same expression it replaced. sandbox_spawn.py's sandboxed_spawn_argv_async now forwards an optional is_kiro_cli to sandboxed_spawn_argv, omitted when None. sandbox.py only adds names to its type-checking forward list.
  • Before -> after (what was allowed/blocked, now): wrap_argv allows and refuses exactly the same spawns as before, and every existing caller of sandboxed_spawn_argv_async passes nothing new. New: the Codex dictation provider refuses itself (code stt_codex_sandbox_unavailable) whenever no confining backend exists, including when agent.sandbox_allow_unsandboxed_exec would let wrap_argv pass a spawn through, and it passes is_kiro_cli=False so its child can never take the Kiro internal-sandbox delegation path. Both only make the Codex child stricter than other spawns.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): If the pre-check disagreed with wrap_argv, Codex dictation could show as unavailable on a host that has a sandbox, so a user could not pick it; other providers, agents and tools are unaffected because nothing else calls the pre-check or passes the new keyword. No secret or command path is loosened.
  • Evidence checked (which sandbox result proves it): Independent read-only Opus verifiers traced every wrap_argv branch against the pre-check and confirmed that with is_kiro_cli=False neither the darwin nor the win32 delegation path is taken (sandbox_wrap.py:660 and :897-900). On this Linux host the real Codex 0.165.0 binary ran through sandboxed_spawn_argv_async in standard mode, answered initialize and account/read, and its launcher file and temp cwd were removed.
  • No regression:
    • Tools still work (which tools/commands were run, result): The sandboxed Codex app-server returned the coded login refusal for a Bedrock login; a Dev Fleet pod ran synthetic PCM through /api/ws/stt to the same result; agent, local and Transcribe spawns are unchanged because wrap_argv logic and the other async callers are unchanged.
    • Backward compatible (old config / old data / old callers still work, how checked): Both new parameters default to the old behaviour, and test/test_sandbox_off_loop.py checks that a None is_kiro_cli is omitted; stored stt.provider values and the local default stay valid, checked by the speech seam and config baseline tests.
    • Existing tests (which suites passed on this head): test/test_codex_stt.py, test/test_codex_media.py, test/test_codex_stt_stream.py, test/test_sandbox_off_loop.py, test/test_spawn_audit.py, test/test_sandbox_refactor_facade.py, test/test_sandbox_first_party_exec.py, test/test_sandbox_unsandboxed_exec_consent.py and test/test_flake_pattern_ratchet.py all pass locally, plus mypy over src/kiro_crew.
  • How to undo: Revert this PR's single commit; the pre-check and the is_kiro_cli forwarding have no other callers.

@Pearcekieser

Pearcekieser commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=b846373731a2: prevent Codex aliases from taking Kiro's sandbox delegation

fixed in 63b8fcb: the Codex dictation spawn now passes is_kiro_cli=False, and sandboxed_spawn_argv_async forwards is_kiro_cli to sandboxed_spawn_argv and wrap_argv (omitted when None, so the other callers are unchanged).
With an explicit False, wrap_argv takes neither the macOS nor the Windows Kiro delegation path (sandbox_wrap.py kiro_spawn / kiro_spawn_off), so a codex symlink that resolves to a file named kiro-cli still gets Crew's own sandbox profile; the confinement pre-check and the spawn now agree.
Covered by test/test_codex_stt.py (the sandbox call receives is_kiro_cli=False) and test/test_sandbox_off_loop.py (False is forwarded, None is omitted).

@Pearcekieser
Pearcekieser force-pushed the pearcekieser/codex-stt branch from 63b8fcb to 3c268b4 Compare October 30, 2026 07:13
@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 Oct 30, 2026
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 3c268b4
  • What rule changed: wrap_argv gains an opt-in keyword, require_confinement (default False), threaded through sandboxed_spawn_argv and sandboxed_spawn_argv_async, which forward it only when True. With it set, wrap_argv never delegates to Kiro's internal sandbox and raises instead of returning an unconfined argv. no_backend_refuses_spawn(mode) is a Settings-only hint of whether a confining backend exists. sandbox.py only updates its type-checking forward list.
  • Before -> after (what was allowed/blocked, now): With the default (require_confinement=False) every existing caller gets exactly the same spawns as before; wrap_argv's no-backend verdict is the same floor_mandates_sandbox or not opted_in expression as on main. New: the Codex dictation spawn passes require_confinement=True, so the mode-off passthrough, the first-party no-backend carve-out, the opt-in or platform-default no-backend passthrough and Kiro delegation on macOS and Windows all raise for that child; only a namespace launcher, Seatbelt, or an already-inside-Crew-sandbox passthrough lets it run. This only makes the Codex child stricter.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): If the new branch refused a confinable spawn, Codex dictation would show stt_codex_sandbox_unavailable on a host that has a sandbox; no other caller sets the keyword, so agents, tools and other providers are unaffected. No path is loosened and no secret is exposed; the Codex child also no longer receives DBUS_SESSION_BUS_ADDRESS or XDG_RUNTIME_DIR.
  • Evidence checked (which sandbox result proves it): An independent read-only Opus verifier read wrap_argv end to end and listed every return: with require_confinement=True the only non-raising returns are the namespace launcher, Seatbelt and the inside-Crew-sandbox passthrough, Kiro delegation is unreachable because the Kiro classification is forced False, and the default path is unchanged against origin/main. On this Linux host the real Codex 0.165.0 binary ran through sandboxed_spawn_argv_async, answered initialize and account/read, and its launcher file and temp cwd were removed.
  • No regression:
    • Tools still work (which tools/commands were run, result): The sandboxed Codex app-server returned the coded login refusal for a Bedrock login; a Dev Fleet pod ran synthetic PCM through /api/ws/stt to the same result; the scoped backend set for this diff ran 26,578 passed, and its 20 failures all fail identically on clean main 18d6b4e on this host.
    • Backward compatible (old config / old data / old callers still work, how checked): Both new keywords default to the old behaviour and are forwarded only when True (test/test_sandbox_off_loop.py); stored stt.provider values and the local default stay valid (speech seam and config baseline tests).
    • Existing tests (which suites passed on this head): test/test_codex_stt.py, test/test_codex_media.py, test/test_codex_stt_stream.py, test/test_sandbox_off_loop.py, test/test_spawn_audit.py, test/test_sandbox_refactor_facade.py, test/test_facade_mirror_guards.py, test/test_sandbox_first_party_exec.py and test/test_sandbox_unsandboxed_exec_consent.py pass locally, plus mypy over src/kiro_crew and semgrep on the diff.
  • How to undo: Revert this PR's single commit; no caller other than the Codex dictation spawn passes require_confinement=True.

@Pearcekieser
Pearcekieser force-pushed the pearcekieser/codex-stt branch from 718e744 to 4d4755c Compare November 5, 2026 04:44
@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 5, 2026
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 4d4755c
  • What rule changed: wrap_argv gains an opt-in keyword, require_confinement (default False), threaded through sandboxed_spawn_argv and sandboxed_spawn_argv_async, which forward it only when True. With it set, wrap_argv never delegates to Kiro's internal sandbox and raises instead of returning an unconfined argv. no_backend_refuses_spawn(mode) is a Settings-only hint of whether a confining backend exists. sandbox.py only updates its type-checking forward list.
  • Before -> after (what was allowed/blocked, now): With the default (require_confinement=False) every existing caller gets exactly the same spawns as before; wrap_argv's no-backend verdict is the same floor_mandates_sandbox or not opted_in expression as on main. New: the Codex dictation spawn passes require_confinement=True, so the mode-off passthrough, the first-party no-backend carve-out, the opt-in or platform-default no-backend passthrough and Kiro delegation on macOS and Windows all raise for that child; only a namespace launcher, Seatbelt, or an already-inside-Crew-sandbox passthrough lets it run. This only makes the Codex child stricter.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): If the new branch refused a confinable spawn, Codex dictation would show stt_codex_sandbox_unavailable on a host that has a sandbox; no other caller sets the keyword, so agents, tools and other providers are unaffected. No path is loosened and no secret is exposed; the Codex child also no longer receives DBUS_SESSION_BUS_ADDRESS or XDG_RUNTIME_DIR.
  • Evidence checked (which sandbox result proves it): The sandbox files are unchanged since e54c5e6; since 29d0154 only module bindings and an unused helper changed, and this head is a clean rebase onto main f3c97e5 with the PR's patch unchanged. This head changes which codex the confined child runs: the same one the Codex model provider runs (CODEX_PATH, else the @openai/codex script the codex-acp adapter depends on), and the spawn now also passes the provider's credential mask (extra_hidden_dirs), so the child sees the same hidden paths as the provider's codex-acp. The 24 pre-push gates passed on this head. An independent read-only Opus verifier read wrap_argv end to end and listed every return: with require_confinement=True the only non-raising returns are the namespace launcher, Seatbelt and the inside-Crew-sandbox passthrough, Kiro delegation is unreachable because the Kiro classification is forced False, and the default path is unchanged against origin/main. On this Linux host the real Codex 0.165.0 binary ran through sandboxed_spawn_argv_async, answered initialize and account/read, and its launcher file and temp cwd were removed.
  • No regression:
    • Tools still work (which tools/commands were run, result): The sandboxed Codex app-server returned the coded login refusal for a Bedrock login; a Dev Fleet pod ran synthetic PCM through /api/ws/stt to the same result; the scoped backend set for this diff ran 26,578 passed, and its 20 failures all fail identically on clean main 18d6b4e on this host.
    • Backward compatible (old config / old data / old callers still work, how checked): Both new keywords default to the old behaviour and are forwarded only when True (test/test_sandbox_off_loop.py); stored stt.provider values and the local default stay valid (speech seam and config baseline tests).
    • Existing tests (which suites passed on this head): test/test_codex_stt.py, test/test_codex_media.py, test/test_codex_stt_stream.py, test/test_sandbox_off_loop.py, test/test_spawn_audit.py, test/test_sandbox_refactor_facade.py, test/test_facade_mirror_guards.py, test/test_sandbox_first_party_exec.py and test/test_sandbox_unsandboxed_exec_consent.py pass locally, plus mypy over src/kiro_crew and semgrep on the diff.
  • How to undo: Revert this PR's single commit; no caller other than the Codex dictation spawn passes require_confinement=True.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

note: updated onto main f3c97e5, which carries #30127, the fix for the Slack code-channel tests (#30095). CI and the review lanes that hit the API rate limit are re-running.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Nov 5, 2026
@Pearcekieser
Pearcekieser force-pushed the pearcekieser/codex-stt branch from 4d4755c to 0a3d5e8 Compare November 5, 2026 06:14
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 0a3d5e8
  • What rule changed: wrap_argv gains an opt-in keyword, require_confinement (default False), threaded through sandboxed_spawn_argv and sandboxed_spawn_argv_async, which forward it only when True. With it set, wrap_argv never delegates to Kiro's internal sandbox and raises instead of returning an unconfined argv. no_backend_refuses_spawn(mode) is a Settings-only hint of whether a confining backend exists. sandbox.py only updates its type-checking forward list.
  • Before -> after (what was allowed/blocked, now): With the default (require_confinement=False) every existing caller gets exactly the same spawns as before; wrap_argv's no-backend verdict is the same floor_mandates_sandbox or not opted_in expression as on main. New: the Codex dictation spawn passes require_confinement=True, so the mode-off passthrough, the first-party no-backend carve-out, the opt-in or platform-default no-backend passthrough and Kiro delegation on macOS and Windows all raise for that child; only a namespace launcher, Seatbelt, or an already-inside-Crew-sandbox passthrough lets it run. This only makes the Codex child stricter.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): If the new branch refused a confinable spawn, Codex dictation would show stt_codex_sandbox_unavailable on a host that has a sandbox; no other caller sets the keyword, so agents, tools and other providers are unaffected. No path is loosened and no secret is exposed; the Codex child also no longer receives DBUS_SESSION_BUS_ADDRESS or XDG_RUNTIME_DIR.
  • Evidence checked (which sandbox result proves it): The sandbox files are unchanged since e54c5e6; since 29d0154 only module bindings and an unused helper changed, and this head is a clean rebase onto main ec2e1a1 with the PR's patch unchanged. This head changes which codex the confined child runs: the same one the Codex model provider runs (CODEX_PATH, else the @openai/codex script the codex-acp adapter depends on), and the spawn now also passes the provider's credential mask (extra_hidden_dirs), so the child sees the same hidden paths as the provider's codex-acp. The 24 pre-push gates passed on this head. An independent read-only Opus verifier read wrap_argv end to end and listed every return: with require_confinement=True the only non-raising returns are the namespace launcher, Seatbelt and the inside-Crew-sandbox passthrough, Kiro delegation is unreachable because the Kiro classification is forced False, and the default path is unchanged against origin/main. On this Linux host the real Codex 0.165.0 binary ran through sandboxed_spawn_argv_async, answered initialize and account/read, and its launcher file and temp cwd were removed.
  • No regression:
    • Tools still work (which tools/commands were run, result): The sandboxed Codex app-server returned the coded login refusal for a Bedrock login; a Dev Fleet pod ran synthetic PCM through /api/ws/stt to the same result; the scoped backend set for this diff ran 26,578 passed, and its 20 failures all fail identically on clean main 18d6b4e on this host.
    • Backward compatible (old config / old data / old callers still work, how checked): Both new keywords default to the old behaviour and are forwarded only when True (test/test_sandbox_off_loop.py); stored stt.provider values and the local default stay valid (speech seam and config baseline tests).
    • Existing tests (which suites passed on this head): test/test_codex_stt.py, test/test_codex_media.py, test/test_codex_stt_stream.py, test/test_sandbox_off_loop.py, test/test_spawn_audit.py, test/test_sandbox_refactor_facade.py, test/test_facade_mirror_guards.py, test/test_sandbox_first_party_exec.py and test/test_sandbox_unsandboxed_exec_consent.py pass locally, plus mypy over src/kiro_crew and semgrep on the diff.
  • How to undo: Revert this PR's single commit; no caller other than the Codex dictation spawn passes require_confinement=True.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in config-baseline.json and docs/feature-map/README.md since this head went green (f3c97e5 -> ec2e1a1); CI re-running.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: a56e3fb
  • What rule changed: wrap_argv gains an opt-in keyword, require_confinement (default False), threaded through sandboxed_spawn_argv and sandboxed_spawn_argv_async, which forward it only when True. With it set, wrap_argv never delegates to Kiro's internal sandbox and raises instead of returning an unconfined argv. no_backend_refuses_spawn(mode) is a Settings-only hint of whether a confining backend exists. sandbox.py only updates its type-checking forward list.
  • Before -> after (what was allowed/blocked, now): With the default (require_confinement=False) every existing caller gets exactly the same spawns as before; wrap_argv's no-backend verdict is the same floor_mandates_sandbox or not opted_in expression as on main. New: the Codex dictation spawn passes require_confinement=True, so the mode-off passthrough, the first-party no-backend carve-out, the opt-in or platform-default no-backend passthrough and Kiro delegation on macOS and Windows all raise for that child; only a namespace launcher, Seatbelt, or an already-inside-Crew-sandbox passthrough lets it run. This only makes the Codex child stricter.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): If the new branch refused a confinable spawn, Codex dictation would show stt_codex_sandbox_unavailable on a host that has a sandbox; no other caller sets the keyword, so agents, tools and other providers are unaffected. No path is loosened and no secret is exposed; the Codex child also no longer receives DBUS_SESSION_BUS_ADDRESS or XDG_RUNTIME_DIR.
  • Evidence checked (which sandbox result proves it): The sandbox files are unchanged since e54c5e6; since 29d0154 only module bindings and an unused helper changed, and this head is a clean rebase onto main ec2e1a1 with the PR's patch unchanged. This head changes which codex the confined child runs: the same one the Codex model provider runs (CODEX_PATH, else the @openai/codex script the codex-acp adapter depends on), and the spawn now also passes the provider's credential mask (extra_hidden_dirs), so the child sees the same hidden paths as the provider's codex-acp. The 24 pre-push gates passed on this head. An independent read-only Opus verifier read wrap_argv end to end and listed every return: with require_confinement=True the only non-raising returns are the namespace launcher, Seatbelt and the inside-Crew-sandbox passthrough, Kiro delegation is unreachable because the Kiro classification is forced False, and the default path is unchanged against origin/main. On this Linux host the real Codex 0.165.0 binary ran through sandboxed_spawn_argv_async, answered initialize and account/read, and its launcher file and temp cwd were removed.
  • No regression:
    • Tools still work (which tools/commands were run, result): The sandboxed Codex app-server returned the coded login refusal for a Bedrock login; a Dev Fleet pod ran synthetic PCM through /api/ws/stt to the same result; the scoped backend set for this diff ran 26,578 passed, and its 20 failures all fail identically on clean main 18d6b4e on this host.
    • Backward compatible (old config / old data / old callers still work, how checked): Both new keywords default to the old behaviour and are forwarded only when True (test/test_sandbox_off_loop.py); stored stt.provider values and the local default stay valid (speech seam and config baseline tests).
    • Existing tests (which suites passed on this head): test/test_codex_stt.py, test/test_codex_media.py, test/test_codex_stt_stream.py, test/test_sandbox_off_loop.py, test/test_spawn_audit.py, test/test_sandbox_refactor_facade.py, test/test_facade_mirror_guards.py, test/test_sandbox_first_party_exec.py and test/test_sandbox_unsandboxed_exec_consent.py pass locally, plus mypy over src/kiro_crew and semgrep on the diff.
  • How to undo: Revert this PR's single commit; no caller other than the Codex dictation spawn passes require_confinement=True.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • span=93c0e8604331: the first Codex session cold-imported PyAV and aiortc on the event loop

fixed in a56e3fb: start() awaits codex_media.load_media_stack() through asyncio.to_thread before create_peer(), so the cold import and the FFmpeg dlopen run off the loop. create_peer() stays on the loop because aiortc's RTCRtpSender binds asyncio.get_event_loop() at construction. Live dictation and recorded clips both reach this one call site.
Test: test/test_codex_stt.py::test_start_imports_media_stack_off_loop_and_builds_peer_on_loop.
resolution: narrowed -- cold av/aiortc import moved off the event loop via asyncio.to_thread(load_media_stack); create_peer stays on the loop

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 6445264
  • What rule changed: wrap_argv gains an opt-in keyword, require_confinement (default False), threaded through sandboxed_spawn_argv and sandboxed_spawn_argv_async, which forward it only when True. With it set, wrap_argv never delegates to Kiro's internal sandbox and raises instead of returning an unconfined argv. no_backend_refuses_spawn(mode) is a Settings-only hint of whether a confining backend exists. sandbox.py only updates its type-checking forward list.
  • Before -> after (what was allowed/blocked, now): With the default (require_confinement=False) every existing caller gets exactly the same spawns as before; wrap_argv's no-backend verdict is the same floor_mandates_sandbox or not opted_in expression as on main. New: the Codex dictation spawn passes require_confinement=True, so the mode-off passthrough, the first-party no-backend carve-out, the opt-in or platform-default no-backend passthrough and Kiro delegation on macOS and Windows all raise for that child; only a namespace launcher, Seatbelt, or an already-inside-Crew-sandbox passthrough lets it run. This only makes the Codex child stricter.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): If the new branch refused a confinable spawn, Codex dictation would show stt_codex_sandbox_unavailable on a host that has a sandbox; no other caller sets the keyword, so agents, tools and other providers are unaffected. No path is loosened and no secret is exposed; the Codex child also no longer receives DBUS_SESSION_BUS_ADDRESS or XDG_RUNTIME_DIR.
  • Evidence checked (which sandbox result proves it): The sandbox files are unchanged since e54c5e6; since 29d0154 only module bindings and an unused helper changed, and this head is a rebase onto main fe6b063. Its one conflict, in the type-checking imports of agent_sdk/__init__.py, kept both sides and touches no sandbox code. This head changes which codex the confined child runs: the same one the Codex model provider runs (CODEX_PATH, else the @openai/codex script the codex-acp adapter depends on), and the spawn now also passes the provider's credential mask (extra_hidden_dirs), so the child sees the same hidden paths as the provider's codex-acp. The 24 pre-push gates passed on this head. An independent read-only Opus verifier read wrap_argv end to end and listed every return: with require_confinement=True the only non-raising returns are the namespace launcher, Seatbelt and the inside-Crew-sandbox passthrough, Kiro delegation is unreachable because the Kiro classification is forced False, and the default path is unchanged against origin/main. On this Linux host the real Codex 0.165.0 binary ran through sandboxed_spawn_argv_async, answered initialize and account/read, and its launcher file and temp cwd were removed.
  • No regression:
    • Tools still work (which tools/commands were run, result): The sandboxed Codex app-server returned the coded login refusal for a Bedrock login; a Dev Fleet pod ran synthetic PCM through /api/ws/stt to the same result; the scoped backend set for this diff ran 26,578 passed, and its 20 failures all fail identically on clean main 18d6b4e on this host.
    • Backward compatible (old config / old data / old callers still work, how checked): Both new keywords default to the old behaviour and are forwarded only when True (test/test_sandbox_off_loop.py); stored stt.provider values and the local default stay valid (speech seam and config baseline tests).
    • Existing tests (which suites passed on this head): test/test_codex_stt.py, test/test_codex_media.py, test/test_codex_stt_stream.py, test/test_sandbox_off_loop.py, test/test_spawn_audit.py, test/test_sandbox_refactor_facade.py, test/test_facade_mirror_guards.py, test/test_sandbox_first_party_exec.py and test/test_sandbox_unsandboxed_exec_consent.py pass locally, plus mypy over src/kiro_crew and semgrep on the diff.
  • How to undo: Revert this PR's single commit; no caller other than the Codex dictation spawn passes require_confinement=True.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 757abe8
  • What rule changed: wrap_argv gains an opt-in keyword, require_confinement (default False), threaded through sandboxed_spawn_argv and sandboxed_spawn_argv_async, which forward it only when True. With it set, wrap_argv never delegates to Kiro's internal sandbox and raises instead of returning an unconfined argv. no_backend_refuses_spawn(mode) is a Settings-only hint of whether a confining backend exists. sandbox.py only updates its type-checking forward list.
  • Before -> after (what was allowed/blocked, now): With the default (require_confinement=False) every existing caller gets exactly the same spawns as before; wrap_argv's no-backend verdict is the same floor_mandates_sandbox or not opted_in expression as on main. New: the Codex dictation spawn passes require_confinement=True, so the mode-off passthrough, the first-party no-backend carve-out, the opt-in or platform-default no-backend passthrough and Kiro delegation on macOS and Windows all raise for that child; only a namespace launcher, Seatbelt, or an already-inside-Crew-sandbox passthrough lets it run. This only makes the Codex child stricter.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): If the new branch refused a confinable spawn, Codex dictation would show stt_codex_sandbox_unavailable on a host that has a sandbox; no other caller sets the keyword, so agents, tools and other providers are unaffected. No path is loosened and no secret is exposed; the Codex child also no longer receives DBUS_SESSION_BUS_ADDRESS or XDG_RUNTIME_DIR.
  • Evidence checked (which sandbox result proves it): The sandbox files are unchanged since e54c5e6; since 29d0154 only module bindings and an unused helper changed, and this head is a rebase onto main 16ff876. Its one conflict, in docs/feature-map/README.md, kept the new main row and this PR's voice row, and touches no sandbox code. Main changed sandbox.py and sandbox_argv.py in this range, which merged without conflict, and the sandbox, speech-to-text and Codex test files pass on this head. This head changes which codex the confined child runs: the same one the Codex model provider runs (CODEX_PATH, else the @openai/codex script the codex-acp adapter depends on), and the spawn now also passes the provider's credential mask (extra_hidden_dirs), so the child sees the same hidden paths as the provider's codex-acp. The 24 pre-push gates passed on this head. An independent read-only Opus verifier read wrap_argv end to end and listed every return: with require_confinement=True the only non-raising returns are the namespace launcher, Seatbelt and the inside-Crew-sandbox passthrough, Kiro delegation is unreachable because the Kiro classification is forced False, and the default path is unchanged against origin/main. On this Linux host the real Codex 0.165.0 binary ran through sandboxed_spawn_argv_async, answered initialize and account/read, and its launcher file and temp cwd were removed.
  • No regression:
    • Tools still work (which tools/commands were run, result): The sandboxed Codex app-server returned the coded login refusal for a Bedrock login; a Dev Fleet pod ran synthetic PCM through /api/ws/stt to the same result; the scoped backend set for this diff ran 26,578 passed, and its 20 failures all fail identically on clean main 18d6b4e on this host.
    • Backward compatible (old config / old data / old callers still work, how checked): Both new keywords default to the old behaviour and are forwarded only when True (test/test_sandbox_off_loop.py); stored stt.provider values and the local default stay valid (speech seam and config baseline tests).
    • Existing tests (which suites passed on this head): test/test_codex_stt.py, test/test_codex_media.py, test/test_codex_stt_stream.py, test/test_sandbox_off_loop.py, test/test_spawn_audit.py, test/test_sandbox_refactor_facade.py, test/test_facade_mirror_guards.py, test/test_sandbox_first_party_exec.py and test/test_sandbox_unsandboxed_exec_consent.py pass locally, plus mypy over src/kiro_crew and semgrep on the diff.
  • How to undo: Revert this PR's single commit; no caller other than the Codex dictation spawn passes require_confinement=True.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 734dcc7
  • What rule changed: wrap_argv gains an opt-in keyword, require_confinement (default False), threaded through sandboxed_spawn_argv and sandboxed_spawn_argv_async, which forward it only when True. With it set, wrap_argv never delegates to Kiro's internal sandbox and raises instead of returning an unconfined argv. no_backend_refuses_spawn(mode) is a Settings-only hint of whether a confining backend exists. sandbox.py only updates its type-checking forward list.
  • Before -> after (what was allowed/blocked, now): With the default (require_confinement=False) every existing caller gets exactly the same spawns as before; wrap_argv's no-backend verdict is the same floor_mandates_sandbox or not opted_in expression as on main. New: the Codex dictation spawn passes require_confinement=True, so the mode-off passthrough, the first-party no-backend carve-out, the opt-in or platform-default no-backend passthrough and Kiro delegation on macOS and Windows all raise for that child; only a namespace launcher, Seatbelt, or an already-inside-Crew-sandbox passthrough lets it run. This only makes the Codex child stricter.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): If the new branch refused a confinable spawn, Codex dictation would show stt_codex_sandbox_unavailable on a host that has a sandbox; no other caller sets the keyword, so agents, tools and other providers are unaffected. No path is loosened and no secret is exposed; the Codex child also no longer receives DBUS_SESSION_BUS_ADDRESS or XDG_RUNTIME_DIR.
  • Evidence checked (which sandbox result proves it): The sandbox files are unchanged since e54c5e6; since 29d0154 only module bindings and an unused helper changed, and this head is a rebase onto main d775742. Its one conflict, in docs/feature-map/README.md, kept main's code-channel row and this PR's voice row, and touches no sandbox code. Main changed agent_sdk/backends.py and acp/harness/codex.py since the last head, which merged without conflict, and the sandbox, speech-to-text and Codex test files pass on this head. This head changes which codex the confined child runs: the same one the Codex model provider runs (CODEX_PATH, else the @openai/codex script the codex-acp adapter depends on), and the spawn now also passes the provider's credential mask (extra_hidden_dirs), so the child sees the same hidden paths as the provider's codex-acp. The 24 pre-push gates passed on this head. An independent read-only Opus verifier read wrap_argv end to end and listed every return: with require_confinement=True the only non-raising returns are the namespace launcher, Seatbelt and the inside-Crew-sandbox passthrough, Kiro delegation is unreachable because the Kiro classification is forced False, and the default path is unchanged against origin/main. On this Linux host the real Codex 0.165.0 binary ran through sandboxed_spawn_argv_async, answered initialize and account/read, and its launcher file and temp cwd were removed.
  • No regression:
    • Tools still work (which tools/commands were run, result): The sandboxed Codex app-server returned the coded login refusal for a Bedrock login; a Dev Fleet pod ran synthetic PCM through /api/ws/stt to the same result; the scoped backend set for this diff ran 26,578 passed, and its 20 failures all fail identically on clean main 18d6b4e on this host.
    • Backward compatible (old config / old data / old callers still work, how checked): Both new keywords default to the old behaviour and are forwarded only when True (test/test_sandbox_off_loop.py); stored stt.provider values and the local default stay valid (speech seam and config baseline tests).
    • Existing tests (which suites passed on this head): test/test_codex_stt.py, test/test_codex_media.py, test/test_codex_stt_stream.py, test/test_sandbox_off_loop.py, test/test_spawn_audit.py, test/test_sandbox_refactor_facade.py, test/test_facade_mirror_guards.py, test/test_sandbox_first_party_exec.py and test/test_sandbox_unsandboxed_exec_consent.py pass locally, plus mypy over src/kiro_crew and semgrep on the diff.
  • How to undo: Revert this PR's single commit; no caller other than the Codex dictation spawn passes require_confinement=True.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 34a896e
  • What rule changed: wrap_argv gains an opt-in keyword, require_confinement (default False), threaded through sandboxed_spawn_argv and sandboxed_spawn_argv_async, which forward it only when True. With it set, wrap_argv never delegates to Kiro's internal sandbox and raises instead of returning an unconfined argv. no_backend_refuses_spawn(mode) is a Settings-only hint of whether a confining backend exists. sandbox.py only updates its type-checking forward list.
  • Before -> after (what was allowed/blocked, now): With the default (require_confinement=False) every existing caller gets exactly the same spawns as before; wrap_argv's no-backend verdict is the same floor_mandates_sandbox or not opted_in expression as on main. New: the Codex dictation spawn passes require_confinement=True, so the mode-off passthrough, the first-party no-backend carve-out, the opt-in or platform-default no-backend passthrough and Kiro delegation on macOS and Windows all raise for that child; only a namespace launcher, Seatbelt, or an already-inside-Crew-sandbox passthrough lets it run. This only makes the Codex child stricter.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): If the new branch refused a confinable spawn, Codex dictation would show stt_codex_sandbox_unavailable on a host that has a sandbox; no other caller sets the keyword, so agents, tools and other providers are unaffected. No path is loosened and no secret is exposed; the Codex child also no longer receives DBUS_SESSION_BUS_ADDRESS or XDG_RUNTIME_DIR.
  • Evidence checked (which sandbox result proves it): The sandbox files are unchanged since e54c5e6; since 29d0154 only module bindings and an unused helper changed, and this head is a rebase onto main 1548e9f. Its one conflict, in dashboard/stt_stream.py, is in the speech session driver and touches no sandbox code. Main's capped= argument moved with _run_registered_session into stt_adapted_stream.py, and the driver's new relayed_codes argument keeps main's relayed-code list for registered providers. The sandbox, speech-to-text and Codex test files pass on this head. This head changes which codex the confined child runs: the same one the Codex model provider runs (CODEX_PATH, else the @openai/codex script the codex-acp adapter depends on), and the spawn now also passes the provider's credential mask (extra_hidden_dirs), so the child sees the same hidden paths as the provider's codex-acp. The 24 pre-push gates passed on this head. An independent read-only Opus verifier read wrap_argv end to end and listed every return: with require_confinement=True the only non-raising returns are the namespace launcher, Seatbelt and the inside-Crew-sandbox passthrough, Kiro delegation is unreachable because the Kiro classification is forced False, and the default path is unchanged against origin/main. On this Linux host the real Codex 0.165.0 binary ran through sandboxed_spawn_argv_async, answered initialize and account/read, and its launcher file and temp cwd were removed.
  • No regression:
    • Tools still work (which tools/commands were run, result): The sandboxed Codex app-server returned the coded login refusal for a Bedrock login; a Dev Fleet pod ran synthetic PCM through /api/ws/stt to the same result; the scoped backend set for this diff ran 26,578 passed, and its 20 failures all fail identically on clean main 18d6b4e on this host.
    • Backward compatible (old config / old data / old callers still work, how checked): Both new keywords default to the old behaviour and are forwarded only when True (test/test_sandbox_off_loop.py); stored stt.provider values and the local default stay valid (speech seam and config baseline tests).
    • Existing tests (which suites passed on this head): test/test_codex_stt.py, test/test_codex_media.py, test/test_codex_stt_stream.py, test/test_sandbox_off_loop.py, test/test_spawn_audit.py, test/test_sandbox_refactor_facade.py, test/test_facade_mirror_guards.py, test/test_sandbox_first_party_exec.py and test/test_sandbox_unsandboxed_exec_consent.py pass locally, plus mypy over src/kiro_crew and semgrep on the diff.
  • How to undo: Revert this PR's single commit; no caller other than the Codex dictation spawn passes require_confinement=True.

@iamwhatever

Copy link
Copy Markdown
Contributor

Hold for maintainer review at 34a896e.

This PR adds a sandbox mode and a new spawned process, so it is reserved for a human:

In the sandbox files I read, require_confinement defaults to False, and the default path keeps main's no-backend expression. With the flag set, every unconfined fallback and Kiro delegation raise. I found no defect there. All five AI lanes pass, all 97 check runs are success or skipped, and PR Readiness passed. @bolichen97 has said a full maintainer review would follow once CI is green on a current base, and it now is.

For the maintainer: with agent.sandbox=off, dictation still runs Codex confined at standard, while the Codex model provider refuses to start (codex_rpc.py#L62-L65). First Principles suggests refusing instead. Running confined is the stricter side, so I treat this as a product choice for you rather than a defect.

AI findings judged non-blocking:

  • First Principles item 7: CODEX_CLI_ADAPTER_MISSING is exported with no readers (agent_sdk/init.py#L87). An unused export causes no user harm.
  • Design: no_backend_refuses_spawn copies wrap_argv's check. It is only a Settings hint, and the spawn itself still refuses (sandbox_wrap.py#L1065).
  • UX: the retention copy does not say yes or no, the three product names are unclear, and no setup-error screenshot is attached. These are wording issues.

Not read line by line: stt/codex.py, codex_media.py, the frontend and i18n files, and the 988-line test file.

To clear: a maintainer reviews the sandbox and spawn changes and rules on the sandbox-off behaviour.

— crew-pr-reviewer (r147)

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 1bc9a6f
  • What rule changed: wrap_argv gains an opt-in keyword, require_confinement (default False), threaded through sandboxed_spawn_argv and sandboxed_spawn_argv_async, which forward it only when True. With it set, wrap_argv never delegates to Kiro's internal sandbox and raises instead of returning an unconfined argv. no_backend_refuses_spawn(mode) is a Settings-only hint of whether a confining backend exists. sandbox.py only updates its type-checking forward list.
  • Before -> after (what was allowed/blocked, now): With the default (require_confinement=False) every existing caller gets exactly the same spawns as before; wrap_argv's no-backend verdict is the same floor_mandates_sandbox or not opted_in expression as on main. New: the Codex dictation spawn passes require_confinement=True, so the mode-off passthrough, the first-party no-backend carve-out, the opt-in or platform-default no-backend passthrough and Kiro delegation on macOS and Windows all raise for that child; only a namespace launcher, Seatbelt, or an already-inside-Crew-sandbox passthrough lets it run. This only makes the Codex child stricter.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): If the new branch refused a confinable spawn, Codex dictation would show stt_codex_sandbox_unavailable on a host that has a sandbox; no other caller sets the keyword, so agents, tools and other providers are unaffected. No path is loosened and no secret is exposed; the Codex child also no longer receives DBUS_SESSION_BUS_ADDRESS or XDG_RUNTIME_DIR.
  • Evidence checked (which sandbox result proves it): The sandbox files are unchanged since e54c5e6; since 29d0154 only module bindings and an unused helper changed, and this head is a rebase onto main 594344f. Its one conflict, the voice row of docs/feature-map/README.md, touches no code. Main changed sandbox.py in this range, which merged without conflict, and git range-diff shows the PR's code unchanged. The sandbox, speech-to-text and Codex test files pass on this head. This head changes which codex the confined child runs: the same one the Codex model provider runs (CODEX_PATH, else the @openai/codex script the codex-acp adapter depends on), and the spawn now also passes the provider's credential mask (extra_hidden_dirs), so the child sees the same hidden paths as the provider's codex-acp. The 24 pre-push gates passed on this head. An independent read-only Opus verifier read wrap_argv end to end and listed every return: with require_confinement=True the only non-raising returns are the namespace launcher, Seatbelt and the inside-Crew-sandbox passthrough, Kiro delegation is unreachable because the Kiro classification is forced False, and the default path is unchanged against origin/main. On this Linux host the real Codex 0.165.0 binary ran through sandboxed_spawn_argv_async, answered initialize and account/read, and its launcher file and temp cwd were removed.
  • No regression:
    • Tools still work (which tools/commands were run, result): The sandboxed Codex app-server returned the coded login refusal for a Bedrock login; a Dev Fleet pod ran synthetic PCM through /api/ws/stt to the same result; the scoped backend set for this diff ran 26,578 passed, and its 20 failures all fail identically on clean main 18d6b4e on this host.
    • Backward compatible (old config / old data / old callers still work, how checked): Both new keywords default to the old behaviour and are forwarded only when True (test/test_sandbox_off_loop.py); stored stt.provider values and the local default stay valid (speech seam and config baseline tests).
    • Existing tests (which suites passed on this head): test/test_codex_stt.py, test/test_codex_media.py, test/test_codex_stt_stream.py, test/test_sandbox_off_loop.py, test/test_spawn_audit.py, test/test_sandbox_refactor_facade.py, test/test_facade_mirror_guards.py, test/test_sandbox_first_party_exec.py and test/test_sandbox_unsandboxed_exec_consent.py pass locally, plus mypy over src/kiro_crew and semgrep on the diff.
  • How to undo: Revert this PR's single commit; no caller other than the Codex dictation spawn passes require_confinement=True.

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

Requesting changes at 1bc9a6f for one point. CI and the AI lanes pass, Codex stays opt-in (test_codex_is_opt_in_and_preserves_default), and the default provider stays local.

stt/codex_rpc.py adds a regex in product code. This repository asks new product code not to parse text with a regex:

_VERSION_RE = re.compile(r"kiro_crew_dictation/(\d+)\.(\d+)\.(\d+)(?:\s|$)")

and _VERSION_RE.match(str(initialized.get("userAgent", ""))) reads the Codex version from that string. Please parse it with exact token handling instead:

  • Take the first whitespace token of userAgent (str.split()), and require it to start with the literal prefix kiro_crew_dictation/ (str.startswith).
  • Split the rest on ., require exactly three parts, each isascii() and isdigit(), and convert them with int().
  • Treat anything else as no version, as the match miss does today.

A test for a valid value, one with a suffix or a fourth part, and one with the wrong prefix would cover it.

On the sandbox change: require_confinement defaults to False, and only the new Codex dictation spawn sets it, so no existing spawn changes. That is fine as it is.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

@bolichen97 note: replaced the regex in stt/codex_rpc.py with exact token handling.

The new codex_version() takes the first whitespace token of userAgent with str.split() and requires the literal kiro_crew_dictation/ prefix with str.startswith. It splits the rest on . and requires exactly three parts, each isascii() and isdigit(), then converts them with int(). Any other value returns None, and CodexRpc.start refuses None the same way it refused a match miss. The re import is gone from the file.

test_codex_version_reads_only_an_exact_three_part_token covers 13 inputs. Three are valid values, one of them with a tab before the suffix. The rest return None: a -alpha suffix, a fourth part, two parts, an empty part, a non-ASCII digit, another prefix, the prefix in a later token, unknown, an empty string and None. The start-up refusal test now also covers the fourth-part and wrong-prefix cases. The spec in docs/system-specs/modules/stt-streaming.md names the parser.

This head is also a rebase onto current main. Its one conflict, in agent_sdk/__init__.py, kept main's shell_command_from_tool_params and this PR's resolve_codex_cli.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 849efb3
  • What rule changed: wrap_argv gains an opt-in keyword, require_confinement (default False), threaded through sandboxed_spawn_argv and sandboxed_spawn_argv_async, which forward it only when True. With it set, wrap_argv never delegates to Kiro's internal sandbox and raises instead of returning an unconfined argv. no_backend_refuses_spawn(mode) is a Settings-only hint of whether a confining backend exists. sandbox.py only updates its type-checking forward list.
  • Before -> after (what was allowed/blocked, now): With the default (require_confinement=False) every existing caller gets exactly the same spawns as before; wrap_argv's no-backend verdict is the same floor_mandates_sandbox or not opted_in expression as on main. New: the Codex dictation spawn passes require_confinement=True, so the mode-off passthrough, the first-party no-backend carve-out, the opt-in or platform-default no-backend passthrough and Kiro delegation on macOS and Windows all raise for that child; only a namespace launcher, Seatbelt, or an already-inside-Crew-sandbox passthrough lets it run. This only makes the Codex child stricter.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): If the new branch refused a confinable spawn, Codex dictation would show stt_codex_sandbox_unavailable on a host that has a sandbox; no other caller sets the keyword, so agents, tools and other providers are unaffected. No path is loosened and no secret is exposed; the Codex child also no longer receives DBUS_SESSION_BUS_ADDRESS or XDG_RUNTIME_DIR.
  • Evidence checked (which sandbox result proves it): The sandbox files are unchanged since e54c5e6; since 29d0154 only module bindings and an unused helper changed, and this head is a rebase onto main fe2d88c. Its one conflict, in agent_sdk/__init__.py, kept main's shell_command_from_tool_params and this PR's resolve_codex_cli, and touches no sandbox code. Its one code change, for the maintainer review, replaces the Codex version regex in stt/codex_rpc.py with exact token handling, and also touches no sandbox code. The sandbox, speech-to-text and Codex test files pass on this head. This head changes which codex the confined child runs: the same one the Codex model provider runs (CODEX_PATH, else the @openai/codex script the codex-acp adapter depends on), and the spawn now also passes the provider's credential mask (extra_hidden_dirs), so the child sees the same hidden paths as the provider's codex-acp. The 24 pre-push gates passed on this head. An independent read-only Opus verifier read wrap_argv end to end and listed every return: with require_confinement=True the only non-raising returns are the namespace launcher, Seatbelt and the inside-Crew-sandbox passthrough, Kiro delegation is unreachable because the Kiro classification is forced False, and the default path is unchanged against origin/main. On this Linux host the real Codex 0.165.0 binary ran through sandboxed_spawn_argv_async, answered initialize and account/read, and its launcher file and temp cwd were removed.
  • No regression:
    • Tools still work (which tools/commands were run, result): The sandboxed Codex app-server returned the coded login refusal for a Bedrock login; a Dev Fleet pod ran synthetic PCM through /api/ws/stt to the same result; the scoped backend set for this diff ran 26,578 passed, and its 20 failures all fail identically on clean main 18d6b4e on this host.
    • Backward compatible (old config / old data / old callers still work, how checked): Both new keywords default to the old behaviour and are forwarded only when True (test/test_sandbox_off_loop.py); stored stt.provider values and the local default stay valid (speech seam and config baseline tests).
    • Existing tests (which suites passed on this head): test/test_codex_stt.py, test/test_codex_media.py, test/test_codex_stt_stream.py, test/test_sandbox_off_loop.py, test/test_spawn_audit.py, test/test_sandbox_refactor_facade.py, test/test_facade_mirror_guards.py, test/test_sandbox_first_party_exec.py and test/test_sandbox_unsandboxed_exec_consent.py pass locally, plus mypy over src/kiro_crew and semgrep on the diff.
  • How to undo: Revert this PR's single commit; no caller other than the Codex dictation spawn passes require_confinement=True.

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this. The Codex wire boundary is careful work: a five-method allowlist, every server request denied, and bounded transcript storage. The review of head 849efb3 found two things to fix before this can merge.

  1. No evidence for the new error states (website/src/i18n/locales/en.manual.json:9480-9486).

    • What happens: the PR adds seven stt_codex_* setup-error messages to the Voice page. The UX review on this head says it "cannot evaluate: missing a screenshot of any Codex setup-error state". Both screenshots in the body show only the ready state, and they come from an older build (3c268b4). No test renders an error state.
    • Smallest fix: attach screenshots taken at this head of Codex with the Voice provider set to it, in at least two states. Show one Settings state, either Codex not installed (stt_codex_missing) or sandbox unavailable. Show one signed-out error (stt_codex_login_required); the error at record time is fine. Then re-run the UX review.
  2. A second confinement check duplicates one that main already has (sandbox_wrap.py:518, stt/codex.py:124, stt/codex_rpc.py:62 and :153).

    • What happens: no_backend_refuses_spawn and the new require_confinement flag check the same thing as sandbox_spawn.credential_mask_applies(mode) on main. The Codex model provider already relies on that check through enforce_sandbox_floor. The new predicate equals not credential_mask_applies(mode) in every case but one: a gateway that itself runs inside a Kiro Crew sandbox. In that case dictation starts, and wrap_argv takes the nested passthrough without extra_hidden_dirs. So the child does not get the credential mask that the body and the codex_rpc.py comment promise. The provider refuses that case. For this one caller, the only reachable branch of require_confinement is a case the preflight check already refuses.
    • Smallest fix: delete no_backend_refuses_spawn, the require_confinement parameter and its branches in sandbox_wrap.py and sandbox_spawn.py, and the sandbox.py export. Then call credential_mask_applies(...) (or enforce_sandbox_floor(ACP_BACKEND_CODEX, ...)) in codex.sandbox_refuses() and before the spawn in CodexRpc.start. After this change the PR touches no sandbox file. A maintainer still has to decide whether agent.sandbox=off should refuse or run at standard. This fix works with either answer.

The earlier change request on 1bc9a6f asked to replace the regex in codex_version. That looks done at this head, but the request stays open until its reviewer reviews again.

Optional:

  • The only test that reaches the Codex spawn stubs codex_credential_mask and checks only wrapped[:5]. You can remove the mask, --disable shell_tool or strip_python_env=True and every test still passes. Add a test that uses the real mask and asserts the full argv and strip_python_env.
  • The dictation child gets no private CODEX_SQLITE_HOME, and _ENV_NAMES drops one that an operator sets. The Codex provider gives each runtime its own because concurrent app-servers fail with database is locked. We have not reproduced this, so treat it as a likely risk.
  • Open PR #29221 changes which codex binary the provider runs and adds its own bundled-Codex lookup. Name the merge order in the body so dictation and the provider keep running the same binary.

Add Codex (experimental) to the speech-to-text providers. It uses an existing
Codex ChatGPT login through Codex's app-server realtime transport, for live
dictation and recorded clips. The local provider stays the default.

Only the user's input transcript becomes text. The adapter sends five RPC
methods, sets client-managed handoffs and declines every server request, so
dictated words never start a Codex task, and assistant audio is discarded.

The codex binary comes from the provider-CLI trust walk, never a bare PATH
lookup, and the app-server child runs inside the agent sandbox at the
operator's tier or standard, whichever is stricter. Sessions finish with
session.close and read late transcript text until session.closed.
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Answers to the review of 849efb3, both fixed in 5c9aa7a.

1. note: screenshots of two error states are now in the body, taken in a Dev Fleet pod built at 066b2ed400 with the provider set to Codex. Neither state is stubbed.

  • Settings shows not installed with the stt_codex_missing text while no codex-acp adapter is reachable.
  • Starting dictation from the composer microphone in Chromium with a fake audio device makes /api/ws/stt answer stt_codex_login_required, because this host's Codex login is not a ChatGPT login. The composer shows "Sign in to Codex with ChatGPT using codex login. API-key logins are not supported here."

The UX review runs again on the new head.

2. note: the second confinement check is removed, and the PR now touches no sandbox file.

sandbox.py, sandbox_spawn.py, sandbox_wrap.py, test/test_sandbox_off_loop.py and test/test_sandbox_refactor_facade.py are back to main, so require_confinement and no_backend_refuses_spawn are gone. codex.sandbox_refuses() returns not sandbox.credential_mask_applies(codex_rpc.sandbox_mode()). CodexRpc.start reads the same predicate before the spawn and raises stt_codex_sandbox_unavailable when it is False. The sandbox wrapper and the child never run, and the temporary directory is removed. That closes the case you found: a gateway already inside a Crew sandbox is now refused instead of taking the nested passthrough without extra_hidden_dirs. Tests: test_settings_refuses_exactly_where_the_provider_mask_would_not_apply (the inside-sandbox row included) and test_start_refuses_before_spawning_where_the_mask_would_not_apply. The agent.sandbox=off behaviour is unchanged and stays a maintainer decision.

Optional items.

  • note: the spawn test now uses the provider's real mask (adapter_hidden_credential_dirs(ACP_BACKEND_CODEX)), and asserts the full argv, including --disable shell_tool and mcp_servers={}, plus strip_python_env=True. Removing any of them fails it.
  • thought (non-blocking): CODEX_SQLITE_HOME is not changed in this PR. I tried an empty private directory per session, and the local Opus review blocked it with a reason. With no seed, Codex rebuilds its index from every rollout at each dictation start, which acp-client.md measures at about 60 s and 400 MB at 3,200 threads. That is past the 30 s initialize timeout. A private home needs the provider's codex_sqlite.seed_private_state before every short session. That copy runs on every microphone press, and nobody has seen the lock contention yet. So the child keeps Codex's default location, as on the earlier heads. If you want the seeded private home, I will add it here.
  • note: the body now names the merge order with fix(codex): run app-server from the host's codex when it meets the bundled version #29221. Either PR can merge first, and the one that merges second makes resolve_codex_cli() follow the provider's lookup. If fix(codex): run app-server from the host's codex when it meets the bundled version #29221 merges first, I will do that here.

@KiroCrewCaptain

Copy link
Copy Markdown
Collaborator

Thanks for the quick turnaround. I re-reviewed head 5c9aa7a. I found nothing blocking, but this PR changes a design doc (docs/feature-map/README.md, plus the speech spec), so a maintainer has to sign off before it can merge. To propose a design, follow the request-for-change process in CONTRIBUTING.md (docs/request-for-change/).

What my earlier review of 849efb3 asked for:

  1. Screenshots of the error states: fixed. The body now shows stt_codex_missing in Settings and stt_codex_login_required at record time, and the UX review passes on this head.
  2. The duplicate confinement check: fixed. The diff touches no sandbox file. codex.sandbox_refuses() and CodexRpc.start both use sandbox.credential_mask_applies, so a gateway that is already inside a Crew sandbox is now refused.
  3. Optional points: the spawn test now uses the real provider mask and checks the full argv. The merge order with fix(codex): run app-server from the host's codex when it meets the bundled version #29221 is in the body. Your reasons for leaving CODEX_SQLITE_HOME alone hold up: an unseeded home rebuilds the index on every start, and that runs past the initialize timeout.

What I verified on this head: the child starts only through sandboxed_spawn_argv_async with the provider's credential mask. The env passes through an allowlist. Only allowlisted RPC methods are called, and every server request is declined. Only thread/realtime/ notifications reach the session. Transcript text is redacted on both the live and the batch path. All CI checks are green.

Still open for maintainers:

  • The change request from bolichen97 on 1bc9a6f asked to replace the version regex. The token parser at this head looks like it does that, but bolichen97 has not reviewed again yet.
  • With agent.sandbox=off, the Codex model provider refuses to start, but dictation still runs Codex confined at standard. The body says this openly. A maintainer should decide whether that is intended and record the decision.

Optional:

  • stt/codex.py:286: any local start failure that is not a CodexError becomes stt_codex_voice_unavailable, which the UI treats as a permanent refusal, and nothing logs the cause. Consider mapping it to stt_codex_failed and adding a logger.warning(..., exc_info=True).
  • packaging/build-desktop.sh:583: the voice-codex install has no if ! guard, so a missing wheel on any arch fails the whole desktop build for an opt-in provider. The recogniser step just below it is guarded.
  • No test reaches the transcript caps (_MAX_ITEMS, _MAX_TEXT_CHARS) or the two event-queue limits. A test at each limit, plus one just under it, would pin them.

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved at a maintainer's direction, on head 5c9aa7a.

Every item from the earlier reviews is resolved on this head: the error-state screenshots are attached and the UX review passes, the duplicate confinement check is gone (both entry points use sandbox.credential_mask_applies), and the version check now parses the first userAgent token with an exact prefix and three digit groups instead of a regex. The maintainer signed off on the feature-map README change and accepted the agent.sandbox=off difference as intended: dictation still runs Codex confined at standard, which is stricter than the model provider, not looser.

Optional follow-ups, not merge conditions: map a non-CodexError start failure in stt/codex.py:286 to stt_codex_failed with a logged cause, guard the voice-codex install in packaging/build-desktop.sh:583 like the recogniser step below it, and pin the transcript caps and event-queue limits with at-limit tests.

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.

Offer Codex as an experimental speech-to-text provider

4 participants