Skip to content

fix(server): serialize shared device operations - #527

Merged
yltx merged 1 commit into
OpenWSGR:mainfrom
yltx:fix/server-device-operation-lease
Aug 4, 2026
Merged

fix(server): serialize shared device operations#527
yltx merged 1 commit into
OpenWSGR:mainfrom
yltx:fix/server-device-operation-lease

Conversation

@yltx

@yltx yltx commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a token-owned, non-blocking lease for the shared emulator
  • reserve the device before task worker startup and release it only after the worker exits
  • serialize all direct UI-driving routes, including acquisition OCR and expedition auto-check
  • keep task stop, status, health, and cached context reads available while the device is busy
  • prevent system startup or context teardown from racing active device work

Busy operations return HTTP 409 instead of waiting. expedition_auto_check no longer performs expedition/reward navigation concurrently with a combat task.

Verification

  • uv run --frozen pytest testing/server -q (40 passed)
  • uv run --frozen pytest -n auto --cov=autowsgr --cov-report=xml --cov-report=term-missing --junitxml=junit.xml (581 passed)
  • uv run --frozen pre-commit run ruff-check --all-filesn- uv run --frozen pre-commit run ruff-format --all-filesn- uv run --frozen pre-commit run codespell --all-files`n
    The lease implementation itself has 100% local line coverage. Full pre-commit --all-files remains subject to the repository's known Windows symlink checkout artifact; Ubuntu CI is authoritative for the complete hook suite.

Copilot AI review requested due to automatic review settings August 3, 2026 16:05

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@yltx

yltx commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

Coverage verification

Codecov did not create a codecov/patch check for this PR, even after the same head SHA was uploaded twice successfully by the Pytest workflow. Both uploads reported Upload queued for processing complete; GitHub has received no Codecov check or status for �d8af909700fb52efaa84d9f7d4c2c60f069cc20.

This is an absent external result, not a failed coverage result. I verified the same patch locally against origin/main using the CI-generated coverage.xml:

` ext
uvx diff-cover coverage.xml --compare-branch origin/main --fail-under=53.17

Total: 96 patch lines
Missing: 2 lines
Coverage: 97%
`

Per-file patch coverage:

  • �utowsgr/server/device_lease.py: 100%
  • �utowsgr/server/routes/game.py: 100%
  • �utowsgr/server/routes/ops.py: 90.9%
  • �utowsgr/server/routes/system.py: 100%
  • �utowsgr/server/routes/task.py: 93.3%
  • �utowsgr/server/task_manager.py: 100%

GitHub Lint and Pytest are both successful; the complete suite reports 581 passed. No Codecov threshold or repository configuration was weakened.

@yltx
yltx merged commit dffe038 into OpenWSGR:main Aug 4, 2026
3 checks passed
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.

2 participants