Skip to content

refactor(cli): share message payload projections - #135319

Merged
steipete merged 1 commit into
mainfrom
codex/qa50-message-cli-projection
Sep 1, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/qa50-message-cli-projection

Conversation

@steipete

@steipete steipete commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Message JSON and terminal output repeated payload-ID projection, alias selection and primitive summarization. They now share the payload projector and use smaller formatting helpers, retaining direct-before-nested IDs, trimming, table output and delivery outcomes.

The alias helper preserves the original short-circuit behavior, including returning a getter's second truthy read. An initial review caught a candidate regression here; the final implementation and maintained changing-getter test preserve the original behavior. Transport, authorization and stored data are unchanged.

Production: +65/-92 = -27 lines, including assertion-baseline bookkeeping. Tests: +128/-16 = +112 lines.

Validation: all56 final maintained message/formatter tests pass. Two additional immutable-corpus tests reproduce31,875 baseline bytes across14 JSON cases,29 formatter cases and3 getter scenarios. Those tests supply action results at the command boundary; they do not claim live provider I/O. Final type, lint, format and assertion checks pass, and a fresh isolated Codex high/P2 review is clean.

The actual source CLI rebuilt the dirty source and completed message send --channel telegram --target 1 --message probe --dry-run --json with networking denied. Exit0 and all222 output bytes match baseline:

{"action":"send","channel":"telegram","dryRun":true,"handledBy":"core","payload":{"channel":"telegram","to":"telegram:1","via":"direct","mediaUrl":null,"dryRun":true}}

The earlier full selected gate, including all three dead-code scans, and full normal build passed before the final getter/formatter correction. Fresh final checks and the source CLI rebuild cover the final bytes; exact-head hosted CI is required before landing. Failed setup/lint attempts and the original review finding are retained. Random terminal startup banners are not claimed byte-identical.

Maintainer landing review: retain the shared outbound-result projection and separate JSON/terminal presentation owners. Root read the full latest ClawSweeper review; its pending-CI risk is resolved by all216 exact-head jobs passing or intentionally skipping in33529478269, including the required gate. The final getter-order correction passes the baseline corpus and56 maintained tests; the actual source CLI rebuilt and returned the exact222-byte dry-run JSON under network denial. Production−27, assertion metadata net0, tests+112. No transport, authorization or persistence behavior changes.

@clawsweeper

clawsweeper Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added commands Command implementations size: M maintainer Maintainer-authored PR labels Sep 1, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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. labels Sep 1, 2026
@clawsweeper

clawsweeper Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 1, 2026, 12:10 PM ET / 16:10 UTC.

ClawSweeper review

What this changes

The PR moves repeated direct-then-nested message-ID projection into the shared outbound result contract and simplifies terminal payload formatting with regression coverage.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open. This maintainer-authored refactor cleanly consolidates duplicated CLI payload projection without changing delivery, authorization, configuration, or persistence behavior; no blocking correctness or security finding was found. Exact-head hosted CI is still incomplete.

Priority: P3
Reviewed head: 9f0c82fa4b7b5bf2e6aa2a5af4e550150ebc763a

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused, net-negative refactor with source-equivalent shared projection and targeted boundary coverage.
Proof confidence 🌊 off-meta tidepool Not applicable: This MEMBER-authored, behavior-neutral CLI refactor is exempt from the external-contributor proof gate; the supplied dry-run CLI trace and focused command/formatter tests are supplemental evidence rather than provider-I/O proof.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This MEMBER-authored, behavior-neutral CLI refactor is exempt from the external-contributor proof gate; the supplied dry-run CLI trace and focused command/formatter tests are supplemental evidence rather than provider-I/O proof.
Evidence reviewed 5 items Shared owner and both consumers: The introduced resolver preserves direct-before-nested normalized message-ID selection, and both the JSON command path and plugin text send/poll paths call it.
Runtime payload boundary: The action runner routes send, poll, and plugin actions into result objects carrying their payloads, so the contract-level projection is shared by the presentation consumers without affecting delivery execution.
Behavior-preserving formatter coverage: Added tests exercise trimmed direct IDs, nested IDs, array payloads, changing getter reads, and each scalar summary category through the two public CLI presentation paths.
Findings None None.
Security None None.

How this fits together

The message CLI invokes the outbound action runner, which returns a channel payload that is rendered either as machine-readable JSON or terminal text. The new shared resolver sits at that result boundary so both presentation paths select the same message ID.

flowchart LR
  A[Operator message command] --> B[Outbound action runner]
  B --> C[Channel action payload]
  C --> D[Shared message ID projection]
  D --> E[CLI JSON output]
  D --> F[Terminal text output]
Loading

Before merge

  • Resolve merge risk (P1) - Hosted checks for the exact PR head are still queued or running, so the normal merge gate has not completed.
  • Complete next step (P2) - No repair lane is needed because no actionable patch defect was found; await the normal exact-head CI and maintainer merge gates.
Agent review details

Security

None.

PR surface

Source -27, Tests +112, Other 0. Total +85 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 3 63 90 -27
Tests 2 128 16 +112
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 2 0
Total 6 193 108 +85

Review metrics

Metric Value Why it matters
Production versus test delta production +63/-90 (net -27); tests +128/-16 (net +112); assertion baseline +2/-2 The refactor removes duplicate production projection logic while adding focused parity coverage; the baseline update records only removed assertions.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep the single shared message-ID projection in the outbound result contract, retain the focused JSON and text boundary coverage, and merge only after exact-head CI passes.
  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 single shared message-ID projection in the outbound result contract, retain the focused JSON and text boundary coverage, and merge only after exact-head CI passes.

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

Not applicable: this PR refactors established CLI payload projection rather than reporting a separate current bug.

Is this the best way to solve the issue?

Yes. The outbound result contract is the common owner for the duplicated payload interpretation, while JSON and terminal-specific rendering remain in their respective callers.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is behavior-neutral CLI cleanup with no demonstrated user-facing regression or security impact.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🌊 off-meta tidepool 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: This MEMBER-authored, behavior-neutral CLI refactor is exempt from the external-contributor proof gate; the supplied dry-run CLI trace and focused command/formatter tests are supplemental evidence rather than provider-I/O proof.

Label justifications:

  • P3: This is behavior-neutral CLI cleanup with no demonstrated user-facing regression or security impact.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🌊 off-meta tidepool and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This MEMBER-authored, behavior-neutral CLI refactor is exempt from the external-contributor proof gate; the supplied dry-run CLI trace and focused command/formatter tests are supplemental evidence rather than provider-I/O proof.

Evidence

What I checked:

  • Shared owner and both consumers: The introduced resolver preserves direct-before-nested normalized message-ID selection, and both the JSON command path and plugin text send/poll paths call it. (src/infra/outbound/message-action-contracts.ts:238, 9f0c82fa4b7b)
  • Runtime payload boundary: The action runner routes send, poll, and plugin actions into result objects carrying their payloads, so the contract-level projection is shared by the presentation consumers without affecting delivery execution. (src/infra/outbound/message-action-runner.ts:561, 9f0c82fa4b7b)
  • Behavior-preserving formatter coverage: Added tests exercise trimmed direct IDs, nested IDs, array payloads, changing getter reads, and each scalar summary category through the two public CLI presentation paths. (src/commands/message-format.test.ts:245, 9f0c82fa4b7b)
  • Current-main comparison: Fetched current main still contains separate local extractors in the JSON command and formatter, so the central consolidation is not already implemented or superseded. (src/commands/message.ts:29, 1b236dfc8625)
  • Feature-history routing: Recent merged message command and formatter work includes the preceding formatter refactor and failed-action reporting work by steipete; older CLI JSON message-ID work is attributed to 100menotu001. (src/commands/message-format.ts:20, fa57231562da)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • 100menotu001: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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 3ce74e3 into main Sep 1, 2026
279 checks passed
@steipete
steipete deleted the codex/qa50-message-cli-projection branch September 1, 2026 16:35
@steipete

steipete commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 2, 2026
steipete added a commit that referenced this pull request Oct 15, 2026
* refactor: consolidate command and cron preparation paths

Keep one sub-CLI metadata/registration catalog, common cron payload updates,
canonical agent migration visitors, and shared account-state projection.
Trust typed internal adapters while retaining external validation, effect
authority, cancellation settlement, supported migrations and path containment.

Wave-5 y10: BELOW-500, 353 net production lines removed (+440/-793 in 19 files).
Branch-only handoff for the coordinator's bundle; no standalone PR.

Best-effort tradeoffs accepted:
- Cron mid-setup reload recovery (#146582): synthetic retirement, no human
  incident. Setup may fail; the next invocation refreshes the cache.
- Recursive shared preparation retry (#102494/#138337): synthetic concurrent
  callers; production serializes same-job work. Duplicate direct callers may
  share cancellation. Failed-owner eviction preserves the next sequential run.
- Progress publication generation (#143621): synthetic held update/reset.
  Presentation dedupe may briefly be stale until a subsequent render/reset.
- Doctor adapter schema mirror (#69919): malformed synthetic hooks. Invalid
  executable adapters fail visibly; missing-hook fallbacks and config checks stay.
- Setup adapter schema mirror (#165492): typed internal union. Invalid internal
  adapters fail when used; both supported wizard forms remain.
- Injected process schema mirror (#84381): malformed injection was not human
  SIGTERM report #71710. Invalid adapters fail registration; cancellation stays.
- Loaded registry row revalidation/copy (#114942/#158830/#114476): rows already
  admitted/normalized. Corrupt trusted rows can fail; first-wins authority stays.
- Custom compatibility duplicate check (#14223): all callers parse/type it.
  Hand-crafted invalid JS uses the default branch; external flags still reject it.
- Log probe identity matching (#88159, superseded by #168587): abort now joins
  the sole probe, so replacement cannot race its result. Recovery/settlement stay.
- Whole-config deep copy (#71218): no detached-copy incident. Structural copy
  updates agents/defaults; unrelated future mutation must respect config ownership.
- Repeated plugin-root probes (#70012): no disappearing-root incident. Resolve
  roots once; root replacement can fail discovery. Symlink containment stays.
- Second payload getter read (#135319): synthetic review/corpus, not a human
  report. Ordinary decoded records are read once; stateful accessors may differ.

Proof: fresh independent review clean; core types, targeted lint/format, runtime
and static cycles, assertion/line-cap ratchets, and suppression suite passed.
Focused CLI cohort: 8 files / 41 tests passed. Earlier unchanged account/setup
and cold-import checks passed. Cron and commands cohorts were interrupted after
partial results; complete owner tests, payload merging, test-graph types, broad
check-changed and build/smoke remain unproved at commit preparation.

Unattributed local 120-second timeouts retained: two root-command-descriptions
catalog cases and agent-via-gateway's Gateway attempt-budget case. No timeout,
retry, skip or kept-behavior expectation changes. Env-name budget mismatch
(455 vs 454) also exists at original HEAD and pinned main 7dccff5.
All runtime proof used isolated HOME/OpenClaw/XDG state; Phase E untouched.

* refactor: consolidate cron payload and lazy CLI paths

Share daemon and cron method forwarding through the existing lazy binder,
remove the cron CLI reexport shim, and consolidate normalization and merge
handling without changing public fields, explicit clears, or effect authority.
Remove the obsolete bundled discovery reentry mechanism and impossible Doctor
issue helper. The full lane now removes 475 net production lines.

Best-effort tradeoffs accepted:
- Unknown Doctor issue variants supplied by hand-crafted JavaScript return the
  invalid value rather than a custom error. Typed local producers and exhaustive
  switches remain; reporting feature #95979 cites no human unknown-kind incident.
- Synchronous bundled-module self-discovery may fail through the existing loader
  diagnostic instead of returning empty inventory. Commit 65f18d6 only pins
  injected Jiti reentry, not a human incident; ordinary caches remain.
- Cron defaults trust staggerMs normalized earlier in the same synchronous call.
  No await or mutation boundary intervenes; externally supplied invalid values
  remain rejected by the normalizer.

* fix(channels): retain replacement preview deduplication

Withdraw the progress compositor generation removal after the Mattermost
retiring-publication case failed CI and bounded serial head/base replays
remained inconclusive under load. Restore that file exactly to the branch
base and keep all Mattermost tests unchanged, following the campaign fallback.

Prune the single obsolete mock-export allowance left by the removed bundled
discovery reentry fixture. The local mock ratchet passes with 9586 factories.
The remaining lane reduction is 471 net production lines across 25 paths.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 16, 2026
…#173036)

* refactor: consolidate command and cron preparation paths

Keep one sub-CLI metadata/registration catalog, common cron payload updates,
canonical agent migration visitors, and shared account-state projection.
Trust typed internal adapters while retaining external validation, effect
authority, cancellation settlement, supported migrations and path containment.

Wave-5 y10: BELOW-500, 353 net production lines removed (+440/-793 in 19 files).
Branch-only handoff for the coordinator's bundle; no standalone PR.

Best-effort tradeoffs accepted:
- Cron mid-setup reload recovery (openclaw#146582): synthetic retirement, no human
  incident. Setup may fail; the next invocation refreshes the cache.
- Recursive shared preparation retry (openclaw#102494/openclaw#138337): synthetic concurrent
  callers; production serializes same-job work. Duplicate direct callers may
  share cancellation. Failed-owner eviction preserves the next sequential run.
- Progress publication generation (openclaw#143621): synthetic held update/reset.
  Presentation dedupe may briefly be stale until a subsequent render/reset.
- Doctor adapter schema mirror (openclaw#69919): malformed synthetic hooks. Invalid
  executable adapters fail visibly; missing-hook fallbacks and config checks stay.
- Setup adapter schema mirror (openclaw#165492): typed internal union. Invalid internal
  adapters fail when used; both supported wizard forms remain.
- Injected process schema mirror (openclaw#84381): malformed injection was not human
  SIGTERM report openclaw#71710. Invalid adapters fail registration; cancellation stays.
- Loaded registry row revalidation/copy (openclaw#114942/openclaw#158830/openclaw#114476): rows already
  admitted/normalized. Corrupt trusted rows can fail; first-wins authority stays.
- Custom compatibility duplicate check (openclaw#14223): all callers parse/type it.
  Hand-crafted invalid JS uses the default branch; external flags still reject it.
- Log probe identity matching (openclaw#88159, superseded by openclaw#168587): abort now joins
  the sole probe, so replacement cannot race its result. Recovery/settlement stay.
- Whole-config deep copy (openclaw#71218): no detached-copy incident. Structural copy
  updates agents/defaults; unrelated future mutation must respect config ownership.
- Repeated plugin-root probes (openclaw#70012): no disappearing-root incident. Resolve
  roots once; root replacement can fail discovery. Symlink containment stays.
- Second payload getter read (openclaw#135319): synthetic review/corpus, not a human
  report. Ordinary decoded records are read once; stateful accessors may differ.

Proof: fresh independent review clean; core types, targeted lint/format, runtime
and static cycles, assertion/line-cap ratchets, and suppression suite passed.
Focused CLI cohort: 8 files / 41 tests passed. Earlier unchanged account/setup
and cold-import checks passed. Cron and commands cohorts were interrupted after
partial results; complete owner tests, payload merging, test-graph types, broad
check-changed and build/smoke remain unproved at commit preparation.

Unattributed local 120-second timeouts retained: two root-command-descriptions
catalog cases and agent-via-gateway's Gateway attempt-budget case. No timeout,
retry, skip or kept-behavior expectation changes. Env-name budget mismatch
(455 vs 454) also exists at original HEAD and pinned main 89f8219.
All runtime proof used isolated HOME/OpenClaw/XDG state; Phase E untouched.

* refactor: consolidate cron payload and lazy CLI paths

Share daemon and cron method forwarding through the existing lazy binder,
remove the cron CLI reexport shim, and consolidate normalization and merge
handling without changing public fields, explicit clears, or effect authority.
Remove the obsolete bundled discovery reentry mechanism and impossible Doctor
issue helper. The full lane now removes 475 net production lines.

Best-effort tradeoffs accepted:
- Unknown Doctor issue variants supplied by hand-crafted JavaScript return the
  invalid value rather than a custom error. Typed local producers and exhaustive
  switches remain; reporting feature openclaw#95979 cites no human unknown-kind incident.
- Synchronous bundled-module self-discovery may fail through the existing loader
  diagnostic instead of returning empty inventory. Commit ca10460 only pins
  injected Jiti reentry, not a human incident; ordinary caches remain.
- Cron defaults trust staggerMs normalized earlier in the same synchronous call.
  No await or mutation boundary intervenes; externally supplied invalid values
  remain rejected by the normalizer.

* fix(channels): retain replacement preview deduplication

Withdraw the progress compositor generation removal after the Mattermost
retiring-publication case failed CI and bounded serial head/base replays
remained inconclusive under load. Restore that file exactly to the branch
base and keep all Mattermost tests unchanged, following the campaign fallback.

Prune the single obsolete mock-export allowance left by the removed bundled
discovery reentry fixture. The local mock ratchet passes with 9586 factories.
The remaining lane reduction is 471 net production lines across 25 paths.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations 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: 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