Skip to content

refactor(agents): deduplicate tool display definitions - #129306

Merged
steipete merged 1 commit into
mainfrom
codex/cleanup20k-agent-tool-display-runtime-20260825
Aug 26, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/cleanup20k-agent-tool-display-runtime-20260825

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

The shipped agent tool-display registry and its message-action owner repeatedly constructed equivalent private descriptor records. Those repetitive definitions made the cross-platform presentation catalog unnecessarily large while requiring exact preservation of every label, action shape, ownership identity, and generated Apple/Android artifact.

Why This Change Was Made

The two existing private registry owners now use small canonical descriptor factories without changing the exported registry, runtime imports, field presence, object/array identities, or generated platform tool-display catalogs. The change removes duplicate construction while keeping all special tool and message definitions in their original owners.

User Impact

Agent, channel, web, iOS, and Android tool labels and presentation remain byte-for-byte identical. Every existing action, visible detail, message label, and generated OpenClawKit JSON artifact is unchanged.

Evidence

  • The relevant existing tool-display, formatter, agent, and channel suites passed all 107 cases before and after the refactor.
  • Independent source-blind runtime comparisons verified all 62 tools, 88 actions, hundreds of recursive objects and arrays, all own-property descriptors/insertion orders, distinct object and array identities, absent-versus-empty-array fields, and 695 real formatter invocations.
  • The canonical cross-platform tool-display generator/check preserved the exact existing 22,968-byte platform JSON and SHA-256 3402e71f59dd8fe0d938b715af1862e9dbd7eb3f5b7fcbd70faadc4b2d81766f; no generated files changed.
  • Targeted lint, formatting, the repository safety ratchet, git diff --check, multiple independent complete source/behavior reviews, and full structured precommit review passed.
  • Genuine shipped production delta: 161 added, 353 removed, net -192. No tests, generated files, documentation, public APIs, configuration, protocol, or SQLite schemas changed.

@clawsweeper

clawsweeper Bot commented Aug 25, 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 agents Agent runtime and tooling size: L maintainer Maintainer-authored PR labels Aug 25, 2026
@steipete
steipete marked this pull request as ready for review August 25, 2026 12:09
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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 Aug 25, 2026
@clawsweeper

clawsweeper Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 25, 2026, 11:21 PM ET / August 26, 2026, 03:21 UTC.

ClawSweeper review

What this changes

Replaces repeated agent and message tool-display action literals with local descriptor factories while preserving labels and detail-key arrays.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

No blocking source finding: the refactor preserves the two descriptor shapes consumed by the formatter and generated catalog. This PR remains open for maintainer handling because it carries the protected maintainer label and its exact-head CI matrix is still incomplete.

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

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is a focused, source-equivalent cleanup with no actionable correctness or security finding.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored refactor is exempt from the external-contributor real-behavior-proof gate.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored refactor is exempt from the external-contributor real-behavior-proof gate.
Evidence reviewed 7 items Descriptor shape preserved: The new helper returns either { label } or { label, detailKeys }, preserving both absent-property semantics and property order used by the prior literals.
Formatter contract: The formatter reads only the selected action label and detail-key array before falling back to tool-level metadata.
Generated-client boundary: The catalog generator serializes the registry and checks it against the shared Apple/web resource, so unchanged descriptor values preserve the generated client input.
Findings None None.
Security None None.

Live Verification

Command: pnpm tool-display:check

Result: PASS (completed)

$ node --import tsx scripts/tool-display.ts --check
tool-display snapshot is up to date
$ node --import tsx scripts/tool-display.ts --check
tool-display snapshot is up to date

Assertions:

  • PASS expect_output: tool-display snapshot is up to date

How this fits together

Tool invocations are mapped through static display metadata into redacted progress text, channel status reactions, and a generated shared catalog used by web and mobile clients. The PR changes only how those action descriptors are constructed.

flowchart TD
  Invocation[Tool invocation] --> Registry[Display metadata registry]
  Registry --> Action[Action descriptor lookup]
  Action --> Formatter[Progress display formatter]
  Registry --> Generator[Shared catalog generator]
  Formatter --> Channels[Channel and transcript output]
  Generator --> Clients[Web and mobile clients]
Loading

Decision needed

Question Recommendation
Should this protected maintainer refactor merge once its exact-head CI matrix completes green? Merge after exact-head CI: Accept the local factory refactor once the pending checks verify the unchanged shared catalog.

Why: The source review found preserved descriptor semantics, but the protected label requires an explicit maintainer decision rather than automated cleanup.

Before merge

  • Resolve merge risk (P1) - The provided exact-head CI matrix is still queued or running, so merge readiness cannot yet be established.
Agent review details

Security

None.

PR surface

Source -192. Total -192 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 2 161 353 -192
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 2 161 353 -192

Review metrics

Metric Value Why it matters
Production versus test LOC production +161/-353 (net -192); tests 0 The PR reduces static registry boilerplate without adding a runtime, configuration, or test surface.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep the private factories local to their respective registry owners and merge only after the exact-head catalog and type/test checks are green.
  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 private factories local to their respective registry owners and merge only after the exact-head catalog and type/test checks are green.

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

Not applicable: this PR is a behavior-preserving refactor, not a report of broken behavior.

Is this the best way to solve the issue?

Yes: local factories retain each registry's ownership while preserving the exact action-descriptor contract; a shared exported helper would add surface without a demonstrated need.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P3: This is a behavior-preserving cleanup of private presentation metadata.
  • 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: This maintainer-authored refactor is exempt from the external-contributor real-behavior-proof gate.

Evidence

What I checked:

Likely related people:

  • steipete: Peter Steinberger authored the current refactor and most historical changes to the tool-display registry. (role: recurring registry owner and current refactor author; confidence: high; commits: 3ff7663eb534, 7170a6231a4a, 8788ae1a8eab; files: src/agents/tool-display-config.ts, src/agents/tool-display-message-config.ts)
  • Shakker: History attributes a prior message tool-display metadata update to Shakker. (role: message display catalog contributor; confidence: medium; commits: 0f49bbbeb28d; files: src/agents/tool-display-message-config.ts)

Rank-up moves

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

  • Let the exact-head CI matrix finish green before merging.

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 (2 earlier review cycles)
  • reviewed 2026-08-25T12:16:28.610Z sha 11fda54 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-25T12:59:17.033Z sha 11fda54 :: needs maintainer review before merge. :: none

@steipete
steipete force-pushed the codex/cleanup20k-agent-tool-display-runtime-20260825 branch from 11fda54 to 3ff7663 Compare August 26, 2026 03:15
@steipete
steipete merged commit 345cfde into main Aug 26, 2026
196 checks passed
@steipete
steipete deleted the codex/cleanup20k-agent-tool-display-runtime-20260825 branch August 26, 2026 03:44
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L 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