Skip to content

refactor: remove synthetic chat callback recovery - #134184

Merged
steipete merged 1 commit into
mainfrom
codex/test-audit-chat-display
Aug 31, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/test-audit-chat-display

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

The chat-content tests require recovery from internal string callbacks that deliberately violate their declared contract. That synthetic case keeps redundant coercion around values already produced by the internal normalizer and sanitizer. The envelope helper also lists iMessage twice.

Why This Change Was Made

Keep coercion at the raw message-content boundary and use the typed internal callback results directly. Remove the invalid-callback case, the unreachable duplicate label, and three generic header comments. All concrete callback producers return strings; the public extraction facade does not expose callback options.

User Impact

Valid message extraction and envelope stripping are unchanged. Raw unknown content still uses the identical coercion helper, including object serialization and cycle handling. Sanitizer receiver binding, normalizer invocation order, separators, empty-result behavior, and all unique envelope labels remain intact. Deliberately invalid internal callbacks no longer receive accidental recovery.

Production: +2/-7, net -5 lines. Tests: -20 lines, one case removed.

Evidence

Read the owners, internal callers and callback producers, public facade, sibling sanitizers and envelope consumers, and the raw-parent history introducing both the synthetic case and duplicate label. The same six focused suites pass before (103 cases) and after (102), with every surviving case name and per-file order preserved.

Nine temporary executable before/after vectors produce identical results and callback traces, covering malformed raw values, cyclic content, custom separators, default and supplied normalization, canonical sanitization, callback receiver/order, empty arrays, and unsupported top-level values. These probes are not added to the permanent suite.

All 29 required changed-file checks pass, including core and core-test typechecks, lint, formatting, dead exports, and repository guards. Scoped Codex review is clean. No external provider behavior, configuration, persistence, or public callback API changes.

@clawsweeper

clawsweeper Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@steipete
steipete marked this pull request as ready for review August 31, 2026 14:28
@openclaw-barnacle openclaw-barnacle Bot added size: XS maintainer Maintainer-authored PR labels Aug 31, 2026
@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 31, 2026
@clawsweeper

clawsweeper Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 31, 2026, 10:36 AM ET / 14:36 UTC.

ClawSweeper review

What this changes

The PR removes defensive coercion around typed internal chat-text callbacks, deletes tests for callbacks deliberately cast to violate that contract, and removes a duplicate iMessage envelope label.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

The patch is correct: it keeps coercion at the untyped content boundary, while all in-repository callback producers satisfy the declared string contract. This member-authored, maintainer-labeled PR remains open for explicit maintainer handling and exact-head CI completion.

Priority: P3
Reviewed head: 886dfe23c5a6938f3c39a51205c8237bea12e74b
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A concise, net-negative cleanup with an inspected typed-call-site boundary and no actionable correctness or security finding.
Proof confidence 🌊 off-meta tidepool Not applicable: This MEMBER-authored PR is an internal behavior-neutral refactor, so the external-contributor real-behavior-proof gate does not apply; the supplied body describes focused before/after vectors and checks.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This MEMBER-authored PR is an internal behavior-neutral refactor, so the external-contributor real-behavior-proof gate does not apply; the supplied body describes focused before/after vectors and checks.
Evidence reviewed 6 items Introduced patch: The verified merge-base-to-head diff changes only the two shared helpers and their colocated tests; it removes post-callback coercion and one duplicate envelope label.
Callback contract and callers: The helper types both callbacks as string-to-string; the custom in-tree producer sanitizes and normalizes as strings, while the remaining production calls either omit callbacks or use string identity/trim functions.
Retained behavioral coverage: The retained test suite still covers string normalization, text-block filtering, valid sanitizer and normalizer hooks, separators, and empty/unsupported content; the removed case required explicit casts to fabricate invalid callback returns.
Findings None None.
Security None None.

How this fits together

Shared chat helpers convert raw or structured message content into normalized text for agent context, queue summaries, and chat handling. Envelope stripping removes recognized generated channel prefixes before display and reporting consumers use the text.

flowchart LR
  A[Raw chat content] --> B[Shared text coercion]
  B --> C[Typed sanitizer]
  C --> D[Typed normalizer]
  D --> E[Agent and queue consumers]
  F[Channel-prefixed text] --> G[Envelope recognition]
  G --> H[Display and reporting consumers]
Loading

Decision needed

Question Recommendation
Should this maintainer-owned cleanup land after the exact PR head completes its required checks? Land after exact-head CI: Accept the typed internal callback boundary and merge once the current head's required checks are green.

Why: The patch is behavior-neutral by the inspected in-tree contract, but member authorship and the maintainer label require explicit maintainer judgment rather than automated closure or merge advice.

Before merge

  • Complete next step (P2) - A member-authored, maintainer-labeled PR needs explicit maintainer merge handling; no mechanical repair is identified.
Agent review details

Security

None.

PR surface

Source -5, Tests -20. Total -25 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 2 2 7 -5
Tests 2 0 20 -20
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 2 27 -25

Review metrics

Metric Value Why it matters
Production versus test delta production -5, tests -20 The refactor is net-negative and removes only defensive recovery plus a test that intentionally violates the typed callback contract.

Technical review

Best possible solution:

Retain the canonical typed internal callback contract and duplicate-free envelope list, then land only after a maintainer confirms the scope and exact-head checks are green.

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

Not applicable: this PR is a behavior-neutral internal refactor, not a report of a user-facing defect.

Is this the best way to solve the issue?

Yes. The shared helper continues to coerce untyped message content at its boundary, and inspected in-tree callback producers already return strings; retaining recovery for deliberate type violations would preserve unsupported behavior.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 9323eae1deab.

Labels

Label changes:

  • add P3: This is a small internal cleanup with no demonstrated user-visible behavior change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This MEMBER-authored PR is an internal behavior-neutral refactor, so the external-contributor real-behavior-proof gate does not apply; the supplied body describes focused before/after vectors and checks.

Label justifications:

  • P3: This is a small internal cleanup with no demonstrated user-visible behavior change.
  • 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 MEMBER-authored PR is an internal behavior-neutral refactor, so the external-contributor real-behavior-proof gate does not apply; the supplied body describes focused before/after vectors and checks.

Evidence

What I checked:

  • Introduced patch: The verified merge-base-to-head diff changes only the two shared helpers and their colocated tests; it removes post-callback coercion and one duplicate envelope label. (src/shared/chat-content.ts:36, 886dfe23c5a6)
  • Callback contract and callers: The helper types both callbacks as string-to-string; the custom in-tree producer sanitizes and normalizes as strings, while the remaining production calls either omit callbacks or use string identity/trim functions. (src/agents/embedded-agent-utils.ts:134, 886dfe23c5a6)
  • Retained behavioral coverage: The retained test suite still covers string normalization, text-block filtering, valid sanitizer and normalizer hooks, separators, and empty/unsupported content; the removed case required explicit casts to fabricate invalid callback returns. (src/shared/chat-content.test.ts:21, 886dfe23c5a6)
  • Envelope consumer path: Envelope recognition uses a membership check, so removing the second identical iMessage entry does not change recognition; the helper remains consumed by display sanitization and session cost reporting. (src/shared/chat-envelope.ts:25, 886dfe23c5a6)
  • History limitation: Available blame identifies the shared-helper lines as carried across a shallow-history boundary, not as introduced by the displayed commit; no historical authorship is asserted from that result. (src/shared/chat-content.ts:36, 83b61257d6e3)
  • Current-main and release status: The PR head is unmerged and no release tag contains it, so current main and v2026.8.1 do not already include this cleanup. (src/shared/chat-content.ts:36, 886dfe23c5a6)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • openclaw-mantis[bot]: 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 self-assigned this Aug 31, 2026
@steipete
steipete merged commit 40f11b0 into main Aug 31, 2026
298 of 306 checks passed
@steipete
steipete deleted the codex/test-audit-chat-display branch August 31, 2026 18:47
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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: XS 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