.claude/skills/review-race-conditions-open/SKILL.md
Open Audit for race conditions in timers, hotkeys, callbacks, and shared state
npx skillsauth add cwilliams5/Alt-Tabby review-race-conditions-openInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Enter planning mode. Systematically audit the codebase for race conditions. Use maximum parallelism — spawn explore agents for independent areas.
AHK v2 is single-threaded but not atomic — timers, hotkeys, and callbacks CAN interrupt each other mid-execution. Critical "On" prevents interruption for the current thread. This is the only synchronization primitive available. See .claude/rules/ahk-patterns.md (Race Conditions section) and .claude/rules/keyboard-hooks.md for established patterns.
These have been deliberately designed and tested — flagging them wastes time:
Critical "On" held through the entire GUI_OnInterceptorEvent handler including rendering (~16ms). This is intentional — releasing early causes corruption.SendMode("Event") instead of SendInput — prevents hook uninstall during sends.gGUI_EventBuffer — events buffered while gGUI_Pending.phase != "".ALT_DN + ALT_UP without TAB).FR_Record() — pre-allocated ring buffer, writes are inherently safe._GUI_LogError() — always-on by design.After explore agents report back, validate every finding yourself. Race conditions are easy to hypothesize and hard to confirm. Many "races" identified by exploration are actually guarded by Critical sections or by AHK's threading model (only one pseudo-thread runs at a time; interruption only happens at specific yield points).
For each candidate:
file.ahk lines X–Y" with actual code quoted. Vague line references are not sufficient.Group by severity (data corruption > logic error > cosmetic):
| File | Lines | Race Description | Interrupt Source | Severity | Fix |
|------|-------|-----------------|-----------------|----------|-----|
| file.ahk | 42–58 | gFoo read-then-write without Critical | Timer _HeartbeatTick | Data corruption | Wrap in Critical "On" / Critical "Off" |
For each fix, note:
Ignore any existing plans — create a fresh one.
tools
Create a new git worktree and switch the session into it
tools
Spawn agent to trace code flow via query tools — answer only, no context cost
tools
Commit, push, and create a PR for the current branch
tools
Retire a shader by moving its files to legacy/shaders_retired