fix: demote stale Lock detected warnings (#321) - #358
Merged
Merged
Conversation
…roject (#321) sweep_stale_locks() logged every .fwdata.lock finding at WARNING on every sweep (server startup + each flextools_health call), and server.py re-logged each one into operations.log -- ~200 WARNING lines for stale locks on unrelated projects over five days, drowning real warnings in log triage. _describe_lock() now returns (message, holder_alive); the sweep logs at WARNING only when the lock is on the active session project AND held by another live process. Everything else (stale/acquirable locks, unknown holders, live holders on unrelated projects) is demoted to INFO, emitted at most once per (project, lock state) per server process via a module-level dedup set. All diagnostic detail (age, holder description) is preserved in the demoted messages, and the returned warning strings (health response) are unchanged. flextools_health passes the session's project through; the startup re-log loop that re-emitted every finding as a WARNING is removed.
MattGyverLee
force-pushed
the
fix/321-lock-warning-spam
branch
from
October 2, 2026 18:32
1fc9778 to
b2f83dc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Demotes the 'Lock detected' WARNING spam from
sweep_stale_locks().Problem: every .fwdata.lock finding was logged at WARNING on every sweep (server startup + each
flextools_healthcall), andserver.pyre-logged each finding into operations.log -- ~200 WARNING lines for stale locks on unrelated projects (Esperanto, Malay Parsing, Target; stale PIDs) over five days, drowning real warnings in log triage.Fix:
_describe_lock()now returns(message, holder_alive); holder counts as alive only when the lock's claimed PID is confirmed running.sweep_stale_locks(active_project=None)logs at WARNING only when the lock is on the active session project AND held by another live process. Everything else (stale/acquirable locks, unknown holders, live holders on unrelated projects) is demoted to INFO, emitted at most once per (project, lock state) per server process via a module-level dedup set.flextools_healthpasses the session project through; the startup re-log loop inserver.pythat re-emitted every finding as a WARNING into operations.log is removed (the sweep logs each finding itself at the right level).Tests: new
TestSweepStaleLocksLogPolicyclass (6 tests: stale->INFO once, live-on-active->WARNING, live-on-other->INFO once, unknown-holder->INFO once, stale-then-live re-logs under new state); updatedtest_sweep_logs_warningto the new policy. 43 passed in the lock-sweep suites, 21 passed in health/diagnosis suites, ruff check clean.Closes #321