feat(secrets): make keyring open timeout configurable, default 30s#845
Conversation
Raise the keyring open/operation timeout from 10s to 30s and make it configurable via GOG_KEYRING_OPEN_TIMEOUT (Go duration), mirroring the existing GOG_KEYRING_LOCK_TIMEOUT. 10s is too short to satisfy an interactive macOS Keychain permission prompt (password entry plus "Always Allow"), so a legitimate prompt times out before it can be approved. 30s still bounds the indefinite hang the timeout was originally added to prevent. The timeout error now points at GOG_KEYRING_OPEN_TIMEOUT. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Codex review: needs maintainer review before merge. Reviewed June 19, 2026, 3:33 AM ET / 07:33 UTC. Summary Reproducibility: not applicable. this is a feature/default-change PR rather than a current-main bug report. The PR body does provide redacted live-output proof for the proposed timeout behavior. Review metrics: 2 noteworthy metrics.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the env-var support with explicit maintainer acceptance of the macOS-only 30s default, or keep the 10s default everywhere and let users opt into longer waits. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a feature/default-change PR rather than a current-main bug report. The PR body does provide redacted live-output proof for the proposed timeout behavior. Is this the best way to solve the issue? Unclear: the env-var implementation is narrow and matches the existing lock-timeout pattern, but the macOS 30s default is an operational policy choice. The safer compatibility alternative is env-var support with the existing 10s default. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against b35481eefd60. Label changesLabel justifications:
Evidence reviewedWhat I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
Landed with the maintainer policy adjustment:
|
Summary
The keyring open/operation timeout — added so an unresponsive backend can't hang
the CLI forever (#513, #221) — defaults to 10s. This raises that default to 30s
and makes it configurable via
GOG_KEYRING_OPEN_TIMEOUT(a Go duration),mirroring the existing
GOG_KEYRING_LOCK_TIMEOUT.GOG_KEYRING_OPEN_TIMEOUT=45s(any Go duration) overrides the timeout;empty/invalid/non-positive values fall back to the default.
GOG_KEYRING_OPEN_TIMEOUT.Why
On macOS this timeout bounds every Keychain read, including the wait for an
interactive permission prompt. 10s is usually enough to approve one — but it
leaves little margin for the normal frictions: not noticing the prompt for a few
seconds, fumbling and re-entering the login password, or macOS showing two
prompts back to back (client secret + token). When that margin runs out, a
legitimate prompt times out before it's approved and auth fails on a perfectly
healthy machine. 30s gives comfortable headroom for those cases while still
bounding the failure the timeout was created for — an indefinite hang
(commands hung until SIGKILL, #513), not a matter of seconds.
GOG_KEYRING_OPEN_TIMEOUTthen lets anyone tune it further, just likeGOG_KEYRING_LOCK_TIMEOUTalready does for the lock wait.If raising the default is contentious, the env var alone is still a worthwhile
addition (parity with the lock-timeout knob) — but I'd argue 30s should be the
default: 10s is too tight for the common interactive-Keychain path, and 30s still
firmly bounds the hang case.
Behavior proof
With the Keychain permission prompt left unanswered (so the read blocks until the
timeout fires), wall-clock time matches the configured timeout:
Testing
make fmt-check,make lint,make docs-checkclean.go test ./internal/secrets -run 'OpenTimeout|ParseKeyringOpenTimeout|TimeoutKeyring'—covers env parsing (valid/empty/invalid/non-positive), the
OpenOptionsFromLookupwiring, and that the timeout error names
GOG_KEYRING_OPEN_TIMEOUT.docs/spec.md.No
CHANGELOG.mdentry — left to the release/landing process per repo convention.