Skip to content

feat: Pause point waits now explain their evidence#1338

Merged
hatayama merged 3 commits into
v3-betafrom
feature/improve-pause-point
Jun 14, 2026
Merged

feat: Pause point waits now explain their evidence#1338
hatayama merged 3 commits into
v3-betafrom
feature/improve-pause-point

Conversation

@hatayama

@hatayama hatayama commented Jun 14, 2026

Copy link
Copy Markdown
Owner

Summary

  • Pause point waits now return an EvidenceSummary that groups Editor state, hit metadata, matching-log counts, truncation status, and warnings.
  • Agent-facing pause point skill copies now document the new evidence fields.

User Impact

  • Agents can tell whether a paused frame is clean single-hit evidence or whether repeated hits, duplicated logs, or truncated logs need inspection.
  • Play and pause state is now clearly labeled as EditorState, reducing confusion with marker state.

Changes

  • Replace top-level pause point play-state fields with EditorState on pause point responses.
  • Track pause point hit timestamps and sequence numbers.
  • Add matching-log summary data and warnings to wait-for-pause-point success and timeout evidence.
  • Bump the IPC protocol contract to match the response-shape change and refresh generated skills.

Verification

  • git diff --check
  • go test ./... under cli/
  • scripts/check-go-cli.sh
  • cli/dist/darwin-arm64/uloop compile --project-path <PROJECT_ROOT>
  • uloop run-tests --test-mode EditMode --filter-type regex --filter-value ".PausePointTests."
  • codex-review v3-beta

Review in cubic

hatayama added 2 commits June 15, 2026 00:32
Group editor state, hit metadata, and matching log counts so E2E checks can distinguish clean single-hit evidence from stale, truncated, or repeated evidence.

- Move pause point play state into EditorState with capture timing
- Track hit timestamps and sequence numbers for pause point hits
- Add EvidenceSummary to wait-for-pause-point results and bump the IPC protocol
Keep the checked-in Claude and Agents skill copies aligned with the updated pause point evidence contract so agents see EvidenceSummary and EditorState guidance.
@coderabbitai

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@hatayama, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 13 minutes and 9 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more credits in the billing tab to continue.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: def6096f-4ef0-4e86-b9e5-4811338cf30d

📥 Commits

Reviewing files that changed from the base of the PR and between d2e28fa and 1d691a4.

📒 Files selected for processing (4)
  • .agents/skills/uloop-wait-for-pause-point/SKILL.md
  • .claude/skills/uloop-wait-for-pause-point/SKILL.md
  • Packages/src/Editor/CliOnlyTools~/PausePoint/Skill/SKILL.md
  • cli/internal/cli/pause_point_logs.go
📝 Walkthrough

Walkthrough

The PR replaces flat IsPlaying/IsPaused fields on pause-point responses with a nested EditorState object (carrying CapturedAt context), adds per-hit sequence numbers and first/last hit timestamps throughout the C# runtime and DTO layers, introduces a structured EvidenceSummary in Go CLI output for both hit and timeout paths, bumps the IPC protocol version to 2, and updates all tests and SKILL.md documentation accordingly.

Changes

EditorState restructuring and evidence summary

Layer / File(s) Summary
Runtime domain types: EditorState snapshot and hit sequencing
Packages/src/Runtime/PausePoints/UloopPausePointRegistry.cs
Adds UloopPausePointEditorStateCapturedAt constants and UloopPausePointEditorStateSnapshot immutable type. Introduces _nextHitSequence counter; expands UloopPausePointSnapshot and UloopPausePointClearAllResult constructors with editorState and first/last hit metadata; updates UloopPausePointEntry.RecordHit and ToSnapshot to track hit sequences and compute editor-state capture context (PausePointHit vs Current).
C# DTOs: PausePointEditorState and response shape expansion
Packages/src/Editor/Infrastructure/Api/PausePointStatusBridgeCommand.cs, Packages/src/Editor/FirstPartyTools/PausePoint/PausePointTools.cs
Adds PausePointStatusEditorState with FromSnapshot mapper; extends PausePointStatusResponse with EditorState, first/last hit UTC timestamps, and sequence numbers. Removes flat IsPlaying/IsPaused from PausePointResponse, adds nested PausePointEditorState and hit timestamp/sequence fields; updates FromSnapshot/FromClearAll mappers.
Go CLI JSON contract, EvidenceSummary, and error hints
cli/internal/cli/pause_point_wait.go, cli/internal/cli/pause_point_logs.go, cli/internal/cli/pause_point_errors.go, cli/contract.json, Packages/src/Editor/Domain/CliConstants.cs
Restructures pausePointStatusResponse to nest editor state in pausePointEditorState (with CapturedAt). Introduces pausePointEvidenceSummary, pausePointMatchingLogsResult, and evidence-building helpers; changes hit and timeout paths to embed EvidenceSummary. Updates hint functions to use response.EditorState; replaces isPlaying/isPaused detail entries with editorState. Bumps protocolVersion and REQUIRED_CLI_PROTOCOL_VERSION to 2.
C# unit tests: EditorState and CapturedAt assertions
Assets/Tests/Editor/PausePointTests.cs
Adds assertions for snapshot.EditorState.IsPaused, EditorState.CapturedAt values (PausePointHit, Current, ClearAll), and ClearAll response EditorState fields across hit, timing, enable, and status-bridge test cases.
Go tests: EditorState shape, EvidenceSummary, and error envelope updates
cli/internal/cli/pause_point_wait_test.go
Updates all mocked status responses to supply nested EditorState; asserts editorState in error envelopes (replacing flat isPlaying/isPaused checks). Validates EvidenceSummary fields for hit/timeout/log-failure cases, Warning content, and MatchingLogs structure; updates expired/timeout/paused diagnosis-hint test cases.
Skill documentation updates
.agents/skills/uloop-wait-for-pause-point/SKILL.md, .claude/skills/uloop-wait-for-pause-point/SKILL.md, Packages/src/Editor/CliOnlyTools~/PausePoint/Skill/SKILL.md
Rewrites Quick Check Template to prioritize EvidenceSummary and EditorState interpretation, adds PAUSE_POINT_EXPIRED recovery steps, and expands timeout checklist with elapsedSinceEnabledMilliseconds, remainingMilliseconds, MatchingLogs, and EvidenceSummary field references across all three SKILL.md copies.

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant pausePointWait as pausePointWait (Go CLI)
  participant Unity as Unity IPC
  participant fetchLogs as fetchMatchingLogsFromUnity
  participant buildEvidence as buildPausePointEvidenceSummary

  Caller->>pausePointWait: wait-for-pause-point
  loop Poll until hit or timeout
    pausePointWait->>Unity: status request
    Unity-->>pausePointWait: pausePointStatusResponse{EditorState{IsPlaying, IsPaused, CapturedAt}, FirstHitAtUtc, LastHitAtUtc, FirstHitSequence, LastHitSequence}
  end

  pausePointWait->>fetchLogs: fetchMatchingLogsFromUnity
  fetchLogs-->>pausePointWait: pausePointMatchingLogsResult{TotalCount, DisplayedCount, Logs}

  pausePointWait->>buildEvidence: buildPausePointEvidenceSummary(response, logsResult)
  buildEvidence-->>pausePointWait: pausePointEvidenceSummary{PausePoint, MatchingLogs, Warning}

  alt hit
    pausePointWait-->>Caller: pausePointWaitResult{EvidenceSummary, MatchingLogs}
  else timeout / expired
    pausePointWait-->>Caller: error envelope{Details: {EvidenceSummary, editorState}}
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • hatayama/unity-cli-loop#1309: Modifies the same pause-point wait/error/envelope diagnosis code paths, including MatchingLogs/EvidenceSummary embedding on hit/timeout/expired, directly preceding this PR's changes.
  • hatayama/unity-cli-loop#1335: Touches the same pause-point status/wait DTOs and expired recovery fields (Expired, timing, generation) in the CLI and response mappings that this PR extends with EditorState nesting.
  • hatayama/unity-cli-loop#1283: Introduced the original PausePointStatusBridgeCommand/PausePointStatusResponse shape and pause-point registry plumbing that this PR restructures with nested EditorState and hit sequencing.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 37.25% 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 'feat: Pause point waits now explain their evidence' directly summarizes the main change: pause point operations now provide detailed evidence summaries.
