Repository navigation
feat: uloop cancel stops the tool the Editor is running, and the waiting CLI gets TOOL_CANCELLED #3303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
feat: uloop cancel stops the tool the Editor is running, and the waiting CLI gets TOOL_CANCELLED #3303
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
39187df
feat: Let a lease be cancelled explicitly from outside its request
hatayama 8916e6c
feat: Report a tool stopped by uloop cancel as its own error
hatayama 0a323f4
feat: Add the cancel-running-tool bridge command and the tool_cancell…
hatayama b2e4c08
feat: Add uloop cancel to the project runner
hatayama 7dbc5f3
feat: Point BUSY and status at uloop cancel and classify tool_cancelled
hatayama 64fcc42
Merge remote-tracking branch 'origin/main' into feat/uloop-cancel-run…
hatayama d9296df
docs: Add the uloop-cancel skill and point recovery guidance at it
hatayama 84eff44
ci: Raise the dead-code PublicCandidate ceiling for ToolCancelledErro…
hatayama ccea777
fix: Offer uloop cancel in BUSY only for a command that does not finish
hatayama 4710b9c
docs: Say uloop cancel releases any Editor pause, and pin it for a ma…
hatayama File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| --- | ||
| name: uloop-cancel | ||
| description: "Cancel the uloop command the Unity Editor for this project is running now. Use when BUSY keeps rejecting commands or your own command does not finish." | ||
| --- | ||
|
|
||
| # uloop cancel | ||
|
|
||
| Cancel the uloop command that holds the Editor's command slot, from another terminal or after the waiting command was given up on. | ||
|
|
||
| ## When to Use | ||
|
|
||
| - Every command is rejected with `UNITY_SERVER_BUSY` and the running command shows no sign of finishing. | ||
| - A command you started does not return, for example an `execute-dynamic-code` snippet that awaits something that never completes. | ||
|
|
||
| ## Usage | ||
|
|
||
| ```bash | ||
| uloop cancel | ||
| uloop cancel --project-path <path> | ||
| ``` | ||
|
|
||
| It takes no other options. It answers while Unity is busy and while a command blocks Unity's main thread. | ||
|
|
||
| ## Output | ||
|
|
||
| Returns JSON with: | ||
|
|
||
| - `Outcome`: what the cancel found | ||
| - `RunningToolName`, `RunningToolElapsedSeconds`: the command that held the slot; `null` for `NothingRunning` | ||
| - `Success`: `false` only for `NotCancellable` | ||
|
|
||
| | Outcome | Meaning | Exit code | | ||
| |---------|---------|-----------| | ||
| | `Cancelled` | The running command was asked to stop | 0 | | ||
| | `NothingRunning` | No command held the slot | 0 | | ||
| | `NotCancellable` | The running command cannot be cancelled and keeps running | 1 | | ||
|
|
||
| When Unity cannot be reached, the error goes to stderr, nothing goes to stdout, and it exits 1. A Unity package too old to support `uloop cancel` answers with a `UNITY_RPC_ERROR` naming the unknown command. | ||
|
|
||
| ## What Cannot Be Cancelled | ||
|
|
||
| `NotCancellable` covers only these: | ||
|
|
||
| - `compile` that waits for the domain reload (the default) | ||
| - `run-tests --test-mode PlayMode --respect-enter-play-mode-settings` | ||
| - a tool started by code inside the Editor (an extension or an Editor window), not by the CLI | ||
|
|
||
| A default EditMode `run-tests` and `compile --no-wait-for-domain-reload` can be cancelled. | ||
|
|
||
| ## What the Waiting Command Gets | ||
|
|
||
| - Most commands fail with `ErrorCode` `TOOL_CANCELLED` (not retryable). | ||
| - `execute-dynamic-code` returns its usual cancelled result: `Success: false` with "Execution was cancelled or timed out". | ||
|
|
||
| `Cancelled` also resumes Play Mode when the Editor is paused, whether a pause point or a manual pause holds it — the same as when the waiting CLI is killed. | ||
|
|
||
| ## After Cancelling | ||
|
|
||
| Run `uloop status` and wait for `Ready` before the next command. `Cancelled` means the command was asked to stop, not that it already stopped: | ||
|
|
||
| - A tool that ignores its cancellation token keeps the slot until it returns on its own. | ||
| - `execute-dynamic-code` returns at once and frees the slot, but a snippet that ignores `ct` keeps running in the background. | ||
| - While a command blocks Unity's main thread, `execute-dynamic-code` cannot return; its slot is freed about 5 seconds later, when another command arrives. |
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| --- | ||
| name: uloop-cancel | ||
| description: "Cancel the uloop command the Unity Editor for this project is running now. Use when BUSY keeps rejecting commands or your own command does not finish." | ||
| --- | ||
|
|
||
| # uloop cancel | ||
|
|
||
| Cancel the uloop command that holds the Editor's command slot, from another terminal or after the waiting command was given up on. | ||
|
|
||
| ## When to Use | ||
|
|
||
| - Every command is rejected with `UNITY_SERVER_BUSY` and the running command shows no sign of finishing. | ||
| - A command you started does not return, for example an `execute-dynamic-code` snippet that awaits something that never completes. | ||
|
|
||
| ## Usage | ||
|
|
||
| ```bash | ||
| uloop cancel | ||
| uloop cancel --project-path <path> | ||
| ``` | ||
|
|
||
| It takes no other options. It answers while Unity is busy and while a command blocks Unity's main thread. | ||
|
|
||
| ## Output | ||
|
|
||
| Returns JSON with: | ||
|
|
||
| - `Outcome`: what the cancel found | ||
| - `RunningToolName`, `RunningToolElapsedSeconds`: the command that held the slot; `null` for `NothingRunning` | ||
| - `Success`: `false` only for `NotCancellable` | ||
|
|
||
| | Outcome | Meaning | Exit code | | ||
| |---------|---------|-----------| | ||
| | `Cancelled` | The running command was asked to stop | 0 | | ||
| | `NothingRunning` | No command held the slot | 0 | | ||
| | `NotCancellable` | The running command cannot be cancelled and keeps running | 1 | | ||
|
|
||
| When Unity cannot be reached, the error goes to stderr, nothing goes to stdout, and it exits 1. A Unity package too old to support `uloop cancel` answers with a `UNITY_RPC_ERROR` naming the unknown command. | ||
|
|
||
| ## What Cannot Be Cancelled | ||
|
|
||
| `NotCancellable` covers only these: | ||
|
|
||
| - `compile` that waits for the domain reload (the default) | ||
| - `run-tests --test-mode PlayMode --respect-enter-play-mode-settings` | ||
| - a tool started by code inside the Editor (an extension or an Editor window), not by the CLI | ||
|
|
||
| A default EditMode `run-tests` and `compile --no-wait-for-domain-reload` can be cancelled. | ||
|
|
||
| ## What the Waiting Command Gets | ||
|
|
||
| - Most commands fail with `ErrorCode` `TOOL_CANCELLED` (not retryable). | ||
| - `execute-dynamic-code` returns its usual cancelled result: `Success: false` with "Execution was cancelled or timed out". | ||
|
|
||
| `Cancelled` also resumes Play Mode when the Editor is paused, whether a pause point or a manual pause holds it — the same as when the waiting CLI is killed. | ||
|
|
||
| ## After Cancelling | ||
|
|
||
| Run `uloop status` and wait for `Ready` before the next command. `Cancelled` means the command was asked to stop, not that it already stopped: | ||
|
|
||
| - A tool that ignores its cancellation token keeps the slot until it returns on its own. | ||
| - `execute-dynamic-code` returns at once and frees the slot, but a snippet that ignores `ct` keeps running in the background. | ||
| - While a command blocks Unity's main thread, `execute-dynamic-code` cannot return; its slot is freed about 5 seconds later, when another command arrives. |
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: hatayama/unity-cli-loop
Length of output: 3204
🏁 Script executed:
Repository: hatayama/unity-cli-loop
Length of output: 15921
Document why the limit is 38.
The workflow raises
--max-public-candidatesfrom 37 to 38. The dead-code guide requires the limit to match the measured count with no slack and requires a documented reason for increases. Add the reason for the retained candidate, or keep the limit at 37.🤖 Prompt for AI Agents