Repository navigation
refactor(hooks): share optional reply metadata projection - #148641
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 15, 2026, 12:13 AM ET / 04:13 UTC (Revision 2). ClawSweeper reviewWhat this changesShares optional reply-field projection across four plugin hook payloads and adds coverage for omitted fields, empty strings, false values, and sent-context property reads. Merge readiness✅ Ready for maintainer review Keep open: this remains a useful, maintainer-requested cleanup absent from current main. The reviewed patch preserves existing payload contracts, and no actionable correctness or security finding remains. Priority: P3 Review scores
Verification
How this fits togetherMessage hook mappers turn incoming channel messages and outgoing delivery results into payloads consumed by plugins. This refactor centralizes how existing reply metadata reaches those payloads. flowchart LR
A[Incoming channel message] --> C[Canonical message context]
B[Outgoing delivery result] --> C
C --> D[Optional reply field projection]
D --> E[Plugin message context]
D --> F[Inbound claim and received events]
E --> G[Plugin hooks]
F --> G
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -13, Tests +89. Total +76 across 2 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep one private projection owner for optional reply fields while preserving the existing public hook payloads and their separate nested metadata contract. Do we have a high-confidence way to reproduce the issue? Not applicable: this is behavior-preserving cleanup, not a reported runtime defect; source inspection confirms the repeated rules on current main. Is this the best way to solve the issue? Yes: a private helper at the existing insertion points consolidates the rules without expanding the plugin API or changing its consumers. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 8cdb0d6df06b. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
* commit '0945dabbe487213e95e84a72ad1aae3659e0e000': (115 commits) fix: omit automation service aliases from squash coauthors (#148883) test: restore services typecheck shard headroom (#148885) perf(trajectory): avoid native probes for truncation records (#148870) improve(gateway): load cron only when reload requests it (#143500) fix: resolve issue #146088 — [Bug]: The most recent Linux AppImage does not ship with the correct versions of libs needed to run (#148174) refactor(theme): share nonvirtual ANSI color lookup (#148717) perf(gateway): scope exact session row topology reads (#148836) improve(memory): reduce vector replacement overhead (#148201) fix(i18n): keep HTTP headers out of native translations (#147119) refactor(plugins): share source-root display formatting (#148646) fix(cron): reject blank script paths before mutations (#148787) refactor(config): share audit positional scanning (#148643) fix(test): restore infrastructure typecheck shard headroom (#148861) fix(release): harden package validation fallbacks (#148729) refactor(config): share leaf and descendant unset pruning (#148216) test: reuse prepared runtime for pristine preflight (#148858) fix(ui): settle global model drafts across agent switches (#148843) fix(queue): avoid repeated scans when cancelling backlogs (#148754) fix(logging): orphaned \\\\?\\ path markers corrupt redacted Windows diagnostics (#147542) refactor(hooks): share optional reply metadata projection (#148641) ...
What Problem This Solves
This maintainer-requested refactor is part of the approved duplication and complexity reduction deliverable.
Four message-hook projections repeat the same optional reply metadata rules. Updating the generic plugin context, inbound claim context, claim event, and received event separately makes those payload shapes easy to diverge.
User Impact
Defined reply fields retain their existing values and order, including empty strings and
false. Absent or undefined top-level fields remain omitted. Nested event metadata continues to include its existing keys even when their values are undefined.Why This Change Was Made
A private reply-field projection now supplies all four outputs at their original insertion points. It retains the sent-context presence checks before reading fields; the canonical inbound producer already materializes those fields. Trace assignment, conversation resolution, media projection, and internal hook payloads remain unchanged. Production changes are net −13 lines; tests add 89 lines.
Evidence
git diff --checkpassed; the staged classifier selected core lanes without running them. One exact-head P2 review on6894d3508cd44cbba4fa0f2e5a661e34632538d1reported no actionable finding. It reviewed the supplied full owner and diff; the isolated environment lacked the remaining repository context and executed no tests.6894d3508cd44cbba4fa0f2e5a661e34632538d1. Selected type, lint, formatter, dependency, and build gates passed.40d3f9119e826c223ab9ae9ddc2115ac69e4b02d. Its mapper source and test blobs match this PR; the hooks group passed 32 files and 403 cases. No live plugin, provider, or channel execution is claimed.