Description check ✅ Passed The description clearly explains the changeset: it documents the addition of EvidenceSummary to pause point waits, the restructuring of EditorState, hit tracking, and protocol version bumps.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/improve-pause-point

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 and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
cli/internal/cli/pause_point_logs.go (1)

165-184: 💤 Low value

Minor redundant computation (optional optimization).

buildPausePointEvidenceWarning internally calls buildPausePointEvidenceLogs (line 166) to derive the boolean flags, but the caller (buildPausePointEvidenceSummary at line 144) has already built the same pausePointEvidenceLogs struct. You could refactor the warning builder to accept the pre-built evidence logs instead of rebuilding them.

Current pattern is clear and self-contained, so this is purely a micro-optimization opportunity.

♻️ Optional refactor to eliminate redundant computation
-func buildPausePointEvidenceWarning(logs pausePointMatchingLogsResult, hitCount int) string {
-	evidenceLogs := buildPausePointEvidenceLogs(logs)
+func buildPausePointEvidenceWarning(evidenceLogs pausePointEvidenceLogs, hitCount int) string {
 	warnings := []string{}
 	if evidenceLogs.MayBeTruncated {

Then update the caller at line 145:

+	evidenceLogs := buildPausePointEvidenceLogs(logs)
 	return pausePointEvidenceSummary{
 		EditorState: response.EditorState,
 		PausePoint: pausePointEvidencePausePoint{
 			Id:                   response.Id,
 			Status:               response.Status,
 			Generation:           response.Generation,
 			HitCount:             response.HitCount,
 			MultipleHitsObserved: response.HitCount > 1,
 			FirstHitAtUtc:        response.FirstHitAtUtc,
 			LastHitAtUtc:         response.LastHitAtUtc,
 			FirstHitSequence:     response.FirstHitSequence,
 			LastHitSequence:      response.LastHitSequence,
 		},
-		MatchingLogs: buildPausePointEvidenceLogs(logs),
-		Warning:      buildPausePointEvidenceWarning(logs, response.HitCount),
+		MatchingLogs: evidenceLogs,
+		Warning:      buildPausePointEvidenceWarning(evidenceLogs, response.HitCount),
 	}
🤖 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 `@cli/internal/cli/pause_point_logs.go` around lines 165 - 184, The
buildPausePointEvidenceWarning function is redundantly calling
buildPausePointEvidenceLogs to derive the boolean flags, but the caller
buildPausePointEvidenceSummary has already built this same
pausePointEvidenceLogs struct. Refactor buildPausePointEvidenceWarning to accept
the pre-built pausePointEvidenceLogs as a parameter instead of accepting the raw
logs and rebuilding it internally. Then update the call to
buildPausePointEvidenceWarning in buildPausePointEvidenceSummary to pass the
already-constructed evidence logs instead of passing the raw logs, eliminating
the redundant computation.
Packages/src/Editor/Infrastructure/Api/PausePointStatusBridgeCommand.cs (1)

106-118: ⚡ Quick win

Use contract-style assertions in the new editor-state mappers.

These two internal mapping helpers treat null snapshots as runtime argument errors, but in this Editor codebase that case is a programmer-contract violation rather than recoverable input.

  • Packages/src/Editor/Infrastructure/Api/PausePointStatusBridgeCommand.cs#L106-L118: replace the ArgumentNullException branch in PausePointStatusEditorState.FromSnapshot(...) with a Debug.Assert(snapshot != null, ...) and keep the mapper as a straight projection.
  • Packages/src/Editor/FirstPartyTools/PausePoint/PausePointTools.cs#L115-L127: apply the same assert-based precondition in PausePointEditorState.FromSnapshot(...) so both new mappers follow the same fail-fast contract style.

Based on learnings, internal Editor-side preconditions in this repository are expected to use Debug.Assert for fail-fast contract programming rather than runtime exceptions.

🤖 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/Editor/Infrastructure/Api/PausePointStatusBridgeCommand.cs`
around lines 106 - 118, Replace the runtime argument validation with
contract-style assertions in both internal snapshot mapper methods. At
Packages/src/Editor/Infrastructure/Api/PausePointStatusBridgeCommand.cs lines
106-118, remove the null check that throws ArgumentNullException in the
PausePointStatusEditorState.FromSnapshot method and replace it with
Debug.Assert(snapshot != null, ...) to enforce the contract as a fail-fast
assertion rather than a runtime exception. Apply the identical change at
Packages/src/Editor/FirstPartyTools/PausePoint/PausePointTools.cs lines 115-127
in the PausePointEditorState.FromSnapshot method to ensure both mappers follow
consistent contract-style precondition checking using Debug.Assert for
programmer violations rather than recoverable input errors.

Source: Learnings

🤖 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.

Nitpick comments:
In `@cli/internal/cli/pause_point_logs.go`:
- Around line 165-184: The buildPausePointEvidenceWarning function is
redundantly calling buildPausePointEvidenceLogs to derive the boolean flags, but
the caller buildPausePointEvidenceSummary has already built this same
pausePointEvidenceLogs struct. Refactor buildPausePointEvidenceWarning to accept
the pre-built pausePointEvidenceLogs as a parameter instead of accepting the raw
logs and rebuilding it internally. Then update the call to
buildPausePointEvidenceWarning in buildPausePointEvidenceSummary to pass the
already-constructed evidence logs instead of passing the raw logs, eliminating
the redundant computation.

In `@Packages/src/Editor/Infrastructure/Api/PausePointStatusBridgeCommand.cs`:
- Around line 106-118: Replace the runtime argument validation with
contract-style assertions in both internal snapshot mapper methods. At
Packages/src/Editor/Infrastructure/Api/PausePointStatusBridgeCommand.cs lines
106-118, remove the null check that throws ArgumentNullException in the
PausePointStatusEditorState.FromSnapshot method and replace it with
Debug.Assert(snapshot != null, ...) to enforce the contract as a fail-fast
assertion rather than a runtime exception. Apply the identical change at
Packages/src/Editor/FirstPartyTools/PausePoint/PausePointTools.cs lines 115-127
in the PausePointEditorState.FromSnapshot method to ensure both mappers follow
consistent contract-style precondition checking using Debug.Assert for
programmer violations rather than recoverable input errors.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 521c5356-17b5-4067-af30-ff26cfd3b297

📥 Commits

Reviewing files that changed from the base of the PR and between 1ff3b6b and d2e28fa.

📒 Files selected for processing (13)
  • .agents/skills/uloop-wait-for-pause-point/SKILL.md
  • .claude/skills/uloop-wait-for-pause-point/SKILL.md
  • Assets/Tests/Editor/PausePointTests.cs
  • Packages/src/Editor/CliOnlyTools~/PausePoint/Skill/SKILL.md
  • Packages/src/Editor/Domain/CliConstants.cs
  • Packages/src/Editor/FirstPartyTools/PausePoint/PausePointTools.cs
  • Packages/src/Editor/Infrastructure/Api/PausePointStatusBridgeCommand.cs
  • Packages/src/Runtime/PausePoints/UloopPausePointRegistry.cs
  • cli/contract.json
  • cli/internal/cli/pause_point_errors.go
  • cli/internal/cli/pause_point_logs.go
  • cli/internal/cli/pause_point_wait.go
  • cli/internal/cli/pause_point_wait_test.go

@cubic-dev-ai cubic-dev-ai 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.

2 issues found across 13 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread cli/internal/cli/pause_point_logs.go Outdated
Comment thread .agents/skills/uloop-wait-for-pause-point/SKILL.md Outdated
Use observed wording for matching-log counts that may exceed returned rows, and limit skill guidance for timeout evidence summaries to the error that actually includes them.
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