Repository navigation
fix(media): preserve CR line boundaries in reply output - #163665
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 October 2, 2026, 10:36 PM ET / October 3, 2026, 02:36 UTC (Revision 3). ClawSweeper reviewWhat this changesThe shared reply-media parser recognizes CR, CRLF, and LF line boundaries while preserving attachment paths, captions, and fenced literal text. Merge readiness✅ Ready for maintainer review This PR remains useful: current main still mishandles CR-only media replies. The pinned patch preserves the current quote-aware parser, has relevant after-fix Telegram evidence, and introduces no actionable correctness finding. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw parses model reply text into visible captions and attachment references before channel delivery. This shared parser also preserves code examples so literal MEDIA lines do not become attachments. flowchart TD
A[Model reply text] --> B[Reply directive parsing]
B --> C[Physical line boundaries]
C --> D{Literal code or media directive}
D --> E[Preserved caption and code]
D --> F[Validated attachment references]
E --> G[Channel delivery]
F --> G
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +11, Tests +72. Total +83 across 2 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep one shared parser that preserves physical reply boundaries and literal code while producing correct captions and attachment references. Do we have a high-confidence way to reproduce the issue? Yes: current main's LF-only splitter leaves a CR-separated MEDIA path and caption on one line, matching the supplied baseline ENOENT result. This review established the path from source without executing target code. Is this the best way to solve the issue? Yes: extending the existing shared parser repairs the boundary error without introducing a competing transport implementation or changing media validation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b1a22b83d878. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
# Conflicts: # src/media/parse-output.ts
|
Landed as 6aa1200. Thanks @ly85206559! |
) Replies whose `MEDIA:` line is separated by CR-only line endings were parsed as one line, so the attachment path swallowed the caption and the attachment failed (ENOENT). The shared quote-aware MEDIA splitter now treats a bare CR as a line break. LF and CRLF replies, and quoted paths with spaces, are unchanged. Proof: replaying the reply on base swallowed the caption into the quoted path and failed. On this change, a built Gateway delivered the photo with its caption on the Telegram Test Server. The regression tests fail on base (7) and pass here. A live gpt-5-mini call passed, with the photo and caption both seen in Telegram. Co-authored-by: Ayaan Zaidi <[email protected]>
* fix(sqlite): preserve transaction outcomes when warnings throw Keep diagnostic failures from abandoning a successful BEGIN, rejecting a completed COMMIT, or replacing the original native lock error. Transaction admission, commit authority, and rollback behavior remain unchanged. * fix(sqlite): integrate transaction warning guards with main * fix(sqlite): preserve warning isolation on current main * fix(sqlite): integrate fixed main for CI * commit '5c894c71b889408c0bf583ae4aa08e36129ab3a4': (186 commits) fix(gateway): keep worker bootstrap within lint limits (#163959) fix(media): preserve CR line boundaries in reply output (#163665) perf(plugins): admit plugins at load and delete the per-value boundary (#163818) feat(gateway): declarative role assignment by GitHub login (#163825) fix(release): 2026.10.1 plugin scan rejects reviewed inventory (#163920) fix(gateway): keep tool-policy config changes hot and drain forced restarts (#163931) fix(onboard): reruns overwrite trusted-proxy authentication (#150992) test(gateway): expect approved local legacy node capabilities refactor(reporting): bind plugin timers to service lifetimes (#163918) fix(gateway): report agent-store inspection as retryable while startup inspection continues (#163839) fix(test): route worker-state suites through brokers (#163915) fix(test): keep beta release fixtures version-independent (#163933) fix(telegram): keep queued albums alive and ordered per conversation (#163926) fix(test): stabilize update startup channel fixture (#163932) fix(release): derive future first-hop fixture versions (#163952) fix(test): parallelize model catalog fixture setup (#163944) test(infra): check policy parity without Swift aliases refactor(codex): split the session catalog index below the max-lines cap (#163809) test(plugins): remove low-value tests (batch d162) (#163951) test(cli): expect update reasons in JSON stderr ... * chore: integrate canonical spawn boundary qualification repair * fix(sqlite): preserve transaction outcomes when warnings throw Integrate current main while preserving the existing PR ancestry. Contain transaction-step diagnostics at their centralized owner and retain native admission, classification, rollback, and timing behavior. Validated remotely: six causal baseline failures with seven passing controls; 62 focused Linux cases with zero skips; scoped formatting, lint, and production/test types. Fresh source review found no actionable findings. Co-authored-by: Vincent Koc <[email protected]>
…law#157151) * fix(sqlite): preserve transaction outcomes when warnings throw Keep diagnostic failures from abandoning a successful BEGIN, rejecting a completed COMMIT, or replacing the original native lock error. Transaction admission, commit authority, and rollback behavior remain unchanged. * fix(sqlite): integrate transaction warning guards with main * fix(sqlite): preserve warning isolation on current main * fix(sqlite): integrate fixed main for CI * commit 'f233854c1220a7370c087ef5e21a378c7d01e430': (186 commits) fix(gateway): keep worker bootstrap within lint limits (openclaw#163959) fix(media): preserve CR line boundaries in reply output (openclaw#163665) perf(plugins): admit plugins at load and delete the per-value boundary (openclaw#163818) feat(gateway): declarative role assignment by GitHub login (openclaw#163825) fix(release): 2026.10.1 plugin scan rejects reviewed inventory (openclaw#163920) fix(gateway): keep tool-policy config changes hot and drain forced restarts (openclaw#163931) fix(onboard): reruns overwrite trusted-proxy authentication (openclaw#150992) test(gateway): expect approved local legacy node capabilities refactor(reporting): bind plugin timers to service lifetimes (openclaw#163918) fix(gateway): report agent-store inspection as retryable while startup inspection continues (openclaw#163839) fix(test): route worker-state suites through brokers (openclaw#163915) fix(test): keep beta release fixtures version-independent (openclaw#163933) fix(telegram): keep queued albums alive and ordered per conversation (openclaw#163926) fix(test): stabilize update startup channel fixture (openclaw#163932) fix(release): derive future first-hop fixture versions (openclaw#163952) fix(test): parallelize model catalog fixture setup (openclaw#163944) test(infra): check policy parity without Swift aliases refactor(codex): split the session catalog index below the max-lines cap (openclaw#163809) test(plugins): remove low-value tests (batch d162) (openclaw#163951) test(cli): expect update reasons in JSON stderr ... * chore: integrate canonical spawn boundary qualification repair * fix(sqlite): preserve transaction outcomes when warnings throw Integrate current main while preserving the existing PR ancestry. Contain transaction-step diagnostics at their centralized owner and retain native admission, classification, rollback, and timing behavior. Validated remotely: six causal baseline failures with seven passing controls; 62 focused Linux cases with zero skips; scoped formatting, lint, and production/test types. Fresh source review found no actionable findings. Co-authored-by: Vincent Koc <[email protected]>
* fix: revalidate unchanged managed image thumbnails * fix(gateway): integrate conditional thumbnail responses with main * fix(gateway): keep thumbnail response handling in its owner * fix(gateway): integrate thumbnail validation with attachment retention * fix(gateway): integrate fixed main for CI * commit '5c894c71b889408c0bf583ae4aa08e36129ab3a4': (178 commits) fix(gateway): keep worker bootstrap within lint limits (#163959) fix(media): preserve CR line boundaries in reply output (#163665) perf(plugins): admit plugins at load and delete the per-value boundary (#163818) feat(gateway): declarative role assignment by GitHub login (#163825) fix(release): 2026.10.1 plugin scan rejects reviewed inventory (#163920) fix(gateway): keep tool-policy config changes hot and drain forced restarts (#163931) fix(onboard): reruns overwrite trusted-proxy authentication (#150992) test(gateway): expect approved local legacy node capabilities refactor(reporting): bind plugin timers to service lifetimes (#163918) fix(gateway): report agent-store inspection as retryable while startup inspection continues (#163839) fix(test): route worker-state suites through brokers (#163915) fix(test): keep beta release fixtures version-independent (#163933) fix(telegram): keep queued albums alive and ordered per conversation (#163926) fix(test): stabilize update startup channel fixture (#163932) fix(release): derive future first-hop fixture versions (#163952) fix(test): parallelize model catalog fixture setup (#163944) test(infra): check policy parity without Swift aliases refactor(codex): split the session catalog index below the max-lines cap (#163809) test(plugins): remove low-value tests (batch d162) (#163951) test(cli): expect update reasons in JSON stderr ... * chore: integrate canonical spawn boundary qualification repair * fix(gateway): preserve WebP thumbnail revalidation on main * test(gateway): preserve thumbnail fixture module exports Co-authored-by: Vincent Koc <[email protected]>
* fix: revalidate unchanged managed image thumbnails * fix(gateway): integrate conditional thumbnail responses with main * fix(gateway): keep thumbnail response handling in its owner * fix(gateway): integrate thumbnail validation with attachment retention * fix(gateway): integrate fixed main for CI * commit 'f233854c1220a7370c087ef5e21a378c7d01e430': (178 commits) fix(gateway): keep worker bootstrap within lint limits (openclaw#163959) fix(media): preserve CR line boundaries in reply output (openclaw#163665) perf(plugins): admit plugins at load and delete the per-value boundary (openclaw#163818) feat(gateway): declarative role assignment by GitHub login (openclaw#163825) fix(release): 2026.10.1 plugin scan rejects reviewed inventory (openclaw#163920) fix(gateway): keep tool-policy config changes hot and drain forced restarts (openclaw#163931) fix(onboard): reruns overwrite trusted-proxy authentication (openclaw#150992) test(gateway): expect approved local legacy node capabilities refactor(reporting): bind plugin timers to service lifetimes (openclaw#163918) fix(gateway): report agent-store inspection as retryable while startup inspection continues (openclaw#163839) fix(test): route worker-state suites through brokers (openclaw#163915) fix(test): keep beta release fixtures version-independent (openclaw#163933) fix(telegram): keep queued albums alive and ordered per conversation (openclaw#163926) fix(test): stabilize update startup channel fixture (openclaw#163932) fix(release): derive future first-hop fixture versions (openclaw#163952) fix(test): parallelize model catalog fixture setup (openclaw#163944) test(infra): check policy parity without Swift aliases refactor(codex): split the session catalog index below the max-lines cap (openclaw#163809) test(plugins): remove low-value tests (batch d162) (openclaw#163951) test(cli): expect update reasons in JSON stderr ... * chore: integrate canonical spawn boundary qualification repair * fix(gateway): preserve WebP thumbnail revalidation on main * test(gateway): preserve thumbnail fixture module exports Co-authored-by: Vincent Koc <[email protected]>
…law#157151) * fix(sqlite): preserve transaction outcomes when warnings throw Keep diagnostic failures from abandoning a successful BEGIN, rejecting a completed COMMIT, or replacing the original native lock error. Transaction admission, commit authority, and rollback behavior remain unchanged. * fix(sqlite): integrate transaction warning guards with main * fix(sqlite): preserve warning isolation on current main * fix(sqlite): integrate fixed main for CI * commit '5c894c71b889408c0bf583ae4aa08e36129ab3a4': (186 commits) fix(gateway): keep worker bootstrap within lint limits (openclaw#163959) fix(media): preserve CR line boundaries in reply output (openclaw#163665) perf(plugins): admit plugins at load and delete the per-value boundary (openclaw#163818) feat(gateway): declarative role assignment by GitHub login (openclaw#163825) fix(release): 2026.10.1 plugin scan rejects reviewed inventory (openclaw#163920) fix(gateway): keep tool-policy config changes hot and drain forced restarts (openclaw#163931) fix(onboard): reruns overwrite trusted-proxy authentication (openclaw#150992) test(gateway): expect approved local legacy node capabilities refactor(reporting): bind plugin timers to service lifetimes (openclaw#163918) fix(gateway): report agent-store inspection as retryable while startup inspection continues (openclaw#163839) fix(test): route worker-state suites through brokers (openclaw#163915) fix(test): keep beta release fixtures version-independent (openclaw#163933) fix(telegram): keep queued albums alive and ordered per conversation (openclaw#163926) fix(test): stabilize update startup channel fixture (openclaw#163932) fix(release): derive future first-hop fixture versions (openclaw#163952) fix(test): parallelize model catalog fixture setup (openclaw#163944) test(infra): check policy parity without Swift aliases refactor(codex): split the session catalog index below the max-lines cap (openclaw#163809) test(plugins): remove low-value tests (batch d162) (openclaw#163951) test(cli): expect update reasons in JSON stderr ... * chore: integrate canonical spawn boundary qualification repair * fix(sqlite): preserve transaction outcomes when warnings throw Integrate current main while preserving the existing PR ancestry. Contain transaction-step diagnostics at their centralized owner and retain native admission, classification, rollback, and timing behavior. Validated remotely: six causal baseline failures with seven passing controls; 62 focused Linux cases with zero skips; scoped formatting, lint, and production/test types. Fresh source review found no actionable findings. Co-authored-by: Vincent Koc <[email protected]> (cherry picked from commit 5cc6f4a) Co-authored-by: RomneyDa <[email protected]>
What Problem This Solves
A CR-only
MEDIA:response treats the following caption as part of the attachment path, so an existing file cannot be delivered and the caption disappears. CR-only fenced literals are also misread.User Impact
Replies with LF, CRLF, CR, or mixed line endings retain the correct attachment paths, captions, and fenced literal content. No configuration, dependency, or public API changes.
Why This Change Was Made
The shared media-output parser recognizes physical line boundaries, advances source offsets by the actual separator width, and preserves surviving text separators. It extends the existing owner, not a transport-specific splitter. The conflict integration preserves current main's consolidated quote-aware MEDIA payload parser, including quoted paths containing spaces.
Original fix and regression coverage by @ly85206559; contributor commits are preserved. No overlap with Pash/Sarah changes.
Evidence
9cc3eee461ed564ee008f3090702d114e533b949: replayingMEDIA:"/ws/quoted photo.png"followed by CR andCR_CAPTION_163665produces an empty caption and a nonexistent filename containing the caption (ENOENT). LF and CRLF load the same 665-byte PNG and preserve the caption. Candidate preserves all three cases.8d94b27c7eddb7fd5dc8348ee7cd097d3e21d921: an isolated built Gateway received the deterministic CR-only model response and delivered a real Telegram Test ServermessagePhotowith captionCR_CAPTION_163665(observed message50039095296, 3.374s after recording began). The attachment path contains a quoted space. One fixture-provider request.gpt-5-minicall through a passive recording proxy, HTTP 200, utility jobs disabled. The independent Telegram user observedmessagePhoto50041192448, captionCR_CAPTION_163665, replying to the sent action. No response rewriting.node scripts/run-vitest.mjs src/media/parse.test.ts --maxWorkers=1: baseline 7 failed / 190 passed, candidate 197 passed. Wall time 2.09s / 1.79s; Vitest duration 666ms / 517ms. Includes LF, CRLF, CR, mixed separators, fences and quoted-path controls. No test sleeps added.Hosted CI and ClawSweeper must evaluate the new exact head; earlier green CI/review applies only to the contributor head.