Bug from #441, already on main; relevant for tomorrow's first scans.
The bug
stage_cra_rules wrote the rules to compliance-cra-semgrep.<pid>.tmp and then renamed that file. Every scan in an agent shares the same PID. With SCAN_CONCURRENCY above 1:
Two scans write the same temp file.
One renames it away.
The other one's rename fails: could not stage the CRA rules: No such file or directory.
Since #441 there is no fallback anymore, so the SAST stage fails. The target gets no semgrep findings, its controls read Nicht bewertet, and the run shows "Statische Codeanalyse (Semgrep)" under Nicht ausgeführt.
It showed up in the local nightly (py-uv). A burst of targets, like the first Managed Git sync, triggers it reliably.
Fix
The temp name is unique per call (UUID). The final path stays the same; the rename is atomic and the content identical.
Checks
New test:concurrent_scans_all_get_the_rules stages the rules 32 times in parallel on a multi-threaded runtime. Against the old code it fails 3 out of 3 times with exactly the production error; with the fix it passes 3 out of 3.
fmt and clippy with the CI flags; agent lib tests pass.
**Bug from #441, already on main; relevant for tomorrow's first scans.**
## The bug
`stage_cra_rules` wrote the rules to `compliance-cra-semgrep.<pid>.tmp` and then renamed that file. Every scan in an agent shares the same PID. With `SCAN_CONCURRENCY` above 1:
1. Two scans write the same temp file.
2. One renames it away.
3. The other one's rename fails: `could not stage the CRA rules: No such file or directory`.
Since #441 there is no fallback anymore, so the **SAST stage fails**. The target gets no semgrep findings, its controls read *Nicht bewertet*, and the run shows "Statische Codeanalyse (Semgrep)" under *Nicht ausgeführt*.
It showed up in the local nightly (py-uv). A burst of targets, like the first Managed Git sync, triggers it reliably.
## Fix
The temp name is unique per call (UUID). The final path stays the same; the rename is atomic and the content identical.
## Checks
- **New test:** `concurrent_scans_all_get_the_rules` stages the rules 32 times in parallel on a multi-threaded runtime. Against the old code it fails **3 out of 3** times with exactly the production error; with the fix it passes 3 out of 3.
- fmt and clippy with the CI flags; agent lib tests pass.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
stage_cra_rules wrote its temp file under the process id, which every scan
in an agent shares. With SCAN_CONCURRENCY above one, two scans wrote the
same temp file and one renamed it away from under the other, whose rename
then failed with "No such file or directory". Since #441 that fails the
SAST stage (before, it fell back to the registry rules), so the target got
no semgrep findings and its controls read "Nicht bewertet". Seen in the
local nightly; a burst of new targets (a Managed Git sync) triggers it.
The temp name is now unique per call. A multi-threaded test stages the
rules 32 times at once; it fails on the old code every time.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Bug from #441, already on main; relevant for tomorrow's first scans.
The bug
stage_cra_ruleswrote the rules tocompliance-cra-semgrep.<pid>.tmpand then renamed that file. Every scan in an agent shares the same PID. WithSCAN_CONCURRENCYabove 1:could not stage the CRA rules: No such file or directory.Since #441 there is no fallback anymore, so the SAST stage fails. The target gets no semgrep findings, its controls read Nicht bewertet, and the run shows "Statische Codeanalyse (Semgrep)" under Nicht ausgeführt.
It showed up in the local nightly (py-uv). A burst of targets, like the first Managed Git sync, triggers it reliably.
Fix
The temp name is unique per call (UUID). The final path stays the same; the rename is atomic and the content identical.
Checks
concurrent_scans_all_get_the_rulesstages the rules 32 times in parallel on a multi-threaded runtime. Against the old code it fails 3 out of 3 times with exactly the production error; with the fix it passes 3 out of 3.🤖 Generated with Claude Code
https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p