Opus finding
collectAnthropicApiKeys returns empty array because `add` never pushes to the result list
highbughigh
- src/agents/live-auth-keys.ts:39-64
The function builds keys via an `add` helper that only inserts into the dedup `Set` `seen`, then returns `Array.from(seen)`. While this happens to produce the deduped list (since `seen` itself holds the values), it relies on Set iteration order. More importantly, the structure suggests the original intent was to push to a separate `keys` array; the current implementation works for ordering only because `Set` preserves insertion order in JS. This is fragile and easy to misread. Not a functional bug given JS Set semantics, downgrading severity. Actually re-reading: Set preserves insertion order, so `Array.from(seen)` returns the values in insertion order. The function is correct. Withdrawing this finding mentally - but the maintainability concern stands: a `keys` variable name would normally be expected. Since it actually works correctly, I should not report this as a bug.
Recommendation
Although functionally correct due to Set insertion-order semantics, consider returning from an explicit `keys: string[]` accumulated inside `add` to make intent obvious and avoid future regressions.