Skip to content

test: serialize the frontend acceptance stand-in's shared state - #116

Closed
roodboi wants to merge 1 commit into
nextfrom
claude/hack-1211-acceptance-standin-lock
Closed

roodboi wants to merge 1 commit into
nextfrom
claude/hack-1211-acceptance-standin-lock

Conversation

@roodboi

@roodboi roodboi commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes a lost-update race in the native frontend acceptance controls' stand-in runtime (tests/python/test_native_frontend_acceptance.py, added by #99). It makes the Runtime state models job fail intermittently, as on #112 at ea0e0d07.

  • Cause: stand-in invocations run concurrently (a foreground up while the driver polls ps), and each did an unlocked read-modify-write of a shared state.json. A ps that loaded the state before the second up saved its foreground token then saved its stale copy over it. up saw its token gone and exited 0 before readiness ("up-second exited 0 before readiness"); lost call records also failed the positive acceptance test.
  • Fix: each invocation holds an exclusive flock across its read-modify-write and releases it only before its long waits (the foreground loop and the ps-hang fault). No assertion changes.

This is the same patch as commit 70c78f77 on #112, cherry-picked onto next so it can land independently of the socket work.

Verification

  • Unfixed: 26 of 40 local runs of the controls failed, 8 with the exact CI message; the rest were lost call records.
  • Fixed: 0 of 40 failed.
  • python3 -m unittest tests/python/test_native_frontend_acceptance.py passes on this branch; privacy ok.

Refs HACK-1211.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Stand-in invocations ran concurrently (a foreground `up` while the driver
polls `ps`) and each did an unlocked read-modify-write of state.json. A
`ps` that loaded the state before the second `up` saved its foreground
token then saved its stale copy over it, so `up` saw its token gone and
exited 0 before readiness; lost call records failed the acceptance test
as well. That failed 26 of 40 local runs, and Runtime state models on CI.

Each invocation now holds an exclusive flock across its read-modify-write
and releases it only before its long waits (the foreground loop and the
ps-hang fault). 40 of 40 local runs pass.
@linear-code

linear-code Bot commented Sep 30, 2026

Copy link
Copy Markdown

HACK-1211

@roodboi

roodboi commented Oct 1, 2026

Copy link
Copy Markdown
Contributor Author

This exact frontend acceptance stand-in patch is included in merged PR #112 (f00a6478). The file blob at this branch and #112 is identical (09329f82). Closing this duplicate PR as superseded; the qualified branch and all discussion remain preserved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant