Skip to content

feat(extension): add opt-in diagnostics to investigate reconnect issue #395 - #460

Open
CHENZlHAO wants to merge 8 commits into
Tencent:mainfrom
CHENZlHAO:codex/connection-diagnostics
Open

CHENZlHAO wants to merge 8 commits into
Tencent:mainfrom
CHENZlHAO:codex/connection-diagnostics

Conversation

@CHENZlHAO

@CHENZlHAO CHENZlHAO commented Oct 17, 2026 •

Copy link
Copy Markdown

Purpose: advance the investigation and eventual fix of #395

This PR is a diagnostic step toward fixing #395: it adds the extension-side evidence needed to locate the cause of the reported reconnect failure and develop a targeted, verifiable fix.

During the reconnect silence reported in #395, daemon INFO logs cannot distinguish an outstanding physical socket attempt, a skipped controller request, pending cleanup, or a worker/alarm delivery gap. The Windows restart/sleep and controlled handshake experiments did not reproduce the reported prolonged failure; the root cause remains unconfirmed.

This adds default-off extension connection diagnostics and an investigation record. The extension options page explicitly starts/stops recording, reads stored data, exports JSON, and clears the log. Recording retains at most 2048 locally stored events with allowlisted fields, timestamps, boot/build provenance, socket generations, controller gates, cleanup/handshake outcomes, and delivered alarms. It excludes page content, URLs, tokens, arbitrary error/close text, and RPC payloads; nothing is uploaded automatically.

Opening, refreshing, and exporting the page only read stored data. Explicit controls may wake the worker. Storage failures are isolated from connection startup; pending diagnostic writes are drained before clearing. Stop/start in the same worker preserves event sequence identity. Tests cover filtering, bounds, persistence races, failure isolation, controls, and observation hooks.

Retry delays, handshake deadlines, cleanup ordering, and keepalive policy are unchanged. The manifest only adds options_ui; the extension name, version, and permissions match the upstream baseline.

Investigation and validation

  • docs/investigations/395-reconnect.md records six successful real Windows daemon/sleep cycles, actual MV3 worker physical/application handshake faults, experimental recorder persistence across a manual reload, and simulated pending-cleanup probes, with their limits.
  • docs/connection-diagnostics.md describes capture steps, privacy boundaries, and the possible scheduling effect of recording.
  • Full extension suite: 2694 passed, 242 skipped (175 passing test files, 31 skipped).
  • Extension TypeScript compile, Biome check of all 14 changed TypeScript files, WXT production build, and git diff --check passed.
  • Built manifest compared against a build using the exact upstream configuration: only options_ui differs.
  • Independent code review found no actionable defects; the final filter regression and startup-isolation changes were also reviewed.

This remains a draft: the new 0.3.3 opt-in controls still need manual validation in an installed Edge extension. The built options page was previewed with explicitly synthetic storage; that preview is not an installed-extension test. Actual-worker measurements in the investigation used the earlier 0.3.2 official/experimental builds. Repository-wide CI remains to run on the PR.

Related to #395. The goal remains to fix the reported reconnect failure. This PR delivers the investigation and instrumentation stage; the next step is to correlate a real failure with daemon logs, identify the cause, and add a targeted regression test and fix. The current changes do not yet resolve the failure, so #395 should remain open.

@CHENZlHAO CHENZlHAO changed the title feat(extension): add opt-in connection lifecycle diagnostics feat(extension): add opt-in diagnostics to investigate reconnect issue #395 Oct 18, 2026
@CHENZlHAO
CHENZlHAO marked this pull request as ready for review October 18, 2026 02:52

This branch has not been deployed

No deployments
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