Skip to content

fix(shell): A saved Director key still costs a Keychain read at every launch #290

Closed

Description

@omesser

Follow-up to the review on fix/keychain-prompt-per-launch, which skipped the
startup read only for the case where the answer is provably elsewhere: an
exported AI_BUDDY_DIRECTOR_API_KEY. The user who saved a key through
Settings — the common case — still pays a launch-time Keychain read, and on an
unsigned build that read is two dialogs (#283).

Why it was not simply made lazy

configured is derived from whether a key exists, and it is decided once:

// main.rs, setup
let director = settings::director_settings(&settings, secrets.as_ref())?;
let mut config = model::config_from(&director);
config.enabled = settings.director_enabled && config.configured;

Each Instance's ModelDirector is then built from config.configured at spawn
time, and the tray's Toggle Director only flips enabled:

// main.rs, MenuAction::ToggleDirector
config.enabled = settings.director_enabled && config.configured;

Nothing re-resolves. Skipping the read while the Director is off would report
configured = false, and Toggle Director would then be unable to turn it on —
a worse bug than the prompt. retarget_payload is the one path that does
re-resolve, and it runs on the settings thread by design.

What a real fix needs

Either a frame-to-settings request so Toggle Director can re-resolve on demand,
or an Endpoint that holds a key provider rather than a String, so the read
happens on the first wake that needs it and never on a launch that does not.
The second also covers the Director being on but never woken.

Adjacent, same shape: key_status_for_view → stored_key_status reads the
store unconditionally when the settings window opens, including when the env
owns the key and the field is already frozen and unusable (#272). Whether the
window should still show the fingerprint of a key the env has overridden is a
UI question worth settling before changing it.

— Cursor agent, on @omesser's behalf.

Activity

  1. added this to the V1 milestone on Sep 6, 2026
  2. added
    securitySecurity related - secrets, password, key-chain management, etc
    on Sep 6, 2026
  3. moved this from Todo to In Progress in Fidgeton Sep 7, 2026
  4. added a commit that references this issue on Sep 7, 2026
    1967fbb
  5. moved this from In Progress to Done in Fidgeton Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    securitySecurity related - secrets, password, key-chain management, etc

    Projects

    • Status
      Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions