Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
96240b5
Capture sanitized OpenCode CI failure timelines
wangtiance Dec 2, 2026
3329b9a
Trace OpenCode shell and gateway boundaries
wangtiance Dec 2, 2026
82f3d62
Compare standalone OpenCode on the diagnostic runner
wangtiance Dec 2, 2026
c1a7020
Resolve the hosted control binary through the runtime
wangtiance Dec 2, 2026
b429019
Merge commit 'ae5003b641a920b23fa00e8d908ef4367c2d0754' into codex/op…
wangtiance Dec 2, 2026
8a55eb4
Timestamp standalone OpenCode diagnostic events
wangtiance Dec 2, 2026
26079c5
Provide ripgrep for the hosted OpenCode diagnostic
wangtiance Dec 2, 2026
0e4c6c1
Capture watchdog process and pipe state in OpenCode CI
wangtiance Dec 2, 2026
204cb9d
Compare OpenCode child-process exit behavior in CI
wangtiance Dec 2, 2026
67a198e
Compare Bun child waits on the hosted diagnostic runner
wangtiance Dec 2, 2026
d800397
Compare OpenCode snapshots around first tool completion
wangtiance Dec 2, 2026
dd222f0
[ci] Sample Git child state on OpenCode timeout
wangtiance Dec 2, 2026
8c1f74c
[ci] Measure OpenCode CPU activity at watchdog
wangtiance Dec 2, 2026
2cc5bcc
[ci] Omit exited processes from CPU sampling
wangtiance Dec 2, 2026
572034d
[ci] Capture bounded native stack on OpenCode timeout
wangtiance Dec 2, 2026
7229f60
[ci] Compare JIT modes in OpenCode diagnostic job
wangtiance Dec 2, 2026
ab6c9b8
[ci] Compare monotonic clock sources in OpenCode
wangtiance Dec 2, 2026
09aa713
[ci] Handle clock probe writes and expose preflight state
wangtiance Dec 2, 2026
53eda06
[ci] Isolate clock preflight and retain interrupted evidence
wangtiance Dec 2, 2026
d763146
Merge commit '6a68d74953bd20bff82395f1d3cadae5790d957b' into codex/op…
wangtiance Dec 3, 2026
6ca06c9
[ci] Observe monotonic clock in the bundled regression
wangtiance Dec 3, 2026
cd74d8b
Merge commit '147b18324c7317e56456861d8b78c1cbf936ce6e' into codex/op…
wangtiance Dec 3, 2026
08aa0c1
[ci] Compare snapshot completion with libc observation
wangtiance Dec 3, 2026
17fb589
[ci] Compare snapshots in the thinking direct-reply case
wangtiance Dec 3, 2026
67a30d3
Compare bundled and stable OpenCode on one CI runner
wangtiance Dec 3, 2026
153dfd3
Isolate the version comparison from required CI
wangtiance Dec 3, 2026
bf681a3
Sample runner pressure around bundled OpenCode cases
wangtiance Dec 3, 2026
a044c76
Collect samples from the nested pytest worker
wangtiance Dec 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
216 changes: 216 additions & 0 deletions .github/workflows/release-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,103 @@ jobs:
MERGE_GROUP_BASE_SHA: ${{ github.event.merge_group.base_sha }}
run: python scripts/ci/select_checks.py

clock-preflight:
needs: static
if: github.event_name == 'pull_request' && github.event.pull_request.number == 633 && needs.static.result == 'success'
runs-on: ubuntu-22.04
timeout-minutes: 5
continue-on-error: true
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: '3.12'
- name: Install clock probe test runner
run: python -m pip install pytest==9.1.1
- name: Verify Linux clock interposition
env:
OPENDIRECTOR_CI_CLOCK_PREFLIGHT_REPORT: ${{ runner.temp }}/opencode-clock-preflight/preflight.json
run: |
mkdir -p "$RUNNER_TEMP/opencode-clock-preflight"
gcc --version | head -1
status=0
timeout --kill-after=5s 60s python -m pytest tests/test_opencode_clock_probe.py --noconftest -q || status=$?
printf 'exit_code\t%s\n' "$status" > "$RUNNER_TEMP/opencode-clock-preflight/status.tsv"
exit "$status"
- name: Upload clock preflight evidence
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: opencode-clock-preflight-${{ github.run_attempt }}
path: ${{ runner.temp }}/opencode-clock-preflight/
retention-days: 14
if-no-files-found: warn

opencode-version-comparison:
needs: static
if: github.event_name == 'pull_request' && github.event.pull_request.number == 633 && needs.static.result == 'success'
runs-on: ubuntu-22.04
timeout-minutes: 18
continue-on-error: true
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: '3.12'
- name: Install ripgrep
run: |
sudo apt-get update
sudo apt-get install --yes ripgrep
rg --version
- name: Compare bundled and stable OpenCode on diagnostic PR
timeout-minutes: 16
run: |
output="$RUNNER_TEMP/opencode-version-comparison"
mkdir -p "$output"
printf 'case\tlane\texit\n' > "$output/results.tsv"
bundled_url="$(python -c 'import json; print(json.load(open("package-lock.json"))["packages"]["node_modules/opencode-linux-x64"]["resolved"])')"
stable_url="https://registry.npmjs.org/@opencode/cli-linux-x64/-/cli-linux-x64-2.4.4.tgz"
fetch_binary() {
local url="$1" binary="$2"
curl --fail --silent --show-error --location --retry 2 --retry-max-time 90 --max-time 60 "$url" --output "$binary.tgz"
tar -xOzf "$binary.tgz" package/bin/opencode > "$binary"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

对照用的两个 npm tarball 目前只固定了 URL,解包后就直接执行。建议为两条 lane 都记录并校验对应版本的 integrity,再启动二进制;这样产物才能证明实际比较的是哪两份 build。

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

同意。当前下载固定了版本和 URL,尚未独立校验 tarball 的 integrity。a044c76d 的这轮还在下载阶段超时,没有产生版本对照结果。上一轮两版均通过独立夹具,结论仅限于此。

chmod +x "$binary"
}
bundled="$RUNNER_TEMP/opencode-bundled"
stable="$RUNNER_TEMP/opencode-stable"
fetch_binary "$bundled_url" "$bundled"
fetch_binary "$stable_url" "$stable"
"$bundled" --version | tee "$output/bundled-version.txt"
"$stable" --version | tee "$output/stable-version.txt"
index=0
failed=0
for lane in bundled stable stable bundled; do
index=$((index + 1))
binary="$bundled"
options=()
if [ "$lane" = stable ]; then
binary="$stable"
options=(--cli-v2)
fi
status=0
python scripts/ci/opencode_minimal_probe.py --binary "$binary" "${options[@]}" \
--repeats 1 --timeout 60 --fixture-shape --skill-first \
--report "$output/$index-$lane.json" || status=$?
printf '%s\t%s\t%s\n' "$index" "$lane" "$status" >> "$output/results.tsv"
if [ "$status" -ne 0 ]; then
failed=1
fi
done
exit "$failed"
- name: Upload OpenCode version comparison on diagnostic PR
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: opencode-version-comparison-${{ github.run_attempt }}
path: ${{ runner.temp }}/opencode-version-comparison/
retention-days: 14
if-no-files-found: warn

python:
needs: static
if: ${{ !cancelled() && ((needs.static.result == 'success' && needs.static.outputs.run-heavy != 'false') || (!inputs.static-checks && needs.static.result == 'skipped')) }}
Expand Down Expand Up @@ -103,12 +200,131 @@ jobs:
- name: Check generated contracts
if: always() && steps.install.outcome == 'success'
run: python scripts/generate_contracts.py --check
- id: diagnostic-ripgrep
name: Install diagnostic runtime tools
if: github.event_name == 'pull_request' && github.event.pull_request.number == 633 && steps.install.outcome == 'success'
timeout-minutes: 3
run: |
sudo apt-get install --yes ripgrep gdb
rg --version
gdb --version | head -1
echo 'OPENDIRECTOR_CI_NATIVE_STACK=1' >> "$GITHUB_ENV"
- name: Standalone OpenCode control on diagnostic PR
if: github.event_name == 'pull_request' && github.event.pull_request.number == 633 && steps.install.outcome == 'success'
timeout-minutes: 6
continue-on-error: true
run: |
binary="$(python -c 'from opendirector.agent.native import executable; print(executable("default") or "")')"
if [ -z "$binary" ]; then
echo "::error::Bundled OpenCode is missing"
exit 1
fi
python scripts/ci/opencode_minimal_probe.py --binary "$binary" \
--repeats 2 --timeout 60 --fixture-shape --skill-first \
--report test-results/opencode-diagnostics/standalone-control.json
- id: clock-observer
name: Build OpenCode clock observer on diagnostic PR
if: ${{ !cancelled() && github.event_name == 'pull_request' && github.event.pull_request.number == 633 && steps.diagnostic-ripgrep.outcome == 'success' }}
timeout-minutes: 1
continue-on-error: true
run: |
shim="$RUNNER_TEMP/opencode-clock-probe.so"
gcc -std=c11 -Wall -Wextra -Werror -O2 -shared -fPIC scripts/ci/opencode_clock_probe.c -ldl -o "$shim"
printf 'path=%s\n' "$shim" >> "$GITHUB_OUTPUT"
- name: Bundled OpenCode model gateway regression
if: always() && steps.install.outcome == 'success'
timeout-minutes: 5
env:
OPENDIRECTOR_REAL_CLI: '1'
OPENDIRECTOR_CI_TRACE_DIR: ${{ github.workspace }}/test-results/opencode-diagnostics
OPENDIRECTOR_CI_RUNNER_PRESSURE: ${{ github.event_name == 'pull_request' && github.event.pull_request.number == 633 && '1' || '0' }}
OPENDIRECTOR_CI_CLOCK_SHIM: ${{ steps.clock-observer.outputs.path }}
OD_CI_CLOCK_MODE: libc
run: python -m pytest tests/test_native_runtime.py tests/test_agent_visual_gate.py -k real_opencode -m cpu -q -ra --durations=50 --junitxml=test-results/bundled-opencode.xml --ci-profile=test-results/bundled-opencode.json
- name: Upload OpenCode runner pressure on diagnostic PR
if: ${{ always() && github.event_name == 'pull_request' && github.event.pull_request.number == 633 && steps.install.outcome == 'success' }}
continue-on-error: true
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: opencode-runner-pressure-${{ github.run_attempt }}
path: test-results/opencode-diagnostics/
retention-days: 14
if-no-files-found: warn
- name: Compare OpenCode snapshots with libc observation on diagnostic PR
if: ${{ !cancelled() && github.event_name == 'pull_request' && github.event.pull_request.number == 633 && steps.diagnostic-ripgrep.outcome == 'success' }}
timeout-minutes: 6
continue-on-error: true
env:
OPENDIRECTOR_REAL_CLI: '1'
OD_CI_CLOCK_MODE: libc
OPENDIRECTOR_CI_CLOCK_SHIM: ${{ steps.clock-observer.outputs.path }}
OPENCODE_DISABLE_MODELS_FETCH: '1'
run: |
evidence="$RUNNER_TEMP/opencode-clock-evidence"
mkdir -p "$evidence"
if [ -d test-results/opencode-diagnostics ]; then
cp -R test-results/opencode-diagnostics "$evidence/integrated"
fi
printf 'trial\texit_code\telapsed_seconds\tgit_starts\twrite_tree_starts\tclockSource\taheadCount\tmaxAheadMs\n' > "$evidence/results.tsv"
printf 'stage\texit_code\n' > "$evidence/preflight.tsv"
status=0
OPENDIRECTOR_CI_CLOCK_PREFLIGHT_REPORT="$evidence/preflight.json" \
python -m pytest tests/test_opencode_clock_probe.py --noconftest -q || status=$?
printf 'clock_tests\t%s\n' "$status" >> "$evidence/preflight.tsv"
if [[ "$status" != 0 ]]; then exit "$status"; fi
[[ -f "$OPENDIRECTOR_CI_CLOCK_SHIM" ]] || status=$?
printf 'clock_compile\t%s\n' "$status" >> "$evidence/preflight.tsv"
if [[ "$status" != 0 ]]; then exit "$status"; fi
export BUN_JSC_useJIT=1
for trial in 01-on 02-off 03-off 04-on; do
export OPENDIRECTOR_CI_SNAPSHOT="${trial#*-}"
export OPENDIRECTOR_CI_TRACE_DIR="$evidence/$trial"
basetemp="$RUNNER_TEMP/opencode-clock-$trial"
started=$SECONDS
result=0
timeout --kill-after=5s 85s python -m pytest -q --tb=short \
--basetemp "$basetemp" \
'tests/test_native_runtime.py::test_real_opencode_default_hello_saves_direct_reply[thinking]' || result=$?
elapsed=$((SECONDS - started))
counts="$(find "$basetemp" -name process-boundaries.log -type f -exec cat {} + |
awk '$2 == "git.start" { git++; if ($4 == "write-tree") snapshots++ } END { printf "%d\t%d", git, snapshots }')"
resolved="$(find "$basetemp" -name process-boundaries.log -type f -exec cat {} + |
awk '$2 == "opencode.clock" { print $4 }' | sort -u)"
ahead="$(find "$basetemp" -name process-boundaries.log -type f -exec cat {} + |
awk '$2 == "opencode.clockAhead" { n++; if ($4 > max) max=$4 } END { printf "%d\t%d", n, max }')"
if [[ "$resolved" != libc ]]; then
echo '::error::OpenCode clock route verification failed'
if [[ "$result" == 0 ]]; then result=1; fi
fi
printf '%s\t%s\t%s\t%s\t%s\t%s\n' "$trial" "$result" "$elapsed" "$counts" "$resolved" "$ahead" | tee -a "$evidence/results.tsv"
if [[ "$result" == 124 || "$result" == 137 ]]; then
exit "$result"
fi
done
- name: Upload OpenCode clock comparison
if: ${{ always() && github.event_name == 'pull_request' && github.event.pull_request.number == 633 && steps.diagnostic-ripgrep.outcome == 'success' }}
continue-on-error: true
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: opencode-clock-comparison-${{ github.run_attempt }}
path: ${{ runner.temp }}/opencode-clock-evidence/
retention-days: 14
if-no-files-found: warn
- name: Compare Node and Bun child processes on diagnostic PR
if: ${{ !cancelled() && github.event_name == 'pull_request' && github.event.pull_request.number == 633 && steps.install.outcome == 'success' }}
timeout-minutes: 3
continue-on-error: true
run: |
evidence=test-results/opencode-diagnostics
mkdir -p "$evidence"
probe=scripts/ci/opencode_child_process_probe.mjs
status=0
timeout --kill-after=5s 45s node "$probe" > "$evidence/child-process-node.jsonl" || status=$?
bun_root="$RUNNER_TEMP/opencode-bun-control"
timeout --kill-after=5s 45s npm install --prefix "$bun_root" --ignore-scripts --no-package-lock --no-audit --no-fund @oven/bun-linux-x64@1.4.4
bun="$bun_root/node_modules/@oven/bun-linux-x64/bin/bun"
timeout --kill-after=5s 45s "$bun" "$probe" > "$evidence/child-process-bun.jsonl" || status=$?
exit "$status"
- id: harness-install
name: Install native Harness test tools
if: always() && steps.install.outcome == 'success'
Expand Down
20 changes: 20 additions & 0 deletions docs/development/validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,26 @@ Python CI 为全量套件和独立 bundled OpenCode 回归分别保存 JUnit XML

Python CI saves separate JUnit XML, `--durations=50` logs and opt-in `--ci-profile` JSON/Markdown for the main suite and bundled OpenCode regression. Download `python-test-evidence-<attempt>` from the run; retention is 14 days. JSON records SHA, OS, Python/pytest versions, selection, per-test setup/call/teardown timings, outcomes, explicit layers and transitional defaults. It excludes stdout, failure text and local variables.

内置 OpenCode 回归的子进程失败时,同一产物的 `opencode-diagnostics/` 会保存筛选后的模型、工具和 OpenCode 内部事件,以及 Linux 上 Bash、Git 与业务网关调用的起止时间。时间以首次保留事件为起点,`droppedEvents` 标记因数量上限省略的事件数。报告不包含原始日志、模型或工具内容、凭据或文件路径。

If a bundled OpenCode regression worker fails, look in `opencode-diagnostics/` in the same artifact for allowlisted model, tool and OpenCode events, plus Bash, Git and business gateway boundaries on Linux. Time is relative to the first retained event. `droppedEvents` counts events omitted by the cap. Reports exclude raw logs, model or tool content, credentials and file paths.

Linux watchdog 还采样最近 8 个 Git 包装进程的状态和父进程归属,通过 `span` 关联起止事件。`git.exit` 只表示包装脚本到达退出前的记录点;`git.watchdog` 的 `Z` 表示采样时已退出但尚未回收,`gone` 表示原 PID 已不存在。PID 可能复用,因此其他存活状态不能单独证明原进程仍在运行。

The Linux watchdog also samples the last eight Git wrapper process states and parent roles, linked to start/exit events by `span`. `git.exit` only marks the wrapper's pre-exit logging point; watchdog state `Z` means exited but unreaped at sampling time, while `gone` means the PID no longer exists. PIDs can be reused, so other live states alone do not prove that the original process remains alive.

清理前的 `opencode.cpu` 在约 200 毫秒窗口内记录主线程及整个进程的 CPU tick 增量,同时保存实际窗口长度和每秒 tick 数。两端进程启动时间必须一致;不可读、已退出或身份变化的样本不导出。CPU 活跃并不能单独证明 JavaScript 忙循环;采样会使超时后的清理延迟约 200 毫秒。

Before cleanup, `opencode.cpu` records main-thread and whole-process CPU tick deltas over an approximately 200 ms window, together with actual sample duration and ticks per second. Process start times must match across samples; unreadable, exited or changed identities are omitted. CPU activity alone does not establish a JavaScript busy loop. Sampling delays timeout cleanup by approximately 200 ms.

仅在诊断 PR 显式开启 `OPENDIRECTOR_CI_NATIVE_STACK=1` 时,watchdog 在清理前通过 GDB 采样最后一个 CLI 的主线程原生栈。调试器禁止自动加载和符号下载,由独立的 3 秒硬超时限制,调用方另有 5 秒超时;正常采样后解除附加。报告仅保留最多 20 帧的深度及受限运行时符号,其他符号标记为 unknown;不保存原始 GDB 输出、地址、参数、路径或内存。附加会短暂停止进程,原生栈不等于 JavaScript 调用栈,缺失符号不能证明对应代码未执行。

Only when the diagnostic PR explicitly enables `OPENDIRECTOR_CI_NATIVE_STACK=1`, the watchdog samples the last CLI's main native thread with GDB before cleanup. Auto-loading and symbol downloads are disabled; an independent three-second hard timeout bounds GDB, with a five-second caller timeout. Normal sampling detaches. Reports retain at most 20 frame depths and restricted runtime symbols, mapping other symbols to unknown; raw GDB output, addresses, arguments, paths and memory are not saved. Attaching briefly pauses the process. Native frames are not a JavaScript stack, and missing symbols do not establish that corresponding code was absent.

单调时钟诊断仅通过测试夹具为 CLI 设置 `OPENDIRECTOR_CI_CLOCK_SHIM`。两种模式都比较 libc 与随后直接系统调用的 `CLOCK_MONOTONIC` 读数;`libc` 返回原值,`syscall` 返回系统调用的值。首次实际调用记录路径选择,最多记录 8 次 libc 比系统调用领先至少 10 毫秒的偏差。该包装会增加时钟调用开销;没有偏差记录不能排除漏采或其他运行时原因。已知未来读数的注入只发生在独立 C 驱动测试中,不用于 OpenCode 集成对照。

Monotonic clock diagnosis sets `OPENDIRECTOR_CI_CLOCK_SHIM` on the CLI through the test fixture only. Both modes compare libc's `CLOCK_MONOTONIC` reading with a subsequent direct syscall; `libc` returns the original value and `syscall` returns the kernel value. The first actual call records the route; at most eight libc readings at least 10 ms ahead are recorded. Wrapping adds clock-call overhead. No recorded discrepancy does not exclude missed anomalies or other runtime causes. A known future reading is injected only in the standalone C driver test, never in the OpenCode integration comparison.

```sh
python -m pytest tests -q -ra --durations=50 --junitxml=test-results/python.xml --ci-profile=test-results/python.json
```
Expand Down
Loading
Loading