Skip to content

test(opencode-go): consolidate stream termination harness - #118317

Merged
steipete merged 1 commit into
mainfrom
codex/goal100k-opencode-stream-fixture-wave21-2d45
Aug 3, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/goal100k-opencode-stream-fixture-wave21-2d45

Conversation

@steipete

@steipete steipete commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • extract a typed, file-local stream harness for the OpenCode Go stalled-stream regression suite
  • keep every case-specific event script, timeout, model override, caller signal, and assertion visible
  • remove 233 net test LOC with zero production behavior or production LOC change

Root cause and owner boundary

The suite repeated the same fake stream, wrapped provider, abort observer, and async consumer setup across every timeout regression. That duplicated lifecycle policy in test plumbing and made neighboring cases easier to drift.

The canonical fix stays local to extensions/opencode-go/stream-termination.test.ts: one harness owns only fixture construction and one helper drains an AsyncIterable. The production owner remains extensions/opencode-go/stream-termination.ts; registration and wrapper ordering in extensions/opencode-go/index.ts and extensions/opencode-go/stream.ts are unchanged. No compatibility path, fallback, production abstraction, config, schema, or dependency changed.

Parity

  • identical 12 ordered test titles
  • identical 43 ordered matcher assertions and arguments
  • identical 2 fake-timer lifecycle hooks
  • preserved provider-owned/caller-owned abort behavior and exact abort reason identity
  • preserved first-event versus inter-event timeout precedence, request timeout overrides, synthetic-start behavior, block-boundary rearming, pending stream creation timeout, terminal errors, and iterator release

Validation

  • Blacksmith focused: extensions/opencode-go/stream-termination.test.ts — 12/12 passed
  • Blacksmith full plugin: pnpm test extensions/opencode-go — 38/38 passed across 5 files
  • Blacksmith changed gate: passed, including extension-test tsgo, oxlint, formatting, dead-export, duplicate-coverage, dependency, and plugin-boundary checks
  • git diff --check: passed
  • latest-main owner-stack drift: none; synthetic merge succeeded
  • two independent xhigh exact-head reviews: CLEAN; best-fix approved
  • central live collision audit through 2026-08-03T00:03:18.909Z: zero open PR matches

Dependency contract proof

OpenAI SDK 6.49.0 source confirms request AbortSignal forwarding and stream reader cancellation on iterator exit in node_modules/openai/src/client.ts, node_modules/openai/src/core/streaming.ts, and node_modules/openai/src/internal/stream-utils.ts.

The sibling Codex checkout was inspected directly at ee0247f95a6fe2b094ba2253d82cae2a2b4c2dff: provider timeout defaults in ../codex/codex-rs/model-provider-info/src/lib.rs; auth snapshot/refresh ownership in ../codex/codex-rs/login/src/auth/manager.rs; provider/auth session wiring in ../codex/codex-rs/core/src/thread_manager.rs and ../codex/codex-rs/core/src/session/session.rs; SSE timeout/terminal behavior in ../codex/codex-rs/codex-client/src/sse.rs and ../codex/codex-rs/codex-api/src/sse/responses.rs. No contract conflict was found.

LOC

  • tests: +114 / -347, net -233
  • production: 0 / 0

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Aug 3, 2026
@clawsweeper

clawsweeper Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 2, 2026, 8:12 PM ET / August 3, 2026, 00:12 UTC.

ClawSweeper review

What this changes

This PR consolidates repeated OpenCode Go stalled-stream test setup and async stream draining into local helpers in extensions/opencode-go/stream-termination.test.ts.

Merge readiness

⛔ Blocked until real behavior proof from a real setup is added - 5 items remain

Keep this PR open for protected maintainer review. Source review found no blocking correctness defect: the new file-local harness preserves the 12 test titles and 43 matcher calls while leaving the production stream wrapper untouched; however, the external-PR proof gate is not met and live GitHub metadata could not be refreshed.

Priority: P3
Reviewed head: c84af9bd8d5c9177f8dbcd18635b0cefae0267d7
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The test refactor is focused and source-consistent, but external real-behavior proof is currently only asserted through tests and CI.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: The PR body reports focused and plugin test runs, but it provides no attached redacted terminal output, recording, log, or artifact showing the after-refactor behavior at the reviewed head; add that proof before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The PR body reports focused and plugin test runs, but it provides no attached redacted terminal output, recording, log, or artifact showing the after-refactor behavior at the reviewed head; add that proof before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 5 items Focused test-only diff: The PR changes only the stream-termination test file, adding a typed local harness and stream consumer; no runtime, dependency, config, or SDK file is changed.
Current-main comparison: Current main at 51548dd retains the base test blob 8548bf768b, while the PR head uses blob 425943f7fd; the cleanup is not already present on main.
Regression-case parity: The ordered test-title digest is identical before and after the refactor, and both revisions contain 43 expect calls; the helper forwards per-case model, call options, and timeout overrides rather than moving those decisions into production code.
Findings None None.
Security None None.

How this fits together

The OpenCode Go provider wraps raw OpenAI-compatible SSE streams so provider-scoped first-event and idle timeouts abort stalled requests and emit a terminal error. The changed suite supplies scripted stream events to that wrapper and checks cancellation, timeout precedence, completion, and iterator release.

flowchart LR
  A[OpenAI-compatible provider stream] --> B[OpenCode Go stream wrapper]
  B --> C[First-event and idle timers]
  C --> D[Abort or terminal event]
  D --> E[Downstream consumer]
  F[Scripted regression events] --> G[File-local test harness]
  G --> B
  G --> E
Loading

Decision needed

Question Recommendation
After exact-head proof is attached and the active checks complete, should this maintainer-labeled test-only cleanup be accepted without expanding its scope into the runtime wrapper? Review after proof: Accept the local harness only after a redacted focused-test transcript confirms the refactored suite passes at the reviewed head.

Why: The protected maintainer label prevents automated cleanup, while the source review found no mechanical repair or product-direction choice to resolve automatically.

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The PR body reports focused and plugin test runs, but it provides no attached redacted terminal output, recording, log, or artifact showing the after-refactor behavior at the reviewed head; add that proof before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve merge risk (P1) - No attached exact-head terminal output, recording, or redacted runtime log demonstrates the after-refactor behavior; the PR body only reports test and CI results.
  • Resolve merge risk (P1) - The supplied GitHub timestamps are ahead of the August 2, 2026 review date, and DNS prevented a live refresh, so the current check and discussion state remains unverified.
  • Complete next step (P2) - The protected maintainer label and missing posted exact-head proof require an explicit maintainer review; no mechanical repair is identified.
Agent review details

Security

None.

PR surface

Tests -233. Total -233 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 114 347 -233
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 114 347 -233

Review metrics

None.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep the fixture abstraction file-local, attach redacted exact-head focused-test proof, and let a maintainer review it once the active checks finish.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep the fixture abstraction file-local, attach redacted exact-head focused-test proof, and let a maintainer review it once the active checks finish.

Do we have a high-confidence way to reproduce the issue?

Not applicable: this PR refactors existing regression-test plumbing rather than reporting a separate user-facing failure. Source comparison establishes that the production timeout and abort path is unchanged.

Is this the best way to solve the issue?

Yes, subject to exact-head proof: a file-local harness is the narrowest maintainable place to remove duplicated fixture lifecycle setup, and it leaves the provider-owned runtime wrapper unchanged.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 51548dd7e1a0.

Labels

Label changes:

  • add P3: This is a focused test-maintenance refactor with no production behavior, configuration, dependency, or persisted-state change.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body reports focused and plugin test runs, but it provides no attached redacted terminal output, recording, log, or artifact showing the after-refactor behavior at the reviewed head; add that proof before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Label justifications:

  • P3: This is a focused test-maintenance refactor with no production behavior, configuration, dependency, or persisted-state change.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body reports focused and plugin test runs, but it provides no attached redacted terminal output, recording, log, or artifact showing the after-refactor behavior at the reviewed head; add that proof before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

  • Focused test-only diff: The PR changes only the stream-termination test file, adding a typed local harness and stream consumer; no runtime, dependency, config, or SDK file is changed. (extensions/opencode-go/stream-termination.test.ts:98, c84af9bd8d5c)
  • Current-main comparison: Current main at 51548dd retains the base test blob 8548bf768b, while the PR head uses blob 425943f7fd; the cleanup is not already present on main. (extensions/opencode-go/stream-termination.test.ts:98, 51548dd7e1a0)
  • Regression-case parity: The ordered test-title digest is identical before and after the refactor, and both revisions contain 43 expect calls; the helper forwards per-case model, call options, and timeout overrides rather than moving those decisions into production code. (extensions/opencode-go/stream-termination.test.ts:107, c84af9bd8d5c)
  • Production owner remains unchanged: The provider-scoped wrapper owns timeout resolution, composed abort signals, and stalled-stream termination; current-main and local-main blobs for both runtime files match, while the PR does not alter them. (extensions/opencode-go/stream-termination.ts:177, a1c2009b91b9)
  • Live review limitation: The supplied GitHub snapshot is dated 2026-08-03T00:06:10Z, which is after the review date of 2026-08-02, and live GitHub reads failed because api.github.com could not be resolved. The exact local PR and current-main objects remained available for source comparison, but the running checks and discussion could not be independently refreshed.

Likely related people:

  • steipete: The current wrapper and the pre-refactor regression tests are blamed to Peter Steinberger's current-main commit, and the proposed test cleanup is also authored by steipete. (role: current stream-termination feature and test author; confidence: medium; commits: a1c2009b91b9, c84af9bd8d5c; files: extensions/opencode-go/stream-termination.ts, extensions/opencode-go/stream-termination.test.ts, extensions/opencode-go/stream.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Attach redacted terminal output from the exact-head extensions/opencode-go/stream-termination.test.ts run.
  • Update the PR body with that artifact; the proof update should trigger a fresh review, or a maintainer can request @clawsweeper re-review if it does not.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit 443821f into main Aug 3, 2026
95 of 102 checks passed
@steipete
steipete deleted the codex/goal100k-opencode-stream-fixture-wave21-2d45 branch August 3, 2026 02:35
@steipete

steipete commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: opencode-go maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: M status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant