feat: surface a possiblyStuck hint on get_test_job when no test callback fires for 30s+#32
Open
dehuaichendragonplus wants to merge 1 commit into
Conversation
…ack fires for 30s+ Unity's Test Runner only supports one active run at a time, engine-wide, and this package has no way to detect a run started by another tool/session/process against the same Editor -- a concurrent caller (or a stale leftover run) can silently occupy the engine with no exception, leaving run_tests/get_test_job reporting "running" forever with zero diagnostic signal. Root-caused via a live investigation in a real consumer project: a GC-of-the-TestRunnerApi-instance hypothesis was tested and rejected (rooting the instance in a static field made no difference), while a concurrent enter_play_mode call from a different actor was directly observed landing mid-run on two separate occasions, and the identical unmodified code/test succeeded immediately once the Editor returned to exclusive/idle use. Rather than reflect into Unity's private, version-fragile internal run-tracking singleton (TestJobDataHolder) to detect contention directly, this uses a simpler, more robust signal already owned by this package: track a lastActivityAt timestamp updated by every ICallbacks method (RunStarted/TestStarted/TestFinished), and if a "running" job's activity timestamp is stale by more than 30s, get_test_job now includes possiblyStuck=true plus a stuckHint explaining the likely cause and pointing at get_editor_state/get_console_logs for concurrent-activity signs. Verified: normal runs complete with no false positive (0.62s single test, no possiblyStuck flag); a simulated stale "running" job with an old lastActivityAt correctly surfaces possiblyStuck=true with the hint.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Why this change is needed
Unity's Test Runner only supports one active run at a time engine-wide, and this package has no way to see runs started by other tools/sessions/processes against the same Editor. A concurrent caller (or a stale leftover run) can silently occupy the engine with no exception, leaving
run_tests/get_test_jobreportingrunningforever with zero diagnostic signal -- callers have no way to tell a genuinely stuck run apart from one that's simply still executing.Change approach
get_test_jobnow flagspossiblyStuck: truewith astuckHintwhen a run still reported asrunninghas had noICallbacksactivity (RunStarted/TestStarted/TestFinished) for over 30 seconds.enter_play_modecall from a different actor was directly observed landing mid-run on two separate occasions, and the identical unmodified code/test succeeded immediately (0.62-0.72s) once the Editor returned to exclusive/idle use.TestJobDataHolder) to detect contention directly -- that's tightly coupled to Test Framework internals across versions. Instead this tracks alastActivityAttimestamp already owned by this package, updated by every callback.Benefits
runningstate into an actionable diagnostic signal callers can act on (e.g. retry, or investigate engine contention) instead of polling forever with no information.CHANGELOG.mdupdated so users understand the new field before they hit it.Test results
[Test]resultState: Passed, no falsepossiblyStuckrunningjob with alastActivityAtfar in the past directly into SessionStateget_test_jobcorrectly returnedpossiblyStuck: truewith the expected hint textCompatibility testing
get_test_jobresponse shape -- no behavior change for normal, fast-completing runs (verified above).Checklist
Funplay > MCP Serveropens and starts correctly (all calls went through the live running server).idea/or.DS_StoreCHANGELOG.mdwhen the change affects users