Repository navigation
refactor(agents): split message-tool into concept modules - #121901
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: found issues before merge. Reviewed August 11, 2026, 2:59 AM ET / 06:59 UTC. ClawSweeper reviewWhat this changesThe PR replaces the monolithic message tool with five concept-focused modules and redirects agent-tool importers to the new execution module. Merge readinessKeep this maintainer PR open: the split leaves the critical CodeQL boundary configured for the deleted monolith, so its replacement modules would no longer receive that security analysis. Priority: P2 Review scores
Verification
How this fits togetherThe agent message tool turns model requests into channel actions, applying schema discovery, source-reply restrictions, and visible-content sanitization before dispatching through outbound delivery. Its security-sensitive paths feed configured channel plugins and Gateway-backed message delivery. flowchart LR
A[Agent tool request] --> B[Message tool entry]
B --> C[Schema and channel discovery]
B --> D[Source reply and content policy]
C --> E[Outbound action runner]
D --> E
E --> F[Channel plugins]
F --> G[Delivered message]
Before merge
Findings
Agent review detailsSecurityNeeds attention: The refactor creates a concrete security-analysis blind spot by leaving CodeQL scoped to the deleted message-tool file. PR surfaceSource +55, Tests 0, Other -1. Total +54 across 12 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Replace the deleted CodeQL path with coverage for all five split message-tool modules, then rerun the relevant security analysis before merge. Do we have a high-confidence way to reproduce the issue? Yes: at the PR head, the tool factory is in a new module while the configured CodeQL boundary still names only the deleted original path. Is this the best way to solve the issue? No: the source split is coherent, but it must preserve the existing critical security scan coverage by updating the CodeQL path list. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 2ae316e2f33d. LabelsLabel changes:
Label justifications:
EvidenceSecurity concerns:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Land-ready at ClawSweeper's CodeQL-boundary finding is addressed by Local proof:
Hosted proof:
Known proof gaps: none. No user-visible behavior, schema, description, docs, or changelog change. |
|
Merged via squash.
|
…21901) * refactor(agents): split message-tool into concept modules * fix(agents): restore message-tool split imports * ci: preserve message-tool CodeQL boundary
What Problem This Solves
src/agents/tools/message-tool.tshad grown to 2,037 lines and required a grandfatheredmax-linessuppression, making the model-facing message tool harder to navigate and maintain safely.Why This Change Was Made
The monolith is split at its existing concept seams, with no behavior, tool name, schema, description, or action-flow changes:
message-tool-execution.ts— factory, dispatch, idempotency, and poll-echo lifecycle (696 lines)message-tool-schema.ts— TypeBox action and payload schemas (498 lines)message-tool-visible-content.ts— outbound visible-text sanitization (393 lines)message-tool-discovery.ts— channel capability/action discovery and descriptions (308 lines)message-tool-source-policy.ts— current-source reply authority and validation (197 lines)The five manageable modules replace the original file directly; five importer files now target the execution module, with no re-export wrapper. The obsolete max-lines suppression and baseline entry are removed, and the critical CodeQL boundary follows the new concept-module prefix.
AI-assisted; implementation and proof reviewed by the author.
User Impact
None. This is a behavior-neutral source organization change; the model-visible tool contract remains unchanged.
Evidence
node scripts/run-vitest.mjs src/agents/tools/message-tool— 230 tests passednode scripts/run-vitest.mjs src/agents/openclaw-tools.tts-config.test.ts src/agents/openclaw-tools.sessions.test.ts— 48 tests passedpnpm build— passed; no[INEFFECTIVE_DYNAMIC_IMPORT]warningnode --import tsx scripts/check-export-name-collisions.mts— passedpnpm check:wrapper-shadowing— passed, 64 current / 64 baselinedpnpm check:import-cycles— passed, 0 runtime value cyclespnpm check:max-lines-ratchet --base origin/main— passed; baseline reduced by onegit diff --check— passed.agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main— clean; no accepted/actionable findingsLOC classification: production +2,093/-2,038 (net +55, split-boundary imports/exports only); tests/test support +5/-5 (net 0); max-lines baseline +0/-1.