Skip to content

refactor: consolidate command and provider helpers - #140072

Merged
steipete merged 3 commits into
mainfrom
codex/deslop-command-diagnostics
Sep 6, 2026
Merged

steipete merged 3 commits into
mainfrom
codex/deslop-command-diagnostics

Conversation

@steipete

@steipete steipete commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Command rendering and diagnostics retained duplicate plumbing, and OpenCode Zen and Go separately interpreted the same reasoning-effort metadata. This maintenance batch consolidates those owners while preserving their existing output and operator flows.

Why This Change Was Made

Update reporting now calls the existing styled prompts and report functions directly, removing a dependency bag used only by tests. Both Telegram provider-menu hooks reuse the existing provider renderer. Warning deduplication uses its Set's insertion order instead of maintaining a second FIFO array. The two OpenCode policies share a small effort-profile helper with no runtime imports; their model overrides, provider admission, and API fallbacks stay local and unchanged.

The report flow retains sanitized preview, default-false confirmation, fresh choice after retry, and durable cross-surface receipts. Telegram keeps both public hooks, callback bytes, keyboard order and empty-list fallback. Warnings retain the 256-entry FIFO and do not refresh duplicates. Effort profiles preserve exact spelling, order, deduplication, defaults, and the distinction between absent metadata and an explicit off-only result.

Runtime TypeScript is 74 lines smaller. Registration metadata adds 12 lines, so production is net −62. Existing tests gain 83 lines and docs gain 10; two obsolete guard-inventory entries are removed; the complete 19-file diff is +29 lines. No configuration option, schema, external dependency, or third-party typed API is added.

User Impact

No intentional change to menu choices, reporting behavior, warnings, or thinking defaults. There is one new private official-plugin runtime entry, documented alongside provider policy hooks.

Separately published OpenCode plugins gain a host SDK dependency. This change must ship with the next synchronized core/plugin release, whose existing release sync advances their plugin API floors. It must not be published independently with the current older API floor. No version or compatibility-floor change is made here; release preparation and installer enforcement retain their existing ownership.

Evidence

Final source: e9970d6416b535aca3ba9f8cab96ddcc0b1a7c1c.

  • 236 focused tests passed: 139 command/Telegram/warning/receipt tests plus 97 provider/artifact/install/release tests. The new provider preservation cases also passed on the original implementations. The existing CLI/Gateway matrix still uses real report preparation and SQLite receipts with the existing mocked GitHub transport.
  • The Gateway report suite passed all 23 cases before and after: 31.02s / 2,091,204,608-byte max RSS before; 24.51s / 2,092,367,872-byte max RSS after. These single runs establish comparable scope, not a performance claim.
  • Independent P0–P2 review of the complete final diff found no actionable issue.
  • Full final-commit build passed in 4m57s, including SDK export checks and built control-plane loading. The emitted Telegram entrypoint passed four exact public-hook payload checks in network-denied synthetic state, with stable source/build fingerprints.
  • Original and final emitted OpenCode policy artifacts each passed 72 explicit cases in separate cold processes, with identical complete output tables. Actual module-load tracing found no forbidden transport or registration owner; source/build fingerprints remained stable.
  • Both canonical package-local builds passed. Staged packages use canonical manifest augmentation and peer links, then plain Node package exports; they resolve the exact new host SDK export and pass the same 72-case fixture with baseline parity. The sandbox denies networking and confines writes to synthetic state. This proves the candidate host only.
  • The complete final changed gate passed: SDK exports/surface, package boundaries, docs, all typecheck lanes, full lint and zero runtime import cycles. It first identified the two obsolete assertion allowances; those were pruned canonically and independently reviewed without changing runtime or test source. Required exact-head CI also passed: run 34031010753, including openclaw/ci-gate.

Review Follow-through

ClawSweeper found no actionable correctness or security issue. Its remaining compatibility move is resolved by selecting the recommended synchronized core/plugin release. The new host dependency is recorded in the commit and this PR; canonical release preparation advances both plugin API floors before publication, and the installer rejects older hosts. No independent plugin publication with the current older floor is authorized or planned. The final package-level proof exercises this exact candidate host, without claiming compatibility with older releases.

Keep model overrides and API fallbacks in their provider owners. The shared helper has no runtime imports so eager policy loading retains its narrow dependency graph.

Official plugin packages gain a host runtime dependency. Publish this with the next synchronized core and plugin release, whose canonical release sync advances pluginApi floors; do not publish these plugins alone with the existing older API floor.
@clawsweeper

clawsweeper Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: telegram Channel integration: telegram gateway Gateway runtime cli CLI command changes scripts Repository scripts agents Agent runtime and tooling extensions: opencode extensions: opencode-go extensions: xai size: M maintainer Maintainer-authored PR labels Sep 6, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 6, 2026
@clawsweeper

clawsweeper Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 6, 2026, 7:48 AM ET / 11:48 UTC.

ClawSweeper review

What this changes

Consolidates Telegram provider-menu rendering, update-report prompts, warning deduplication, and OpenCode reasoning-effort parsing while preserving their existing behavior.

Merge readiness

⛔ Blocked before merge - 1 item remains

The refactor remains useful and has no identified blocking correctness defect. The earlier compatibility concern is explicitly addressed by the documented synchronized-release plan and existing release tooling.

Priority: P3
Reviewed head: e9970d6416b535aca3ba9f8cab96ddcc0b1a7c1c

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A sound consolidation with useful preservation coverage and an explicitly documented release compatibility constraint.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-authored preservation refactor is exempt from the external-contributor proof gate and introduces no material authority change; reported emitted-artifact parity checks exercise the changed Telegram renderer and OpenCode policy entrypoints on the candidate host.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-authored preservation refactor is exempt from the external-contributor proof gate and introduces no material authority change; reported emitted-artifact parity checks exercise the changed Telegram renderer and OpenCode policy entrypoints on the candidate host.
Evidence reviewed 8 items Pinned change and review continuity: The introduced delta is merge-base 626bd72 to the reviewed head. Compared with the previous reviewed head, the only follow-up removes two obsolete assertion-baseline entries; runtime and test sources are unchanged. The supplied previous review contains no findings.
Work remains distinct from current main: The fetched main still contains the local OpenCode effort parser, update-report dependency bag, and separate warning-order array. No supplied related item establishes a merged replacement. The latest-release package blob could not be read because its retrieval required unavailable network access; no shipped-fix claim is made.
Provider behavior and package boundary: The new helper preserves exact effort spelling, ordering, deduplication, absence handling, and default preference. Both provider policies retain their overrides and fallbacks. Registration includes the root export, private-subpath inventory, build entrypoint, and package-boundary paths. This is an OpenClaw-owned helper with no runtime imports; the changed behavior does not depend on the Codex implementation.
Findings None None.
Security None None.

How this fits together

These helpers turn provider metadata and operator actions into thinking choices, Telegram keyboards, diagnostics, and update reports. The shared provider helper also becomes a runtime dependency of separately published OpenCode plugins.

flowchart LR
  A[Provider metadata] --> B[Shared effort parser]
  B --> C[Thinking choices]
  D[Provider menu requests] --> E[Telegram keyboard renderer]
  F[Failed update action] --> G[Preview and confirmation]
  G --> H[Report submission]
Loading

Before merge

  • Resolve merge risk (P1) - Independent publication of either changed OpenCode plugin with its current API floor could admit an older host lacking the new export and fail policy loading; the explicitly documented synchronized release mitigates this risk.
Agent review details

Security

None.

PR surface

Source -71, Tests +83, Docs +10, Config +7, Other 0. Total +29 across 19 files.

View PR surface stats
Area Files Added Removed Net
Source 8 47 118 -71
Tests 5 130 47 +83
Docs 1 10 0 +10
Config 2 8 1 +7
Generated 0 0 0 0
Other 3 2 2 0
Total 19 197 168 +29

Review metrics

Metric Value Why it matters
Host runtime dependency 1 new private SDK subpath used by 2 published plugins The shared helper makes synchronized host/plugin release compatibility relevant despite unchanged provider output.

Merge-risk options

Maintainer options:

  1. Use the documented synchronized release (recommended)
    Accept the new private SDK dependency under the stated core/plugin release plan, with release preparation advancing both plugin API floors before publication.

Technical review

Best possible solution:

Keep the consolidated helpers and preserved behavior, shipping the OpenCode packages with the synchronized host release and its canonically advanced plugin API floors.

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

Not applicable: this is a preservation refactor, and source inspection found no introduced failure requiring reproduction; tests were not executed during this read-only review.

Is this the best way to solve the issue?

Yes: it reuses existing renderers and report functions and centralizes identical provider parsing without moving provider-specific policy; the declared release path handles the added host dependency.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 1421c2164075.

Labels

Label justifications:

  • P3: This is behavior-preserving maintenance without an identified urgent user-facing defect.
  • merge-risk: 🚨 compatibility: The OpenCode packages gain a host runtime export dependency whose minimum supported version must follow the documented synchronized-release plan.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The maintainer-authored preservation refactor is exempt from the external-contributor proof gate and introduces no material authority change; reported emitted-artifact parity checks exercise the changed Telegram renderer and OpenCode policy entrypoints on the candidate host.

Evidence

What I checked:

  • Pinned change and review continuity: The introduced delta is merge-base 626bd72 to the reviewed head. Compared with the previous reviewed head, the only follow-up removes two obsolete assertion-baseline entries; runtime and test sources are unchanged. The supplied previous review contains no findings. (config/assertion-safety-baseline.txt:901, e9970d6416b5)
  • Work remains distinct from current main: The fetched main still contains the local OpenCode effort parser, update-report dependency bag, and separate warning-order array. No supplied related item establishes a merged replacement. The latest-release package blob could not be read because its retrieval required unavailable network access; no shipped-fix claim is made. (extensions/opencode/provider-policy-api.ts:14, 1421c2164075)
  • Provider behavior and package boundary: The new helper preserves exact effort spelling, ordering, deduplication, absence handling, and default preference. Both provider policies retain their overrides and fallbacks. Registration includes the root export, private-subpath inventory, build entrypoint, and package-boundary paths. This is an OpenClaw-owned helper with no runtime imports; the changed behavior does not depend on the Codex implementation. (src/plugin-sdk/provider-thinking-runtime.ts:1, e9970d6416b5)
  • Existing release owner covers compatibility coordination: Both OpenCode packages currently declare pluginApi >=2026.9.2. The PR body explicitly prohibits independent publication with that older floor. The existing syncPluginApiVersion implementation advances existing floors to the release version, release documentation requires preparation before tagging, and installer compatibility checks reject hosts below the declared floor. This addresses the earlier review through the established release process rather than an additional branch version bump. (scripts/sync-plugin-versions.ts:50, e9970d6416b5)
  • Telegram public hooks remain intact: Both command hooks now use the existing provider renderer, which returns the same keyboard and null empty-list fallback. The removed helper was not exported through the plugin's public api or contract-api barrels. Existing callback callers retain their button helper. (extensions/telegram/src/shared.ts:39, e9970d6416b5)
  • Consent and diagnostic invariants preserved: Report preparation still precedes preview and default-false confirmation; submission receives the reviewed digest, and retryable outcomes return to a fresh choice. Warning deduplication retains its 256-entry FIFO behavior through Set insertion order. Existing warning eviction tests and the updated CLI/Gateway receipt matrix cover these boundaries. (src/cli/update-cli/update-command-report.ts:79, e9970d6416b5)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Jason (Json): Raw commit bf00dc5 adds src/cli/update-cli/update-command-report.ts:122 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: bf00dc5c98e9; files: src/cli/update-cli/update-command-report.ts)

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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-06T11:37:10.827Z sha b991bf8 :: blocked before merge. :: none

@steipete
steipete marked this pull request as ready for review September 6, 2026 11:42
@steipete
steipete merged commit a25cd27 into main Sep 6, 2026
263 checks passed
@steipete
steipete deleted the codex/deslop-command-diagnostics branch September 6, 2026 12:17
@steipete

steipete commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc pushed a commit to gaoanze888/openclaw that referenced this pull request Sep 6, 2026
* commit '3ed964c8ca6206d26ecc0b6567ccd1389d9948fc': (36 commits)
  refactor(plugins): unify install config snapshot preparation (openclaw#140081)
  fix: cloud provisioning stays failed after temporary storage recovers (openclaw#140021)
  fix(ci): preflight job outputs exceed 1 MiB on full-plan pull requests (openclaw#140018)
  refactor: consolidate command and provider helpers (openclaw#140072)
  fix(doctor): replace unavailable TUI cleanup advice (openclaw#140074)
  fix(plugins): avoid scoped pack failures and missing runtime entries (openclaw#140016)
  fix: clarify background command timeouts (openclaw#140022)
  fix(workboard): refresh board navigation while retaining drafts (openclaw#139952)
  fix: preserve newer chat drafts when rewind completes (openclaw#140066)
  feat(transcripts): browse and export saved meeting archives (openclaw#139875)
  fix(cron): complete timeout test observation phase (openclaw#140076)
  fix(macos): show the full automation count (openclaw#139692)
  fix: native worker turns fail to load WebSocket transport (openclaw#140071)
  fix(cli): complete quoted Bash option values (openclaw#140034)
  fix(chat): show command instructions while pending (openclaw#140041)
  refactor(cli): use canonical resume result schema (openclaw#140056)
  fix: restore package acceptance across install runtimes (openclaw#140062)
  refactor(auto-reply): keep model-selection fixtures in tests (openclaw#140069)
  fix(plugins): remove owned aliases before uninstalling files (openclaw#140065)
  fix: completed replies hang when context-engine cleanup stalls (openclaw#140023)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 7, 2026
* refactor: simplify command rendering and diagnostic plumbing

* refactor(providers): share exact effort profile parsing

Keep model overrides and API fallbacks in their provider owners. The shared helper has no runtime imports so eager policy loading retains its narrow dependency graph.

Official plugin packages gain a host runtime dependency. Publish this with the next synchronized core and plugin release, whose canonical release sync advances pluginApi floors; do not publish these plugins alone with the existing older API floor.

* chore: prune removed provider assertion allowances
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling channel: telegram Channel integration: telegram cli CLI command changes docs Improvements or additions to documentation extensions: opencode extensions: opencode-go extensions: xai gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: M 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