Reported
Confirmed during v0.9.89 OpenAI provider testing. When the API-key entry modal appears (e.g., right-click → Intelligence → ChatGPT-5.2 → modal prompt), pasting (Cmd+V) an API key only inserts characters up to the first dash. The rest of the key is silently dropped.
The same key pastes fine into the text field in Settings → Intelligence (where keys are managed long-term).
Repro
- Copy an API key that contains a dash (any modern OpenAI/Anthropic key, e.g.
sk-proj-abc123...)
- Right-click the duck status bar icon → Intelligence → ChatGPT-5.2 (or any provider without a key)
- Modal appears asking for the key, with a text field
- Cmd+V to paste
- Observe only
sk (or up to whatever's before the first dash) appears
Suspected cause
The modal is built in DuckConfig.ensureKey() (widget/Sources/RubberDuckWidget/DuckConfig.swift:236) using NSAlert with an NSTextField accessory view. Likely a paste-via-services / responder-chain quirk specific to NSAlert accessory text fields — the field may not be wired to the standard Edit menu paste action, or some other input handling is intercepting the dash character.
The Preferences pane uses SwiftUI's SecureField / TextField which routes paste through the SwiftUI text system and works correctly.
Possible fixes to investigate
- Replace the modal's
NSTextField with an explicit first-responder + Edit menu wiring
- Switch the modal to a small SwiftUI sheet instead of an NSAlert with accessory view
- Test whether
NSSecureTextField (which we should probably be using for API keys anyway) has the same bug
Workaround
Skip the modal: open Settings → Intelligence pane and paste the key there directly. The provider auto-switches once the key is saved.
Reported
Confirmed during v0.9.89 OpenAI provider testing. When the API-key entry modal appears (e.g., right-click → Intelligence → ChatGPT-5.2 → modal prompt), pasting (Cmd+V) an API key only inserts characters up to the first dash. The rest of the key is silently dropped.
The same key pastes fine into the text field in Settings → Intelligence (where keys are managed long-term).
Repro
sk-proj-abc123...)sk(or up to whatever's before the first dash) appearsSuspected cause
The modal is built in
DuckConfig.ensureKey()(widget/Sources/RubberDuckWidget/DuckConfig.swift:236) usingNSAlertwith anNSTextFieldaccessory view. Likely a paste-via-services / responder-chain quirk specific to NSAlert accessory text fields — the field may not be wired to the standard Edit menu paste action, or some other input handling is intercepting the dash character.The Preferences pane uses SwiftUI's
SecureField/TextFieldwhich routes paste through the SwiftUI text system and works correctly.Possible fixes to investigate
NSTextFieldwith an explicit first-responder + Edit menu wiringNSSecureTextField(which we should probably be using for API keys anyway) has the same bugWorkaround
Skip the modal: open Settings → Intelligence pane and paste the key there directly. The provider auto-switches once the key is saved.