feat: Expose raw captured pause point variables while Unity is paused#1717
Conversation
Share demangled capture frames between the formatter and a latest-hit-only raw holder, and add TryGetCapturedValue for execute-dynamic-code inspection. Resume clearing uses pauseStateChanged with delayCall so Step keeps refs. Co-authored-by: Cursor <cursoragent@cursor.com>
📝 WalkthroughWalkthroughThe change adds editor-only raw captured-variable frames, collects and formats captured values separately, stores the latest frame through pause-point hits, exposes retrieval APIs, clears data with lifecycle changes, and adds coverage for latest-hit behavior. ChangesRaw captured-variable flow
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant SourcePausePointCapture
participant SourcePausePointVariableCollector
participant SourcePausePointVariableFormatter
participant UloopPausePointRegistry
participant UloopPausePointRawCaptureHolder
SourcePausePointCapture->>SourcePausePointVariableCollector: Collect frame
SourcePausePointCapture->>SourcePausePointVariableFormatter: FormatFrame(frame)
SourcePausePointCapture->>UloopPausePointRegistry: HitWithCapturedFrame(...)
UloopPausePointRegistry->>UloopPausePointRawCaptureHolder: Store latest frame
UloopPausePointRawCaptureHolder-->>UloopPausePointRegistry: Expose latest raw values
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Use FormatFrame and HitWithCapturedFrame for the new paths, and only clear raw captures when Clear targets the latest hit snapshot id. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@Packages/src/Runtime/PausePoints/UloopPausePointRegistry.cs`:
- Around line 202-206: Update the capturedFrame handling in HitCore so
null-frame hits explicitly clear UloopPausePointRawCaptureHolder instead of
retaining the previous snapshot; preserve storing capturedFrame with the current
id when it is non-null, keeping GetCapturedPausePointId() and live inspection
aligned with _latestHitSnapshot.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: c876925b-420f-45be-b0e9-6106b27fc757
⛔ Files ignored due to path filters (5)
Packages/src/Editor/FirstPartyTools/PausePoint/SourcePausePointVariableCollector.cs.metais excluded by none and included by nonePackages/src/Runtime/PausePoints/UloopPausePointCapturedVariableEntry.cs.metais excluded by none and included by nonePackages/src/Runtime/PausePoints/UloopPausePointCapturedVariableFrame.cs.metais excluded by none and included by nonePackages/src/Runtime/PausePoints/UloopPausePointRawCaptureHolder.cs.metais excluded by none and included by nonePackages/src/Runtime/PausePoints/UloopPausePointRawCaptureLifecycle.cs.metais excluded by none and included by none
📒 Files selected for processing (10)
Assets/Tests/Editor/PausePointTests.csPackages/src/Editor/FirstPartyTools/PausePoint/SourcePausePointCapture.csPackages/src/Editor/FirstPartyTools/PausePoint/SourcePausePointVariableCollector.csPackages/src/Editor/FirstPartyTools/PausePoint/SourcePausePointVariableFormatter.csPackages/src/Runtime/PausePoints/UloopPausePoint.csPackages/src/Runtime/PausePoints/UloopPausePointCapturedVariableEntry.csPackages/src/Runtime/PausePoints/UloopPausePointCapturedVariableFrame.csPackages/src/Runtime/PausePoints/UloopPausePointRawCaptureHolder.csPackages/src/Runtime/PausePoints/UloopPausePointRawCaptureLifecycle.csPackages/src/Runtime/PausePoints/UloopPausePointRegistry.cs
| if (capturedFrame != null) | ||
| { | ||
| UloopPausePointRawCaptureHolder.Store(capturedFrame, id); | ||
| } | ||
|
|
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Locate the relevant registry and raw capture holder usage
git ls-files | rg 'Packages/src/Runtime/PausePoints/UloopPausePointRegistry\.cs|UloopPausePointRawCaptureHolder|execute-dynamic-code|PausePoint'
echo '--- UloopPausePointRegistry.cs (outline) ---'
ast-grep outline Packages/src/Runtime/PausePoints/UloopPausePointRegistry.cs --view expanded || true
echo '--- Raw capture holder references ---'
rg -n "UloopPausePointRawCaptureHolder|GetCapturedPausePointId|_latestHitSnapshot|capturedFrame != null|Clear\(" Packages/src -S
echo '--- Related pause-point code slices ---'
sed -n '150,260p' Packages/src/Runtime/PausePoints/UloopPausePointRegistry.cs
printf '\n---\n'
sed -n '1,220p' "$(git ls-files | rg 'UloopPausePointRawCaptureHolder\.cs$')"Repository: hatayama/unity-cli-loop
Length of output: 46622
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo '--- Hit API surface ---'
sed -n '110,190p' Packages/src/Runtime/PausePoints/UloopPausePointRegistry.cs
printf '\n--- Raw capture lifecycle ---\n'
sed -n '1,160p' Packages/src/Runtime/PausePoints/UloopPausePointRawCaptureLifecycle.cs
printf '\n--- UloopPausePoint.cs ---\n'
sed -n '1,120p' Packages/src/Runtime/PausePoints/UloopPausePoint.cs
printf '\n--- Execute-dynamic-code uses of captured pause-point id / names ---\n'
rg -n "GetCapturedPausePointId|TryGetCapturedValue|GetCapturedNames|RawCapture" Packages/src Assets -S
printf '\n--- Tests mentioning raw capture id ---\n'
rg -n "GetCapturedPausePointId|TryGetCapturedValue|GetCapturedNames|RawCapture" Assets/Tests Packages/src/Runtime/PausePoints -SRepository: hatayama/unity-cli-loop
Length of output: 18637
🏁 Script executed:
#!/bin/bash
set -euo pipefail
sed -n '470,590p' Assets/Tests/Editor/PausePointTests.csRepository: hatayama/unity-cli-loop
Length of output: 6460
Clear raw capture on null-frame hits
HitCore only stores raw capture when capturedFrame is present, so a marker-only hit or HitWithCapturedVariables can leave the previous live-object snapshot attached to the new latest hit. Clear the raw holder on null-frame hits so GetCapturedPausePointId() and live inspection stay aligned with _latestHitSnapshot.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@Packages/src/Runtime/PausePoints/UloopPausePointRegistry.cs` around lines 202
- 206, Update the capturedFrame handling in HitCore so null-frame hits
explicitly clear UloopPausePointRawCaptureHolder instead of retaining the
previous snapshot; preserve storing capturedFrame with the current id when it is
non-null, keeping GetCapturedPausePointId() and live inspection aligned with
_latestHitSnapshot.
Refs: 2026-07-12_uloop検証フィードバック改善 実装計画.md#PR 2-3 (B-2 案2)
Summary
UloopPausePoint.TryGetCapturedValuereturns(bool Found, object Value);GetCapturedNames()andGetCapturedPausePointId()expose snapshot metadata.pauseStateChanged+delayCallre-check so PlayMode Step does not drop refs mid-inspection.User Impact
Found=false).Design (Fable 5 conditional LGTM)
_latestHitSnapshot)TryGetCapturedValueavoids null ambiguityUloopPausePointCapturedVariableFrameconsumed by Collector + Formatter + HolderProtocol
Verification
uloop compile0 errors / 0 warningsPausePointTests+SourcePausePointVariableFormatterTests72 passedReal-device evidence
Pause中に raw 参照を読める
resume 後は Found=false
Step 干渉検証 (PlayMode paused)
Made with Cursor