Repository navigation
fix: strip standalone trailing NO_REPLY from replies - #171990
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f37873c3d2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| emitCliCommentaryText, | ||
| emitCliCommentaryText: (text: string) => { | ||
| observedCliActivity = true; | ||
| pendingCommentaryText.push(text); |
There was a problem hiding this comment.
Settle buffered CLI output at native message boundaries
For Claude stream-JSON tool turns, onCommentaryText receives a completed pre-tool segment, but this now only appends it to a buffer; emitCliCompletedReply runs for openclaw_interim_result envelopes and at whole-process settlement, not at ordinary native message_stop boundaries. If a later assistant message ends in NO_REPLY, settlement treats that later message's silence as applying to the buffer and discards the already-completed pre-tool commentary. The same missing boundary can overwrite earlier per-message reasoning snapshots, so settle these buffers when each native assistant message completes.
Useful? React with 👍 / 👎.
| for (const deliver of terminalMessageDeliveries.splice(0)) { | ||
| deliver(); | ||
| } |
There was a problem hiding this comment.
Reconcile superseded streams before deferred callbacks
When terminal delivery is deferred and a tool-progress assistant message is followed by a final answer, message settlement queues both stream callbacks here. Invoking them before the isSuperseded pass immediately publishes the earlier assistant event and onPartialReply; clearing its deferredAssistantScopes entry afterward cannot retract the captured delivery. This exposes tool-turn text that the later answer is intended to supersede, so stream reconciliation must occur before these callbacks run.
Useful? React with 👍 / 👎.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. What this changesThis PR removes a standalone trailing NO_REPLY line from delivered replies and displayed history while preserving the preceding answer. Example: The model returns The answer is 42. followed by a blank line and NO_REPLY.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Partial Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR fixes a current trailing-marker leak, and the previous source-mutation finding is resolved; no actionable defect remains in the reviewed patch. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherTerminal reply preparation consumes raw assistant output and produces prepared text and disposition metadata for delivery, while history readers project stored messages through the same preparation owner. flowchart LR
A[Raw assistant output] --> B[Terminal reply preparation]
B --> C[Prepared reply and disposition]
C --> D[Channel final delivery]
A --> E[Stored transcript]
E --> F[History display projection]
B --> F
Technical reviewBest possible solution: Land the focused preparation and projection repair after normal merge gates pass, retaining separate tracking for broader reasoning-disclosure behavior. Do we have a high-confidence way to reproduce the issue? Current main directly returns The answer is 42. followed by a standalone NO_REPLY unchanged; the PR also records native Gateway/Ollama before-and-after results, but this review ran no target code. Is this the best way to solve the issue? The patch fixes the leak at the existing preparation owner and carries its selected text range through delivery and history without introducing another silence policy. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e02ae3ecb66f. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +13, Tests +151, Docs 0. Total +164 across 14 files. Added test files: 1. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (18 earlier review cycles; latest 8 shown)
Reviewed October 16, 2026, 5:24 AM ET / 09:24 UTC (Revision 19). |
|
@clawsweeper re-review The native CLI completion finding is fixed: |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review Fixed the Stop-hook acceptance finding in |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review Merged current main and resolved the Stop-hook overlap in |
|
🦞👀 Re-review progress:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f00c0048b5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const transform = (text: string) => | ||
| parseReplyDirectives(text).hasSilentIntent | ||
| ? text | ||
| : applyPluginTextReplacements(text, replacements); |
There was a problem hiding this comment.
Apply output transforms without erasing silent intent
When a CLI result already ends in NO_REPLY, this bypasses every configured output replacement, even though those replacements are defined to run before OpenClaw consumes inbound assistant text. For example, a plugin that rewrites PRIVATE_MEDIA to MEDIA:https://… will produce a valid attachment on ordinary replies, but PRIVATE_MEDIA\nNO_REPLY remains untransformed, so prepareCliAssistantReply cannot extract the attachment and the silent turn loses its media. Preserve the silence decision separately while still transforming the rest of the segment.
Useful? React with 👍 / 👎.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
🦞👀 Re-review progress:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 74666ba9a4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (remainingPrefix === 0) { | ||
| break; | ||
| } | ||
| block.text = block.text.slice(removed, removed + remainingLength); |
There was a problem hiding this comment.
Clone every native text block before trimming it
When a multipart assistant response uses output_text or input_text blocks and ends with a standalone NO_REPLY line, these blocks are shared with the original assistant because line 88 clones only blocks whose type is text. This assignment therefore trims the source assistant object in place while merely rendering its prepared reply, potentially changing the transcript or later consumers' canonical message. Clone every text-capable block before applying the prepared range.
AGENTS.md reference: AGENTS.md:L21-L21
Useful? React with 👍 / 👎.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Fixed the multipart source-preservation P2 in b5ff4fe. The payload renderer now shallow-copies every native content block before trimming the prepared range, so input_text and output_text remain intact in the source message. No classifier or streaming behavior changed. Both added source-preservation regressions fail on the reviewed head; the final payload suite passes 33/33 (49.781s). Scoped types/lint and affected ratchets pass, apart from the already-attributed unchanged UI max-lines suppressions. Fresh full-branch Codex autoreview is scoped-clean. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
Related: #165025, #138662
What Problem This Solves
A reply such as
The answer is 42.\n\nNO_REPLYexposes the final control marker in delivered answers and displayed history.User Impact
OpenClaw removes an exact standalone trailing
NO_REPLYline and delivers the preceding answer. Only a whole-reply uppercaseNO_REPLYis silent, following #170534. The leading-token rule keeps its precedence; inline or mid-text mentions, lowercase, and punctuated variants remain ordinary text. Previews keep streaming and their existing final edit publishes the cleaned answer.Why This Change Was Made
prepareAgentRunTerminalReplyowns the one-time strip and prepared terminal reply. Native multipart rendering preserves answer boundaries while consuming the cleaned range. History and session-message projection reuse that owner and preserve the existing prepared-display marker, without rewriting raw model transcripts.This replaces the old silence/retraction design with @obviyus's #170534 contract. There is no channel production change, new buffering, required-turn retry, or second final-reply classifier. Thanks to @eonicman and @cipp-ashe for the reports.
Evidence
Real native Ollama through isolated
pnpm openclaw --profile noreply-tail-proof-<model> gateway run ...on macOS arm64, using the same prompt fixture and model parameters before and after. The after-run uses a task-owned Ollama 0.40.5 server with the same model weight files because the shared server stopped returning generation bytes. Ten fresh optional group conversations per model; each response actually emitted the trailing marker. The transport is the synthetic QA channel; live Discord, Matrix, and Telegram APIs were not exercised. Raw replay transcripts stay intact; the history column checks user-visiblechat.history.qwen3:4bqwen3:8bThe native matrix ran on
74666ba9a. Later follow-ups fix two test issues and preserve rawinput_text/output_textblocks during multipart projection. The native Ollamatext-block path retains the same shallow-copy behavior; the final payload regressions cover the additional source-preservation cases. All 20 final preview edits match the retained answer. Transient marker visibility remains possible with unbuffered streaming. The retained-response audit checks that history equals the provider text with only its final standalone line removed; permitted mid-text mentions stay visible.input_textandoutput_text: two new payload-boundary regressions fail before the repair (163.012s); the renderer now shallow-copies every native block before projection, without adding another classifier. The final payload suite passes 33/33 in 49.781s, including both source-preservation cases.c0effea2ca1b42329a2eb8ce7e80553a71af4589(5.233s). No baseline was weakened.pnpm openclaw --helppasses (46.076s). The live matrices take 602.098s before and 439.777s after, including startup/cleanup.Production +46/-33 (net +13); tests +169/-18; docs/instructions +3/-3. The small production increase preserves native multipart boundaries and applies the single classifier to displayed history. No model-facing prompt changes; token delta 0.
Final verification on
b5ff4fe0201fe3a27372e5fd9ecd10e720df53b1: CI run 38879716018 passed (50 successful jobs, 24 skipped), includingopenclaw/ci-gate, dependency review, and security-sensitive review. ClawSweeper reviewed this exact head: ready for maintainer review, no findings or Before merge items. Its remaining proof note is the documented absence of live external Discord/Matrix/Telegram runs; channel final edits have boundary-test coverage.