[PR #5579] [CLOSED] fix(browser): keep cancellation for scenario captures cancelled during startup #6977

Closed
opened 2026-11-01 21:44:27 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/5579
Author: @kaoru0822-kitauji
Created: 10/20/2026
Status: ❌ Closed

Base: main ← Head: fix/browser-scenario-startup-cancel


📝 Commits (1)

  • 38998e4 fix(browser): keep cancellation for scenario captures cancelled during startup

📊 Changes

2 files changed (+50 additions, -2 deletions)

View changed files

📝 src/application/BrowserScenarioCaptureService.test.ts (+43 -1)
📝 src/application/BrowserScenarioCaptureService.ts (+7 -1)

📄 Description

Summary

Fixes #5364. Cancelling capture-browser-scenario while the initial navigation is pending returned unreadable_output ("Browser scenario provider retained a malformed completed capture.") and dropped the retained partial capture. It now keeps the typed cancellation and returns the provider's incomplete observation as partial_observation, without promoting it to completed Evidence.

Problem and expected behavior

captureBrowserScenario (src/application/BrowserScenarioCaptureService.ts) validates a retained capture against the completed-report schema. On a cancellation it converted any validation failure into AnalysisOutputError. The startup failure path in PlaywrightScenarioSession retains steps: [] and no completeness, which BrowserScenarioPartialObservation explicitly permits, so every cancellation during startup hit that branch. The AnalysisOutputError conversion is still right for its original purpose (3b698645a): a capture produced after the run finished, which carries completeness, must be well formed.

Change and scope

  • The AnalysisOutputError conversion now applies only when the retained capture reports completeness, i.e. claims to be a completed report.
  • Other cancelled captures return the original AnalysisCancelledError with the raw browser-scenario-observation partial, exactly as non-cancellation failures already do.
  • The provider is unchanged.

Contribution scope: ordinary fix within existing boundaries; maintainer scope decision not applicable.

Contract and boundary impact

  • Semantic owner and earliest changed stage: BrowserScenarioCaptureService (application owner of retained capture projection).

  • Contribution scope fit and linked maintainer decision: ordinary fix; not applicable.

  • CLI and MCP/tool-catalog contract: startup cancellation now reports cancelled (exit 130) with partial_observation instead of unreadable_output; no schema change.

  • Provider, bridge, target-format, or platform compatibility: none.

  • Evidence, artifact, provenance, or reconstruction contract: incomplete captures are not promoted to Evidence; completed-report validation is unchanged.

  • Target selection, authority, upstream behavior, and cleanup details: cleanup unchanged.

  • Generated metadata, package, or installation impact: none.

  • Read existing files or captured data.

  • Launch or attach to a process.

  • Inject instrumentation or run scripts/code.

  • Change process memory, registers, files, or configuration.

  • Contact network services.

  • Recover protected code or work around protections.

  • Documentation or usability only; no target interaction.

  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added in src/application/BrowserScenarioCaptureService.test.ts:

    • A cancellation retaining a startup-shaped capture (no completeness, no steps) returns the same AnalysisCancelledError and the unchanged raw partial.
    • A cancelled capture that reports completeness but is malformed still yields AnalysisOutputError, preserving the original guard.
  • Base reproduction: with the service change stashed, the first new test fails (base returns AnalysisOutputError).

  • Remaining proof gaps: the issue's real-Chrome SIGINT repro with a held-open navigation was not rerun here; the test exercises the same service branch with the shape the startup path produces (PlaywrightScenarioSession, steps: [], no completeness).

  • Observed, derived, and inferred claims remain distinguishable.

  • Artifact identity, source provenance, and failed attempts remain preserved.

  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • npm run test:local -- src/application/BrowserScenarioCaptureService.test.ts: 7 passed
  • Same command with the service change stashed: 1 failed (new startup-cancellation test), 6 passed
  • npm run check:fast: passed

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: no real browser run; macOS arm64 unit/service test only.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: no new processes or side effects.

Author readiness

Human owner: @kaoru0822-kitauji

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/5579 **Author:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Created:** 10/20/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/browser-scenario-startup-cancel` --- ### 📝 Commits (1) - [`38998e4`](https://github.com/morluto/rea/commit/38998e465f02ef9c749a413b11250c5b811421d6) fix(browser): keep cancellation for scenario captures cancelled during startup ### 📊 Changes **2 files changed** (+50 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src/application/BrowserScenarioCaptureService.test.ts` (+43 -1) 📝 `src/application/BrowserScenarioCaptureService.ts` (+7 -1) </details> ### 📄 Description ## Summary Fixes #5364. Cancelling `capture-browser-scenario` while the initial navigation is pending returned `unreadable_output` ("Browser scenario provider retained a malformed completed capture.") and dropped the retained partial capture. It now keeps the typed cancellation and returns the provider's incomplete observation as `partial_observation`, without promoting it to completed Evidence. ## Problem and expected behavior `captureBrowserScenario` (`src/application/BrowserScenarioCaptureService.ts`) validates a retained capture against the completed-report schema. On a cancellation it converted any validation failure into `AnalysisOutputError`. The startup failure path in `PlaywrightScenarioSession` retains `steps: []` and no `completeness`, which `BrowserScenarioPartialObservation` explicitly permits, so every cancellation during startup hit that branch. The `AnalysisOutputError` conversion is still right for its original purpose (3b698645a): a capture produced after the run finished, which carries `completeness`, must be well formed. ## Change and scope - The `AnalysisOutputError` conversion now applies only when the retained capture reports `completeness`, i.e. claims to be a completed report. - Other cancelled captures return the original `AnalysisCancelledError` with the raw `browser-scenario-observation` partial, exactly as non-cancellation failures already do. - The provider is unchanged. Contribution scope: ordinary fix within existing boundaries; maintainer scope decision not applicable. ## Contract and boundary impact - Semantic owner and earliest changed stage: `BrowserScenarioCaptureService` (application owner of retained capture projection). - Contribution scope fit and linked maintainer decision: ordinary fix; not applicable. - CLI and MCP/tool-catalog contract: startup cancellation now reports `cancelled` (exit 130) with `partial_observation` instead of `unreadable_output`; no schema change. - Provider, bridge, target-format, or platform compatibility: none. - Evidence, artifact, provenance, or reconstruction contract: incomplete captures are not promoted to Evidence; completed-report validation is unchanged. - Target selection, authority, upstream behavior, and cleanup details: cleanup unchanged. - Generated metadata, package, or installation impact: none. - [ ] Read existing files or captured data. - [ ] Launch or attach to a process. - [ ] Inject instrumentation or run scripts/code. - [ ] Change process memory, registers, files, or configuration. - [ ] Contact network services. - [ ] Recover protected code or work around protections. - [ ] Documentation or usability only; no target interaction. - [ ] Not sure yet; investigation or maintainer guidance needed. ## Evidence and regression coverage - Tests added in `src/application/BrowserScenarioCaptureService.test.ts`: - A cancellation retaining a startup-shaped capture (no `completeness`, no steps) returns the same `AnalysisCancelledError` and the unchanged raw partial. - A cancelled capture that reports `completeness` but is malformed still yields `AnalysisOutputError`, preserving the original guard. - Base reproduction: with the service change stashed, the first new test fails (base returns `AnalysisOutputError`). - Remaining proof gaps: the issue's real-Chrome SIGINT repro with a held-open navigation was not rerun here; the test exercises the same service branch with the shape the startup path produces (`PlaywrightScenarioSession`, `steps: []`, no `completeness`). - [x] Observed, derived, and inferred claims remain distinguishable. - [x] Artifact identity, source provenance, and failed attempts remain preserved. - [x] Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. ## Validation performed - `npm run test:local -- src/application/BrowserScenarioCaptureService.test.ts`: 7 passed - Same command with the service change stashed: 1 failed (new startup-cancellation test), 6 passed - `npm run check:fast`: passed ## Compatibility, safety, and release - Breaking changes or migration steps: none. - Real Hopper/Ghidra, browser, or OS coverage: no real browser run; macOS arm64 unit/service test only. - Package or release metadata impact: none. - Security, privacy, process, or containment review: no new processes or side effects. ## Author readiness Human owner: @kaoru0822-kitauji - [x] I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work. - [x] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [x] I declare this PR ready for initial maintainer review. ## Before merge - [ ] This PR addresses a concrete problem or an agreed enhancement. - [ ] Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff. - [ ] The PR has one focused outcome and the title follows `type(scope): outcome`. - [ ] Related issue is linked, or the reason for not linking one is stated above. - [ ] Tests cover changed observable behavior and meaningful failure paths. - [ ] Owning docs, contracts, and generated metadata are updated where needed. - [ ] User-visible CLI/MCP changes include representative output. - [ ] I checked the final diff for secrets, unrelated cleanup, and unsupported claims. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-01 21:44:27 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#6977
No description provided.