Skip to content

Windows UI lane: retry the permission suite's auth wipe while the stopped server releases auth.db - #14658

Merged
danielhanchen merged 2 commits into
mainfrom
fix/windows-lane-auth-rm
Oct 22, 2026
Merged

danielhanchen merged 2 commits into
mainfrom
fix/windows-lane-auth-rm

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

The Windows Unsloth UI CI "Chat UI Tests" job sometimes fails on lane extra even though every suite in it passed:

[banner] 2155 checks, 0 failed
rm: cannot remove 'D:\a\unsloth\unsloth/.studio-lane-extra/auth/auth.db': Device or resource busy
rm: cannot remove 'D:\a\unsloth\unsloth/.studio-lane-extra/auth/auth.db-shm': Device or resource busy
rm: cannot remove 'D:\a\unsloth\unsloth/.studio-lane-extra/auth/auth.db-wal': Device or resource busy
##[error]Windows UI lane extra failed (exit 1)

Seen on run 39669502772 and again on a staging replica of #14647 (a test-only change unrelated to the lane).

Cause

run-studio-ui-lane.sh (lane extra) stops its own server with kill plus a 2 second sleep, then calls run-studio-permission-browser.sh on the same UNSLOTH_STUDIO_HOME. That script wipes $studio_home/auth before booting a fresh server. On Windows the killed server can still hold auth.db open past the sleep, so the rm -rf fails and set -euo pipefail ends the lane with exit 1.

Change

  • The wipe is now wipe_auth, which retries rm -rf "$studio_home/auth" quietly once a second for up to 30 tries (STUDIO_AUTH_WIPE_TRIES), then makes one last attempt that shows rm's own error. If that attempt succeeds the wipe succeeds; if not, it prints an ::error:: naming the held directory and fails. A server that never exits still fails the lane, now with a message that says so.
  • The fix is in the step that needs the lock released rather than in the lane's stop(), so it covers any caller that hands this script a home whose server just went away.

Verification

tests/studio/test_permission_browser_auth_wipe.py (new, collected by the Backend CI studio shard) runs the script's own wipe_auth body in bash against an rm shim that reports "Device or resource busy" for its first calls:

  • held for 4 calls: wiped on the 5th, exit 0
  • released exactly on the final attempt (5 tries): wiped, exit 0
  • held throughout (5 tries): exits non-zero after 6 calls, with the still held open error and rm's message
  • no bare rm -rf "$studio_home/auth" remains outside the helper, and the wipe runs before unsloth studio boots

Sabotage: main's script fails all of them; a wipe_auth with the retry loop removed fails 2 of 3 of the original tests; the previous head of this PR (which returned 1 after a successful final attempt) fails the final-attempt test. test_ui_scripts_report_signals.py and test_windows_ui_lanes_are_isolated.py still pass.

Not proven here: the timing on a real Windows runner. This PR's own Windows UI CI run exercises the path; the failure is intermittent, so one green run is consistent with the fix rather than proof of it.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-22T12:08:02.930947Z cc6555c Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e3a0dca6e8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +31 to +32
rm -rf "$studio_home/auth"
return 1

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Honor success from the final wipe attempt

When Windows releases auth.db after the thresholded attempt but before the unredirected diagnostic rm, that final rm succeeds and removes the directory, yet the unconditional return 1 still fails the lane. This preserves a boundary-case false failure in the exact lock-release scenario the retry is intended to handle; return success when this final deletion succeeds and fail only if it also reports an error.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in cc6555c. The final attempt is now an if rm -rf ...: success returns 0, and only a failure prints the error and returns 1. Added test_a_release_on_the_final_attempt_is_a_success, where the directory is released exactly on the last call; it fails on the previous head and passes now.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: cc6555ce98

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit 588e1c4 into main Oct 22, 2026
@danielhanchen
danielhanchen deleted the fix/windows-lane-auth-rm branch October 22, 2026 12:09
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