Skip to content

refactor(opencode-go): localize stream internals#101440

Merged
vincentkoc merged 1 commit into
mainfrom
refactor/deadcode-native-sweep-20260707-v31
Jul 7, 2026
Merged

refactor(opencode-go): localize stream internals#101440
vincentkoc merged 1 commit into
mainfrom
refactor/deadcode-native-sweep-20260707-v31

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

What Problem This Solves

OpenCode Go still exposed four declarations that are used only inside their defining modules. This made private stream and live-catalog implementation details look like supported extension surfaces and kept them in unused-export reports.

Why This Change Was Made

Localize the two stream wrapper helpers and the two parameter types without changing their implementations, callers, runtime behavior, or the plugin's public api.ts surface.

User Impact

No user-visible behavior changes. Maintainers get a narrower private implementation surface and cleaner dead-code reports.

Evidence

  • AI-assisted: yes.
  • Full codebase-memory graph refreshed at e024eacf176caf103101de3c37bd81f596652379: 277,997 nodes and 1,120,665 edges.
  • Graph incoming-edge query found only same-file DEFINES, USAGE, and CALLS edges for all four declarations.
  • Blacksmith Testbox tbx_01kwxnhj0z18r2rzxyme4jr51c:
    • corepack pnpm test extensions/opencode-go - 5 files, 29 tests passed.
    • corepack pnpm check:changed - extension production/test typecheck, lint, guards, and import cycles passed.
    • corepack pnpm deadcode:report:ci:ts-unused - zero remaining matches for the four declarations.
  • oxfmt --check and git diff --check passed.
  • Fresh post-rebase autoreview: no accepted/actionable findings; patch correct, confidence 0.90.

@vincentkoc vincentkoc self-assigned this Jul 7, 2026
@vincentkoc
vincentkoc force-pushed the refactor/deadcode-native-sweep-20260707-v31 branch from 01eab13 to bb7e544 Compare July 7, 2026 07:01
@vincentkoc
vincentkoc force-pushed the refactor/deadcode-native-sweep-20260707-v31 branch from bb7e544 to f359a9f Compare July 7, 2026 07:02
@vincentkoc
vincentkoc marked this pull request as ready for review July 7, 2026 07:03
@clawsweeper

clawsweeper Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 7, 2026, 3:11 AM ET / 07:11 UTC.

Summary
The branch removes exports from four OpenCode Go private stream and live-catalog declarations while leaving runtime behavior and the plugin public API unchanged.

PR surface: Source 0. Total 0 across 3 files.

Reproducibility: not applicable. this is an internal cleanup PR, not a reported runtime bug. Source search confirms the localized declarations are not used as external call sites on current main.

Review metrics: none identified.

Merge readiness
Overall: 🦞 diamond lobster
Proof: 🦞 diamond lobster
Patch quality: 🦞 diamond lobster
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Risk before merge

  • [P1] The branch is behind current main; final landing should use refreshed exact-head CI or the merge queue rather than relying only on earlier PR-head checks.

Maintainer options:

  1. Decide the mitigation before merge
    Land the narrow export-localization after normal maintainer merge handling, keeping OpenCode Go public surface through api.ts and plugin SDK seams only.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P2] No repair job is appropriate; the PR is already a bounded maintainer cleanup and the remaining action is normal review and merge handling.

Security
Cleared: The diff only removes TypeScript exports from existing private OpenCode Go declarations and does not touch dependencies, workflows, secrets, install scripts, or code execution surfaces.

Review details

Best possible solution:

Land the narrow export-localization after normal maintainer merge handling, keeping OpenCode Go public surface through api.ts and plugin SDK seams only.

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

Not applicable; this is an internal cleanup PR, not a reported runtime bug. Source search confirms the localized declarations are not used as external call sites on current main.

Is this the best way to solve the issue?

Yes; localizing declarations in their defining modules is the narrowest maintainable fix because api.ts remains unchanged and callers stay local.

AGENTS.md: found and applied where relevant.

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

Label changes

Label changes:

  • add P3: This is a low-risk internal cleanup that narrows private OpenCode Go implementation exports without changing user-visible behavior.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Maintainer-authored private export cleanup; the external contributor proof gate does not apply, and the PR body/CI provide source-level validation for the intended cleanup.

Label justifications:

  • P3: This is a low-risk internal cleanup that narrows private OpenCode Go implementation exports without changing user-visible behavior.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Maintainer-authored private export cleanup; the external contributor proof gate does not apply, and the PR body/CI provide source-level validation for the intended cleanup.
Evidence reviewed

PR surface:

Source 0. Total 0 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 3 4 4 0
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 4 4 0

What I checked:

  • PR diff is export-only: The patch only changes export type/export interface/export function declarations to non-exported declarations across three OpenCode Go files. (extensions/opencode-go/stream.ts:19, f359a9ff950b)
  • Current main still exposes the internals: Current main exports the stream helper declarations that this PR localizes, so the cleanup is not already implemented on main. (extensions/opencode-go/stream.ts:19, d8ffb1f30746)
  • Public plugin API stays unchanged: The OpenCode Go public api.ts barrel only exports onboarding config helpers, not the stream helpers or live-catalog parameter type touched by this PR. (extensions/opencode-go/api.ts:1, d8ffb1f30746)
  • No external call sites found: A repo-wide symbol search found the changed declarations only at their definitions and local same-module call sites; the public wrapper and catalog functions remain exported. (extensions/opencode-go/stream.ts:57, d8ffb1f30746)
  • Extension boundary policy supports the cleanup: Scoped extension policy treats local helpers as private unless promoted through api.ts or a plugin SDK facade, so removing incidental module exports does not remove a public plugin API. (extensions/AGENTS.md:42, d8ffb1f30746)
  • Relevant checks are green: Live PR status shows successful check-prod-types, check-lint, extension boundary checks, and real-behavior-proof workflow entries for this head. (f359a9ff950b)

Likely related people:

  • steipete: Recent OpenCode Go stream and provider-catalog history includes multiple current-main commits by this author, including DeepSeek/Kimi/base URL work in the same files. (role: area contributor; confidence: high; commits: afd6b5d6fce1, 1713930bbe40, 715dc718fc5a; files: extensions/opencode-go/stream.ts, extensions/opencode-go/provider-catalog.ts)
  • zhangguiping-xydt: GitHub commit history shows the provider-owned stalled stream wrapper was added in the merged OpenCode Go streaming fix that owns the stream-termination surface. (role: introduced stream termination behavior; confidence: high; commits: 769579bcf0c2; files: extensions/opencode-go/stream-termination.ts, extensions/opencode-go/stream.ts)
  • fuller-stack-dev: The live provider catalog helper refactor routed OpenCode Go live discovery through the shared helper and is directly related to the localized live-catalog parameter type. (role: adjacent live-catalog owner; confidence: medium; commits: 57e0bdaabe0a; files: extensions/opencode-go/provider-catalog.ts)
  • vincentkoc: Beyond authoring this PR, the current-main history records co-author credit on the recent OpenCode Go stream-termination regression fix. (role: recent adjacent stream contributor; confidence: medium; commits: 552ec2b49d4a; files: extensions/opencode-go/stream-termination.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.

@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Jul 7, 2026
@vincentkoc

Copy link
Copy Markdown
Member Author

Land-ready proof for head f359a9ff950ba06ee587ed644ea06f2eb2868780:

  • Exact-head CI passed: https://github.com/openclaw/openclaw/actions/runs/28847967925
  • Blacksmith Testbox tbx_01kwxnhj0z18r2rzxyme4jr51c:
    • pnpm test extensions/opencode-go: 5 files, 29 tests passed.
    • pnpm check:changed: extension production/test typecheck, lint, guards, and import cycles passed.
    • pnpm deadcode:report:ci:ts-unused: zero remaining matches for the four localized declarations.
  • Full codebase-memory graph: 277,997 nodes, 1,120,665 edges; incoming-edge proof found only same-file definitions/usages/calls.
  • oxfmt --check and git diff --check passed.
  • Fresh Codex autoreview (gpt-5.5, high): no accepted/actionable findings, confidence 0.90.
  • Repo-native review artifacts validated with zero findings and READY FOR /prepare-pr.
  • OPENCLAW_TESTBOX=1 scripts/pr prepare-run 101440 passed and verified the remote PR head tree.

Main advanced after the reviewed merge base. I inspected cb9de7d361a..d09469c7a6b: none of the seven commits touch the three changed extension files; the only OpenCode-related file is src/agents/context.opencode-go.test.ts. The PR remains mergeable, with no code overlap or unresolved proof gap.

@vincentkoc
vincentkoc merged commit 7c55ce5 into main Jul 7, 2026
166 of 169 checks passed
@vincentkoc
vincentkoc deleted the refactor/deadcode-native-sweep-20260707-v31 branch July 7, 2026 07:16
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

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: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant