Skip to content

fix(reliability): handle closed diagnostics and harden test fixtures - #725

Closed
lanyue-llk wants to merge 1 commit into
mainfrom
codex/browser-engineering-reliability
Closed

lanyue-llk wants to merge 1 commit into
mainfrom
codex/browser-engineering-reliability

Conversation

@lanyue-llk

@lanyue-llk lanyue-llk commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

启动器关闭 stderr 后,浏览器记录脚本错误会因日志组件再次写入损坏管道而中止进程。本 PR 保留正常错误日志,关闭日志组件对自身写入失败的二次输出;同时修复 CI 产物校验和跨平台测试夹具,为后续功能 PR 提供稳定的测试前提。

修复机制

  • stderr:使用 tracing 的标准配置处理损坏诊断输出,并用真实子进程分别验证正常日志与关闭管道。
  • SQLite:保留 Linux 非 UTF-8 文件名场景,在 macOS 验证非 ASCII 文件名;先建立正常数据库再移动文件,隔离数据库创建与快照路径处理。
  • 布局夹具:按实际 glyph baseline 与 padding 位移验证基线关系;滚动条场景使用仓库内 Ahem 字体和不可断词,固定输入而保留最终宽度与文本几何断言。
  • 网络夹具:等待真实 socket 接入、保留 libcurl 端点和请求语义断言,避免把调度时序当作功能失败。
  • CI:验证下载结果和归档有效性,再解包发布产物。
flowchart TD
A[页面脚本错误] --> B[tracing 记录错误]
B --> C{stderr 可写?}
C -->|是| D[保留正常错误日志]
C -->|否| E[禁用日志组件自身写入失败的二次输出]
D --> F[浏览器继续完成请求]
E --> F
Loading

图示说明本 PR 的 stderr 故障处理路径。

对应验收

本 PR 不认领历史 1.1.9 的 34 个失败 case,验收对象是诊断管道、CI 归档及测试夹具的功能契约。

验证项 结果
当前 HEAD / main 基线 f13e9f42 / 72413280
本地验证版本 22e161c8,基于 de1093d9c;rebase 前后功能补丁逐字节相同
cargo fmt --all 通过
cargo clippy --workspace --all-targets --all-features -- -D warnings 通过
cargo nextest run --no-fail-fast 18,416 通过、0 失败;13 项仓库既有跳过
CI 脚本测试 node --test .github/scripts/*.test.cjs,13/13 通过
真实 release CLI 红/绿对照 main 关闭 stderr 后 SIGABRT、无页面输出;修复后 exit 0、页面内容完整;正常 stderr 仍记录脚本错误
当前 HEAD 完整门禁 由本 PR CI 验证

源码、门禁与构建参数证据、rebase 补丁一致性、release 二进制哈希与红绿结果、CI 脚本测试。本地门禁关闭调试符号以控制磁盘占用,未关闭断言或减少测试。

复现诊断管道专项:

cargo nextest run -E 'test(cli_uncaught_script_error_)'

范围与依赖

从 #640 拆出,原 PR 与原分支保留。本 PR 直接基于 main,是其他六个功能分区的共同前置。布局夹具的调整只固定字体输入和验证真实基线关系;布局生产逻辑仍在独立布局 PR 中。

完整对应关系:拆分 PR 索引、逐 case 历史失败及归属。

@github-actions

Copy link
Copy Markdown

Sequential Navigation Soak A/B

✅ HEAD completed the 200-navigation resilience and memory observation.

One browser process, one target, and one CDP session navigate CSDN → SegmentFault → Huaban → example.com repeatedly. This run issued 200 Page.navigate commands per binary.

Common ancestor 7241328085 → HEAD f13e9f427e; benchmark order: base-first; workflow: success.

Session resilience

Metric Base HEAD
Attempted / planned 200 / 200 200 / 200
Direct observable pass 200 / 200 200 / 200
Failures / recovered 0 / 0 0 / 0
Recovery failures 0 0
Lifecycle order violations 0 0
Network order violations 0 0
Wall time 304.5 s 302.5 s

A public-page failure is reported separately from an unrecoverable session. The soak requires all navigation attempts, zero failed recovery, zero lifecycle/network ordering violations, and complete resource evidence.

Process-tree memory

Metric Base HEAD Δ
Boundary samples 200 200 0
Boundary RSS samples 200 200 0
Boundary PSS samples 200 200 0
Periodic peak RSS 224.3 MiB 222.7 MiB -1.7 MiB
Periodic peak PSS 221.1 MiB 219.8 MiB -1.3 MiB
RSS · first 10 avg 168.2 MiB 166.6 MiB -1.5 MiB
RSS · last 10 avg 135.0 MiB 145.8 MiB +10.8 MiB
RSS · last − first window -33.2 MiB -20.8 MiB +12.3 MiB
RSS · warm slope / 100 nav -23.0 MiB -13.0 MiB +10.0 MiB
PSS · first 10 avg 165.0 MiB 162.8 MiB -2.2 MiB
PSS · last 10 avg 132.7 MiB 143.0 MiB +10.3 MiB
PSS · last − first window -32.3 MiB -19.8 MiB +12.6 MiB
PSS · warm slope / 100 nav -22.5 MiB -13.4 MiB +9.2 MiB
Peak file descriptors 63 63 0
Peak threads 31 31 0

HEAD memory by 50-navigation quarter

HEAD range Avg RSS Final RSS Peak RSS Avg PSS Final PSS Peak FD
1–50 165.6 MiB 149.3 MiB 218.5 MiB 162.7 MiB 146.2 MiB 53
51–100 154.1 MiB 122.8 MiB 211.4 MiB 150.8 MiB 119.1 MiB 60
101–150 146.2 MiB 129.1 MiB 193.9 MiB 142.5 MiB 125.4 MiB 53
151–200 148.1 MiB 114.5 MiB 200.3 MiB 145.1 MiB 111.8 MiB 53

Raw reports and per-navigation boundary samples: workflow run and full sequential-navigation-soak-results artifact.

Public-site timing and memory are observational. Use the A/B deltas and trend shape as evidence, not as a deterministic performance threshold.

@github-actions

Copy link
Copy Markdown

Spider Bench A/B

✅ All benchmark browser service runs completed; results are informational.

Public HEAD: 189 / 240 rows; 39 / 48 sites produced rows; 9 unexpected empty sites.

✅ Deterministic fixture contract is clean.

Common ancestor 7241328085c8 → HEAD f13e9f427ebd; benchmark order: base-first; workflow: success.

Public 48-site run · informational

Metric Base HEAD Δ
Run status success success —
Extracted rows / contract 184 / 240 189 / 240 +5 (+2.72%)
Contract fill 76.67% 78.75% +2.08 pp (+2.71%)
Sites with rows 38 / 48 39 / 48 +1 (+2.63%)
Sites meeting row contract 36 / 48 37 / 48 +1 (+2.78%)
Unexpected empty sites 10 9 -1 (-10.00%)
Partial-row sites 2 2 0 (0.00%)
Site outcomes extracted: 36; HTTP error + rows: 2; empty: 7; HTTP error + empty: 1; snapshot error + empty: 2 extracted: 38; HTTP error + rows: 1; empty: 6; HTTP error + empty: 1; snapshot error + empty: 2 —
Observed duration 53.09 s 56.59 s +3.50 s (+6.60%)
Estimated CPU 51.55 s 51.33 s -0.23 s (-0.44%)
Peak PSS 261.71 MiB 266.55 MiB +4.84 MiB (+1.85%)
Peak RSS 264.63 MiB 269.95 MiB +5.31 MiB (+2.01%)
Peak threads 27 26 -1 (-3.70%)
Mismatched sites 0 0 0
Timeout with items 0 0 0
Category rows Base HEAD Δ
news 35 / 40 35 / 40 0
stocks 20 / 40 20 / 40 0
tech 35 / 40 35 / 40 0
sports 27 / 40 32 / 40 +5
games 37 / 40 37 / 40 0
life 30 / 40 30 / 40 0

Public-site content, timing, and memory are noisy. This single A/B run reports evidence only; site outcome counts explain missing rows without treating them as a deterministic regression.

CPU and memory timelines

These are bounded 40-point views of the same complete process-tree samples used by the HTML report. CPU uses 100% per occupied logical core; memory lines are RSS first and PSS second when complete PSS samples are available.

Base

xychart-beta
    title "Base CPU"
    x-axis "Elapsed seconds" [1.547, 2.549, 3.05, 4.551, 6.052, 7.555, 9.056, 10.557, 12.06, 13.562, 14.562, 16.064, 17.564, 19.067, 20.569, 22.072, 23.573, 25.074, 26.576, 27.077, 28.077, 29.581, 31.083, 32.585, 34.087, 35.589, 37.091, 38.591, 40.093, 41.095, 42.596, 44.097, 45.598, 47.1, 48.601, 50.102, 51.604, 52.605]
    y-axis "CPU percent" 0 --> 500
    line [115.89, 105.86, 101.83, 79.99, 175.96, 159.59, 77.97, 163.82, 113.93, 65.92, 108.01, 0, 2, 87.84, 6, 33.92, 173.82, 123.94, 119.7, 99.91, 131.85, 103.8, 143.81, 149.85, 115.87, 17.96, 83.79, 41.97, 71.94, 145.83, 111.99, 4, 102.04, 123.81, 65.95, 99.93, 133.92, 193.8]
Loading
xychart-beta
    title "Base memory: RSS then PSS"
    x-axis "Elapsed seconds" [0.044, 1.547, 2.549, 3.05, 4.551, 6.052, 7.555, 9.056, 10.557, 12.06, 13.562, 14.562, 16.064, 17.564, 19.067, 20.569, 22.072, 23.573, 25.074, 26.576, 27.077, 28.077, 29.581, 31.083, 32.585, 34.087, 35.589, 37.091, 38.591, 40.093, 41.095, 42.596, 44.097, 45.598, 47.1, 48.601, 50.102, 51.604, 52.605, 53.091]
    y-axis "Memory MiB" 0 --> 500
    line [12.12, 107.49, 111.63, 116.66, 127.55, 145.28, 164.77, 178.4, 162.89, 158.65, 170.92, 186.45, 165.65, 142.94, 157.61, 146.13, 141.54, 163.15, 158.71, 204.52, 264.63, 193.14, 212.74, 168.65, 173.21, 162.89, 143.94, 144.91, 146.83, 150.64, 155.36, 166.38, 150.1, 159.81, 176.25, 148.55, 151.03, 162.1, 188.36, 0]
    line [8.57, 103.8, 108.08, 113.34, 124.01, 141.85, 161.31, 174.95, 159.17, 155.71, 167.85, 184.22, 162.71, 140, 154.67, 143.19, 138.59, 160.27, 155.76, 201.61, 261.71, 190.35, 210.02, 165.62, 170.43, 159.72, 140.78, 141.99, 143.6, 147.41, 152.18, 163.24, 147.01, 156.69, 173.08, 145.51, 147.89, 158.98, 185.3, 0]
Loading

HEAD

xychart-beta
    title "HEAD CPU"
    x-axis "Elapsed seconds" [1.538, 3.042, 4.544, 6.548, 8.05, 9.552, 11.055, 12.558, 14.064, 15.567, 17.569, 19.07, 20.576, 21.125, 22.126, 23.629, 25.13, 26.632, 28.634, 29.134, 30.136, 31.668, 33.171, 34.671, 36.173, 37.679, 39.18, 41.181, 42.687, 44.189, 45.692, 47.193, 48.698, 50.199, 52.201, 53.703, 55.207, 56.207]
    y-axis "CPU percent" 0 --> 500
    line [121.85, 137.34, 105.93, 105.72, 115.64, 103.88, 129.82, 121.86, 91.93, 115.71, 87.7, 85.98, 17.85, 0, 0, 31.95, 113.89, 113.83, 99.87, 102, 103.77, 90.51, 43.9, 107.97, 111.87, 37.97, 65.98, 9.99, 109.91, 127.92, 87.89, 13.99, 93.49, 117.87, 51.96, 95.91, 113.7, 218.06]
Loading
xychart-beta
    title "HEAD memory: RSS then PSS"
    x-axis "Elapsed seconds" [0.033, 1.538, 3.042, 4.544, 6.548, 8.05, 9.552, 11.055, 12.558, 14.064, 15.567, 17.569, 19.07, 20.576, 21.125, 22.126, 23.629, 25.13, 26.632, 28.634, 29.134, 30.136, 31.668, 33.171, 34.671, 36.173, 37.679, 39.18, 41.181, 42.687, 44.189, 45.692, 47.193, 48.698, 50.199, 52.201, 53.703, 55.207, 56.207, 56.593]
    y-axis "Memory MiB" 0 --> 500
    line [11.96, 108.16, 123.34, 147.4, 178.59, 175.79, 187.84, 159.5, 156.5, 167.26, 183.47, 146.21, 150.18, 138.3, 138.3, 137.21, 140.54, 175.67, 148.95, 225.77, 269.95, 190.63, 164.51, 156.1, 186.71, 165.38, 142.38, 152.29, 151.88, 186.61, 183.75, 183.14, 153.11, 177.29, 175.45, 153.17, 153.71, 165.23, 198.54, 0]
    line [9.22, 104.91, 120.01, 144.2, 175.96, 172.48, 184.36, 156.17, 153.23, 163.85, 180.1, 142.74, 146.78, 134.84, 134.84, 133.75, 137.08, 172.3, 145.43, 222.41, 266.55, 187.33, 162.56, 152.75, 183.29, 161.99, 138.9, 148.85, 148.47, 183.4, 180.32, 179.73, 149.68, 173.89, 166.79, 149.68, 150.23, 161.77, 195.2, 0]
Loading

Deterministic fixture · required contract

The fixture exercises 15 routes: 8 are expected to emit rows and 7 intentionally exercise empty, loading, or timeout behavior.

Metric Base HEAD Δ
Run status success success —
Extracted rows / contract 40 / 40 40 / 40 0 (0.00%)
Contract fill 100.00% 100.00% 0.00 pp (0.00%)
Sites with rows 8 / 15 8 / 15 0 (0.00%)
Sites meeting row contract 15 / 15 15 / 15 0 (0.00%)
Unexpected empty sites 0 0 0
Partial-row sites 0 0 0
Site outcomes extracted: 7; HTTP error + rows: 1; empty: 3; timeout + empty: 4 extracted: 7; HTTP error + rows: 1; empty: 3; timeout + empty: 4 —
Observed duration 19.99 s 19.99 s -0.00 s (-0.01%)
Estimated CPU 0.40 s 0.42 s +0.02 s (+4.96%)
Peak PSS 56.97 MiB 57.20 MiB +0.22 MiB (+0.39%)
Peak RSS 60.85 MiB 61.05 MiB +0.21 MiB (+0.34%)
Peak threads 18 18 0 (0.00%)
Mismatched sites 0 0 0
Timeout with items 0 0 0

Full HTML, JSON, CSV, logs, and page snapshots: workflow run and full spider-bench-results artifact.

The public-web A/B is informational. The exact HEAD fixture contract runs as a separate required CI check; timing and public-site content deltas remain non-blocking.

@lanyue-llk

Copy link
Copy Markdown
Contributor Author

由 #734 替代:基于 main@2793b2407,PR 作者和所有新增提交的 GitHub author/committer 已核验关联 lanyue-llk。原分支、提交和本 PR 的讨论保留;这里只关闭被替代的 PR,不删除分支。新的 CI 与逐 case 验收记录归属替代 PR,旧版本测试结果不冒认为新版本结果。

@lanyue-llk lanyue-llk closed this Sep 22, 2026
@github-actions

Copy link
Copy Markdown

CI Regression Report

Source CI run · source state at render: in_progress · artifacts: 4/5

Check Status Signal
Release regression ⚪ artifact unavailable or invalid
Frontend differential ✅ 1,020/1,020 cases matched; 0 issues
Agent episodes ✅ 8/8 Moli episodes passed; 0 failures
Runtime/CDP contracts ✅ 26 contract cases; 0 failures
CDP smoke ✅ 48/48 groups passed; 535 scenarios
Release regression — ⚪ artifact unavailable or invalid

Artifact unavailable or invalid. See the source CI run for infrastructure details.

Frontend differential — ✅ 1,020/1,020 cases matched; 0 issues
Match DOM mismatch Diagnostic mismatch Moli error Reference error Infrastructure error Mismatched frames Duration
1,020 0 0 0 0 0 0 8m 50.71s
Agent episodes · Moli vs Chromium — ✅ 8/8 Moli episodes passed; 0 failures
Fast contract Episodes Passed Assertions Ready p50 Episode p50
Moli 8 8 47/47 3.91 ms 25.75 ms
Chromium 8 8 47/47 297.97 ms 79.74 ms
Operation p50 Chromium Moli Delta Delta %
navigate 41.17 ms 6.67 ms −34.50 ms −83.80%
observe 0.77 ms 0.84 ms +0.06 ms +8.27%
fill 2.69 ms 3.03 ms +0.34 ms +12.53%
click 2.75 ms 3.47 ms +0.72 ms +26.31%
Idle-resource episode Peak RSS Peak PSS Average CPU Peak CPU Peak processes Sampler
Moli 63.68 MiB 61.90 MiB 0.68% 9.99% 1 ✅
Chromium 1254.94 MiB 405.90 MiB 2.11% 88.18% 13 ⚠️ PSS partial
Runtime and CDP session contracts — ✅ 26 contract cases; 0 failures
Suite Cases Failures Median case p50 Median case p95 Median peak PSS p50
Synthetic fetch 13 0 23.54 ms 28.38 ms 513.00 KiB
Long-lived CDP session 13 0 21.25 ms 23.27 ms —
CDP smoke — ✅ 48/48 groups passed; 535 scenarios

Workers: 4 · cumulative group time: 148.14 s · failed groups: 0

Slowest group Scenarios Duration Status
target-lifecycle 24 16.79 s ✅
multi-page 45 11.59 s ✅
chromium-cdp 56 10.78 s ✅
dom-input 27 10.76 s ✅
layout-screenshot 5 7.70 s ✅

All artifact fields are parsed by the trusted default-branch renderer; missing or invalid inputs remain visible as unavailable.

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