Skip to content

fix(gateway): treat OSError from scoped-lock PID probe as stale#11156

Open
Yiyufadacai wants to merge 2 commits into
NousResearch:mainfrom
Yiyufadacai:fix/gateway-scoped-lock-oserror-probe
Open

fix(gateway): treat OSError from scoped-lock PID probe as stale#11156
Yiyufadacai wants to merge 2 commits into
NousResearch:mainfrom
Yiyufadacai:fix/gateway-scoped-lock-oserror-probe

Conversation

@Yiyufadacai

Copy link
Copy Markdown

Summary

  • acquire_scoped_lock: when probing an existing lock owner via os.kill(pid, 0), also treat OSError as a stale/unusable lock (same recovery path as ProcessLookupError / PermissionError). Some Windows and POSIX edge cases surface non-lookup failures as OSError.
  • Add regression test test_acquire_scoped_lock_replaces_stale_when_kill_raises_oserror.

Test plan

  • pytest tests/gateway/test_status.py::TestScopedLocks -q -o addopts=

Notes

  • Scoped-token lock path only; orthogonal to get_running_pid() OSError handling discussed elsewhere.

Extend acquire_scoped_lock existence check to catch OSError from os.kill(pid, 0) on hosts where signal 0 fails with errno-style errors. Add regression test mirroring stale-lock recovery for ProcessLookupError.

Made-with: Cursor

@RuckVibeCodes RuckVibeCodes left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[gus-first-pass] Scoped lock handling should ensure reliability under various scenarios. Inline suggestions provided for correction.

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery labels Apr 25, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Likely duplicate of #11214 — that PR bundles the same scoped-lock OSError fix along with other edge-case regressions. Also related to #5762 and #13198.

…scoped-lock-oserror-probe

# Conflicts:
#	gateway/status.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants