Skip to content

fix(renderer): await worker startup and broker resource completion - #110

Closed
TKY-27 wants to merge 2 commits into
sahenjp:mainfrom
TKY-27:fix/renderer-worker-readiness
Closed

TKY-27 wants to merge 2 commits into
sahenjp:mainfrom
TKY-27:fix/renderer-worker-readiness

Conversation

@TKY-27

@TKY-27 TKY-27 commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Problem

The real Firefox fixture intermittently loses worker-produced DOM content on Windows. This was observed on unchanged renderer code in PR #103 and again in #106 (Windows job 127290092842, assertion at test.cjs:78). The helper takes its snapshot immediately after Playwright's page network-idle event, without accounting for worker startup and the complete broker/fulfillment lifecycle.

Changes

  • Observe ordinary worker startup through a private MessageChannel task; do not require the worker to terminate or send an application message.
  • Count all intercepted resources through route.fulfill or route.abort, then apply the existing 500 ms quiet period.
  • Retry the snapshot if observed resource activity starts during extraction.
  • Share a 10-second deadline across readiness and extraction, with idempotent completion and shutdown cleanup.
  • Keep proxy/sandbox, allowed methods, body and resource-count guards unchanged.

The guarantee remains a bounded quiet period after observed activity. Arbitrary later timers or full application completion are not inferred.

Validation

  • Five deterministic Node lifecycle/deadline tests passed.
  • Existing missing-browser protocol test passed.
  • Syntax checks for all four JavaScript files, diff check and README Markdown lint passed.
  • Independent source review found no blocking lifecycle/security defect.
  • Added real-browser regressions for delayed worker/broker/page-fetch chains, quiet or self-closing workers, and a stalled worker resource. The original worker-content assertion remains intact.

Actual Firefox verification is pending CI. This environment rejects Firefox's sandbox user-namespace setup with uid_map EPERM; its controls were not relaxed. Cross-platform Firefox jobs must establish the fix on Windows, Linux and macOS. This PR does not claim those checks have already passed.

This is an independent prerequisite for reliable renderer CI on the other open changes. Implementation and tests were AI-assisted and reviewed before submission.

@TKY-27
TKY-27 requested a review from sahenjp as a code owner November 5, 2026 14:34
Copilot AI balanced review requested due to automatic review settings November 5, 2026 14:34

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

sahenjp added a commit that referenced this pull request Nov 6, 2026
The open retrieval, page-fetch and maintenance PRs conflict with the
provider rollout now on main. This integration preserves their fixes and
the current endpoint-review and MCP budget contracts.

## Changes

- Integrate #103, #106, #107, #108, #109 and #110, with conflicts
resolved against v0.29.0.
- Keep local-source pagination and explicit selection, source weights,
bounded index work and atomic index replacement. Apply the existing
per-host diversity cap to merged local results while preserving
single-source paging.
- Carry validated explicit Accept-Language preferences through MCP, HTTP
raw content, page caches and renderer resources.
- Preserve source URLs, author links and supplied licences. Add scoped
provider evidence and prevent a named entry from overriding a module
restriction.
- Fix the renderer race where a self-closing worker destroys its
evaluation context before Playwright delivers its close event.
- Retain explicit tokenizer budgets and document their counting scope
and frozen-response measurements.
- Resolve dependency and release-version conflicts while keeping the
empty audit exception baseline.

## Validation

- Rust all-target tests passed, 1106 successful and 4 ignored. Three
require optional external services or browser setup, and one generates
an offline benchmark artifact.
- Clippy with warnings denied, fmt and diff checks passed.
- Python suite passed, 63 tests.
- Real Firefox renderer suite passed, 16 tests, including self-closing
workers, delayed worker/fetch chains, broker failures and the shared
deadline.
- The dependency integration passed Rust 1.88 checks and cargo audit
with zero vulnerabilities, unmaintained warnings or unsound warnings.
- The latest head e478916 passed all 14 cross-platform CI checks. It
includes the final observations and credit-limit report.
- The earlier API-active runs reached hit@1 72/100 and hit@5 87–88/100
at 699–853 ms median. The final integration evaluation encountered HTTP
402 / NO_MORE_CREDITS. Its first API run reached 69/84, Standard reached
54/68, and the second API run with the exhausted account reached 50/64.
All responses and per-source states are retained in
bench/results/issue-resolution-2026-11-06/.

The independent Japanese compiler corpus remains difficult, with poor
reference-page retrieval. Its observations and cache conditions remain
published. The final Japanese run also encountered the exhausted
account. API billing requires selecting the API profile and supplying
the operator's key.

## Remaining merge gate

Issue #104 requires verification with available Exa credits or another
reviewed source configuration. This PR remains Draft under the requested
sequence of resolving all issues before merge. The operator has been
asked to restore the provider budget or select an available reviewed
source. The measurements and blocking response are documented in
docs/ISSUE-RESOLUTION-2026-11-06.md.

Fixes #40.
Fixes #41.
Fixes #60.
Fixes #63.
Fixes #79.
Related to #104 and #16.

Draft #37 was closed after reviewing its unresolved change request and
obsolete page-fetch path. Issue #16's remaining default Bing enablement
requirement was retired under the provider policy.

Implementation and review were AI-assisted.

---------

Co-authored-by: Ana <269872094+TKY-27@users.noreply.github.com>
Co-authored-by: Sahen <262773687+sahenjp@users.noreply.github.com>
@sahenjp

sahenjp commented Nov 6, 2026

Copy link
Copy Markdown
Owner

内容は #113 に統合してマージ済みです。本PRはクローズします。

@sahenjp sahenjp closed this Nov 6, 2026
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.

3 participants