Skip to content

Silence the share-card failure beep in the test suite - #88

Merged
mstallone merged 28 commits into
foreign-reads-in-processfrom
silence-share-card-test-beep
Aug 4, 2026
Merged

mstallone merged 28 commits into
foreign-reads-in-processfrom
silence-share-card-test-beep

Conversation

@mstallone

@mstallone mstallone commented Aug 3, 2026 •

Copy link
Copy Markdown
Owner

Stacked on #87 (foreign-reads-in-process), the tail of the credential stack.

TL;DR: swift test no longer plays the system alert sound (Tink, or whatever the Mac's alert sound is) — the share-card failure beep is now injectable, and the test suite swaps it for a counter.

What was happening

  • ShareCardRenderer's failure paths call NSSound.beep() so a failed clipboard export is never silent. testCopyToPasteboardReturnsFalseForUnencodableImage deliberately exercises that path, so every automated test run played the system alert sound (/System/Library/Sounds/Tink.aiff on this machine).

What this changes

  • The audible cue becomes ShareCardRenderer.playAlertSound, defaulting to NSSound.beep() — production behavior unchanged.
  • ShareCardRendererTests swaps it for a counter in setUp (restored in tearDown), so the suite runs silently — and the failure test now also asserts the cue fires exactly once, which the old direct call couldn't verify.

Tests

  • swift test: 1,689 tests, 0 failures — and no beep.

testCopyToPasteboardReturnsFalseForUnencodableImage exercises the
share-card failure path, whose NSSound.beep() played the system alert
sound on every swift test run. The cue is now injectable: production
keeps the beep, the test suite swaps in a counter — which also lets
the failure test assert the cue fires exactly once.
@mstallone mstallone closed this Aug 4, 2026
@mstallone mstallone reopened this Aug 4, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@mstallone
mstallone merged commit 92f9a9c into main Aug 4, 2026
2 checks passed
mstallone added a commit that referenced this pull request Aug 4, 2026
…security (#89)

> Stacked on #88, the tail of the credential stack. Closes the "High"
finding from the latest post-stack review: Codex and Cursor could still
recreate the automatic password-prompt loop.

**TL;DR**: The last automatic prompt-capable `/usr/bin/security` reads —
Codex's keyring lookups (detection, refresh fallback, unattended
identity warming) and Cursor's two per-load reads — now run in-process
through the coordinator, prompt-free on every automatic path.

## What was happening

- `CodexAuthStore.loadKeychainAuth` and `CursorAuthStore`'s keychain
reads used the `/usr/bin/security` subprocess: prompt-capable, ACL'd to
the helper binary, uncoordinated, and running on launch detection, every
automatic refresh, and Codex's background identity-warm task.
- A protected item silently collapsed into "not logged in", so
keychain-only logins were undetectable and unapprovable.

## What this changes

- Codex `loadKeychainCredentials` / Cursor `loadCredentials` (tri-state
like Copilot's): automatic paths use the prompt-free in-process reads;
only a manual refresh may raise the approval prompt — once, authorizing
Runway itself.
- A protected item reports **permission-required**: it counts as a
credential footprint for seeding, and the card says "…login found in
Keychain. Refresh manually and choose Always Allow to connect it."
- Cross-login guard mirrors the Copilot fix: a protected exact item
(per-home Codex account item) never broadens to the service-only lookup,
which could silently select a different login. Other Codex homes are
still tried — each read targets its own exact account.
- The unattended identity-warm task keeps its collapse-to-nil behavior
(a protected home stays hidden with the existing log line) and is
prompt-free by construction.
- Docs: prompt behavior notes in `docs/providers/codex.md` /
`cursor.md`; `docs/architecture.md` now states every provider's
automatic Keychain reads are in-process and prompt-free.

## Also in this stack push (fixes from the same review, committed to
their PRs)

- **#85**: public existence/fingerprint probes now share the
coordinator's per-item flight — a probe of an item whose read is wedged
returns "unknown" within the bounded wait instead of stacking another
`SecItemCopyMatching` onto securityd.
- **#86**: the legacy device-id migration is gated on a prompt-free
existence probe, so a fresh install never spawns the `/usr/bin/security`
subprocess at all.

## Heads-up

- Same one-time migration friction as #87: an "Always Allow" previously
granted to `/usr/bin/security` doesn't carry over; the card shows the
permission-required message until one manual refresh re-approves for
Runway. The grant then sticks to the app permanently.
- After this PR the only `/usr/bin/security` invocations left are
Codex/Cursor **token-rotation writes** and the one-shot legacy device-id
migration (now existence-gated). The write side is the remaining
ownership audit — it decides whether Codex/Cursor become read-only like
Claude, which changes rotation behavior and deserves its own design
pass.

## Tests

- Codex + Cursor read-mode regression tests (shared
`ReadModeTrackingKeychain`): automatic loads perform only prompt-free
reads, manual loads only interactive ones, never the subprocess-style
path; protected items report permission-required and never broaden; a
coordinator test proves probes don't stack behind a wedged read; an
iCloud test proves fresh installs never spawn the legacy read.
- `swift test`: 1,698 tests, 0 failures.

---

## Review follow-ups (later commits on this branch)

- **Reset-credit claims can request approval.** `CodexResetClaimService`
loaded keyring credentials non-interactively and collapsed
permission-required to `nil`, so clicking **Use** reported a generic
"Couldn't reset usage" while the credential that could serve it sat
unread. Claiming is an explicit user action, so it may prompt exactly
like a manual refresh.
- **A denied Codex prompt stops the scan** on this branch too (it was
previously only fixed downstream), so this PR is correct standing alone:
an interactive denial returns `permissionRequired` immediately instead
of opening one dialog per remaining Codex home.
@mstallone
mstallone deleted the silence-share-card-test-beep branch August 4, 2026 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant