AntFleet

Disagreement · 5a1afff9-openai-1

STATE_FILE updates and git commit occur without any file locking; concurrent runs can clobber state

mismatch
repo 6f7fc663·PR #33·reviewed 1 week ago

Primary finding

STATE_FILE updates and git commit occur without any file locking; concurrent runs can clobber state

highconcurrencymedium
  • scripts/postprocess-admanage-create.sh:113-117
  • scripts/postprocess-admanage-create.sh:192-196
  • scripts/postprocess-admanage-create.sh:225-230
Multiple instances of the script can run (e.g., triggered by separate queues). Without mutual exclusion, concurrent read-modify-write cycles via jq+mv can interleave, dropping one process’s updates. A concurrent git commit sequence can also race, causing non-fast-forward or lost commit content.

Recommendation

Use flock around all STATE_FILE and git operations, e.g., exec {fd}>"$STATE_FILE"; flock -x "$fd"; then perform jq update and commit. Alternatively, lock a dedicated lockfile in STATE_DIR. Also consider retrying commits on failure or using git rebase/merge with retries.

Counterpart finding

State write proceeds with empty $state_parent and silently no-ops, but success summary still claims success

mediumdata-losshigh
  • scripts/postprocess-admanage-create.sh:177-195
When state_parent is empty, the warning prints and a SKIPPED summary line is appended, BUT the code then still runs jq with --arg parent "" which silently no-ops (matches no campaign), and then ALSO appends a second summary line 'adset → ID (under '')' and increments adset_success. The user sees two summary lines for the same ad set (one SKIPPED, one success) which is confusing/misleading. The state-file no-op was even called out in the comment as the thing they're guarding against, yet they then still execute the no-op jq write.

Recommendation

When state_parent is empty, `continue` after recording the warning (after writing the result JSON and moving the input file) instead of falling through to the jq state write and the additional success summary. Alternatively guard the jq invocation with `if [ -n "$state_parent" ]`.

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 →