AntFleet

Disagreement · b7190c33-anthropic-6

saveAuthProfileStore called outside file lock in markAuthProfileGood fallback path

mismatch
repo 5149da9d·PR #2·reviewed 2 days ago

Primary finding

saveAuthProfileStore called outside file lock in markAuthProfileGood fallback path

mediumconcurrencyhigh
  • src/agents/auth-profiles/profiles.ts:90-110
When `updateAuthProfileStoreWithLock` returns null (e.g. updater returned false because the fresh store doesn't have the profile or provider mismatched), the function falls through to mutating the *caller's* `store` object and writing it back via `saveAuthProfileStore` without any file lock. This is a read-modify-write on the same file that the locked path is meant to protect, defeating the purpose of the lock and risking lost updates. Additionally, the in-memory `store` may be stale relative to disk, so the unlocked write can clobber concurrent changes.

Recommendation

Remove the unlocked fallback write; if the locked update returned null (no change), simply return. Or perform the fallback inside the same lock.

Counterpart finding

Provider comparison in markAuthProfileGood is case/format sensitive while other code normalizes provider IDs

lowmaintainabilitymedium
  • src/agents/auth-profiles/profiles.ts:100-105
  • src/agents/auth-profiles/profiles.ts:83-87
Elsewhere provider IDs are normalized before comparison. Here, direct string equality is used, which can fail when providers differ only by case/aliasing, preventing lastGood from being updated despite a matching provider.

Recommendation

Normalize both sides with normalizeProviderId when comparing provider values and consider using the normalized key when updating lastGood.

Why this didn't post

This finding didn't meet AntFleet's unanimous agreement threshold. Both frontier models review every PR independently; only findings they both flag with the same severity and category are posted to the PR. This one fell through.

read the methodology →