Skip to content

fix: pause points now flag likely JIT-inlined methods and show capture timing - #1878

Merged
hatayama merged 4 commits into
feature/pause-point-feedback-round3-integrationfrom
feat/pause-point-inlining-and-preline
Jul 20, 2026
Merged

hatayama merged 4 commits into
feature/pause-point-feedback-round3-integrationfrom
feat/pause-point-inlining-and-preline

Conversation

@hatayama

@hatayama hatayama commented Jul 20, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Pause points now warn you at enable time when the target method is small enough (or marked AggressiveInlining) that Mono's JIT may inline it away, instead of only leaving you to guess after a confusing HitCount=0 timeout.
  • The same JIT-inlining possibility is now called out directly in the await-pause-point timeout hint text.
  • enable-pause-point responses for file:line markers now carry an explicit SnapshotTiming note stating that captured variables reflect state before the resolved line executes (pre-line, like an IDE breakpoint), so this is discoverable from the response itself rather than only from docs.

User Impact

  • Before: a pause point on a small/inlined method could silently never fire, and nothing in the response or timeout message pointed at JIT inlining as the cause — users had to already know about the possibility to suspect it.
  • After: enable-pause-point proactively warns when a target method looks inlining-prone, and the await-pause-point timeout hint mentions it too, so the diagnosis is much faster.
  • Before: the pre-line timing of captured variables was documented only in the skill file, easy to miss.
  • After: every file:line enable-pause-point response includes a SnapshotTiming field stating this directly.

Changes

  • SourcePausePointPatcher.BuildPatchWarning gains a new check (IsLikelyJitInlined): true if the method has [MethodImpl(MethodImplOptions.AggressiveInlining)], or if its IL body size is at or under a new heuristic threshold constant (SourcePausePointConstants.SmallMethodInliningRiskThresholdBytes, 32 bytes). New warning message constant SmallMethodInliningRiskWarning.
  • pausePointTimeoutHint (Go, pause_point_errors.go) appends a sentence pointing at JIT inlining in the HitCount==0 && Enabled branch.
  • PausePointResponse gains an additive SnapshotTiming field (new constant PreLineSnapshotTimingNote), populated only when a pause point is enabled via file:line (EnableBySourceLocation); id-only markers leave it empty since they have no resolved source line. This is a wire-compatible additive change, so no IPC protocolVersion bump is needed.
  • Existing physical-callback-warning tests (OnCollisionEnter2D/Update/OnTriggerEnter2D fixtures) are loosened from exact-match to Contains/Does.Not.Contain, since those fixture bodies are also small enough to independently trigger the new inlining warning. New tests cover below-threshold, above-threshold, and AggressiveInlining-regardless-of-size cases, plus the two-warning joined-string ordering.

Verification

  • dist/darwin-arm64/uloop compile: 0 errors, 0 warnings (checked after each commit).
  • dist/darwin-arm64/uloop run-tests (EditMode, filter SourcePausePointPatcherTests): 25/25 passed.
  • dist/darwin-arm64/uloop run-tests (EditMode, filter PausePointTests): 68/68 passed.
  • scripts/check-go-cli.sh: all packages ok, 0 lint issues.
  • Manual: enabled a real file:line pause point via uloop enable-pause-point against the running Unity Editor and confirmed both the SnapshotTiming field and the inlining warning appear correctly in the JSON response, then cleared it.
  • This PR targets the integration branch feature/pause-point-feedback-round3-integration, not main/v3-beta. Repo CI workflows filter pull_request.branches to [main, v3-beta], so no repository CI runs on this PR — that's expected, not a gap. The checks above are local-equivalent verification; full repo CI will run on the final integration → v3-beta PR.

Review in cubic

hatayama added 3 commits July 21, 2026 00:27
Mono can inline very small target methods into their callers, making a
source pause point never fire even though the target line runs. Extend
pausePointTimeoutHint's HitCount=0 branch with a hint pointing users at
this cause so they can move the pause point into the calling method.
Small method bodies (or ones marked AggressiveInlining) can be inlined
by Mono's JIT into their callers, silently defeating a source pause
point even though the target line executes. Detect this at patch time
via IL body size (heuristic threshold) and the AggressiveInlining
implementation flag, and surface a warning through BuildPatchWarning
so the risk is visible before a confusing HitCount=0 timeout.

Existing physical-callback-warning tests are loosened from exact-match
to Contains/Does-Not-Contain since their fixture methods are also small
enough to independently trigger the new inlining warning. New tests
cover the below-threshold, above-threshold, and AggressiveInlining
cases plus the joined dual-warning ordering.
Users have observed captured values that look like they belong to the
line after ResolvedLine, since a source pause point's capture happens
before the resolved line executes (like an IDE breakpoint). Add a
SnapshotTiming field to PausePointResponse, set for file:line markers
only, making this timing explicit in the response instead of leaving
it documented only in the skill. Additive-only response field, so no
protocol version bump is needed.
@coderabbitai

coderabbitai Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5e916133-cf55-468d-9a42-4d85b7d045ed

📥 Commits

Reviewing files that changed from the base of the PR and between 3238714 and e2c4fc9.

📒 Files selected for processing (1)
  • Packages/src/Editor/FirstPartyTools/PausePoint/SourcePausePointPatcher.cs
🚧 Files skipped from review as they are similar to previous changes (1)
  • Packages/src/Editor/FirstPartyTools/PausePoint/SourcePausePointPatcher.cs

📝 Walkthrough

Walkthrough

Pause point responses now expose source snapshot timing for resolved locations. Source patching adds warnings for methods likely to be JIT-inlined, with tests for IL size, explicit inlining, combined warnings, fixtures, and CLI timeout guidance.

Changes

Pause point timing and inlining diagnostics

Layer / File(s) Summary
Source snapshot timing response
Packages/src/Editor/FirstPartyTools/PausePoint/*, Assets/Tests/Editor/PausePointTests.cs
PausePointResponse reports pre-line snapshot timing for resolved source locations, while id-only markers leave the field empty.
JIT inlining warning heuristic
Packages/src/Editor/FirstPartyTools/PausePoint/SourcePausePoint*.cs, Assets/Tests/Editor/SourcePausePointPatcher/*
Patch warnings detect AggressiveInlining methods and methods at or below the 32-byte IL threshold; tests cover small, large, explicitly inlined, and combined-warning cases.
Timeout hint guidance
cli/project-runner/internal/projectrunner/pause_point_errors.go, cli/project-runner/internal/projectrunner/pause_point_wait_test.go
Timeout diagnostics include guidance about very small methods being inlined by Mono’s JIT.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 26.32% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: JIT-inlining warnings and capture timing in pause points.
Description check ✅ Passed The description is directly related to the changeset and accurately describes the new warnings, timing field, and tests.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/pause-point-inlining-and-preline

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Nothing outside BuildPatchWarning (same class) references this helper
and no test calls it directly, so internal was unnecessarily broad.
@hatayama
hatayama merged commit dff3890 into feature/pause-point-feedback-round3-integration Jul 20, 2026
2 checks passed
@hatayama
hatayama deleted the feat/pause-point-inlining-and-preline branch July 20, 2026 15:40
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