Skip to content

refactor: share streaming media tail boundary update - #146989

Merged
vincentkoc merged 1 commit into
mainfrom
refactor/streaming-media-tail-boundary-20260913
Sep 13, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
refactor/streaming-media-tail-boundary-20260913

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Sep 13, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Streaming reply handling repeats the same tail-boundary update for complete and partial MEDIA markers.

User Impact

No delivery behavior changes. Incomplete markers stay buffered, complete markers remain available to final parsing, and bracket-related whitespace handling is preserved.

Why This Change Was Made

Combine the two existing predicates before their shared boundary update. The full-marker whitespace rule and narrower partial-prefix rule remain distinct. Production changes: −8 lines; tests: +13 lines.

Evidence

  • Actual before/after splitter functions matched all 43,627 inputs covering marker prefixes, whitespace, line breaks and bracket tails. Imports and the entire accumulator outside the splitter remain byte-identical. This proof uses Node builtins only.
  • Exact-head CI34755174455 attempt1 and its aggregate gate passed. Job103718380102 ran all128 reply-utils tests, including the five new split-prefix cases through completed markers and final media parsing. Selected type/lint/format gates passed. This is hosted fixture proof, with no live-channel delivery claim.
  • Root and independent source reviews, fresh P2 autoreview, diff checks and normal commit formatting passed. The latest exact-head ClawSweeper review has no findings, Before merge items or Rank-up moves. Package-backed proof used hosted CI; the incompatible borrowed local installation was not reconciled.

@vincentkoc vincentkoc self-assigned this Sep 13, 2026
@clawsweeper

clawsweeper Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@vincentkoc
vincentkoc marked this pull request as ready for review September 13, 2026 11:43
@openclaw-barnacle openclaw-barnacle Bot added size: XS maintainer Maintainer-authored PR labels Sep 13, 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 Sep 13, 2026
@clawsweeper

clawsweeper Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 13, 2026, 1:34 PM ET / 17:34 UTC (Revision 2).

ClawSweeper review

What this changes

Combines complete and partial MEDIA marker checks into one buffering update and adds split-prefix coverage through final attachment parsing.

Merge readiness

✅ Ready for maintainer review

The refactor remains applicable and preserves the existing parsing behavior. No actionable findings remain; member authorship and the maintainer label also exclude automated closure.

Priority: P3
Reviewed head: d8494d13cce4e3ee5ff948c2d86a6a9c8eb4d9b4

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, behavior-preserving simplification with useful boundary coverage and verified successful CI on the reviewed head.
Proof confidence 🌊 off-meta tidepool Not applicable: The MEMBER-authored refactor is exempt from external-contributor runtime proof and changes no authority boundary; fixture equivalence and hosted CI support the parser review without claiming live delivery coverage.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The MEMBER-authored refactor is exempt from external-contributor runtime proof and changes no authority boundary; fixture equivalence and hosted CI support the parser review without claiming live delivery coverage.
Evidence reviewed 7 items Pinned introduced change: The introduced production hunk combines two side-effect-free predicates before their identical boundary update. Both regexes retain their original whitespace and case rules; bracket handling and accumulator state remain unchanged. git diff --check passed.
Behavioral coverage: The five added cases exercise M, ME, MED, MEDI, and MEDIA across chunk boundaries, final flushing, and attachment extraction. Existing neighboring tests cover mid-line prose, indentation, complete markers, malformed brackets, and reply context.
Current main still contains the duplication: The fetched main implementation retains the two separate boundary updates. Existing behavior already works; this PR contributes a source simplification rather than a missing delivery capability.
Findings None None.
Security None None.

How this fits together

OpenClaw’s streaming reply parser separates displayable text from unfinished directives arriving in model output. Buffered media markers remain available to final parsing, while ordinary text continues into reply delivery and live chat previews.

flowchart LR
  A[Model text chunks] --> B[Streaming directive parser]
  B --> C{Unfinished or media tail?}
  C -->|Yes| D[Buffer tail]
  C -->|No| E[Reply text and previews]
  D --> F[Next chunk or final parsing]
  F --> G[Final text and attachments]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -8, Tests +13. Total +5 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 1 9 -8
Tests 1 13 0 +13
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 14 9 +5

Review metrics

None.

Technical review

Best possible solution:

Keep the existing parser owner and distinct marker rules while sharing their identical boundary update.

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

Not applicable: this PR claims a behavior-preserving refactor, not a user-visible defect.

Is this the best way to solve the issue?

Yes: combining the unchanged predicates removes duplicate code without introducing another owner, API, or compatibility path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against adb6e518a442.

Labels

Label justifications:

  • P3: This is a bounded internal cleanup that preserves existing delivery behavior.
  • 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: The MEMBER-authored refactor is exempt from external-contributor runtime proof and changes no authority boundary; fixture equivalence and hosted CI support the parser review without claiming live delivery coverage.

Evidence

What I checked:

  • Pinned introduced change: The introduced production hunk combines two side-effect-free predicates before their identical boundary update. Both regexes retain their original whitespace and case rules; bracket handling and accumulator state remain unchanged. git diff --check passed. (src/auto-reply/reply/streaming-directives.ts:46, d8494d13cce4)
  • Behavioral coverage: The five added cases exercise M, ME, MED, MEDI, and MEDIA across chunk boundaries, final flushing, and attachment extraction. Existing neighboring tests cover mid-line prose, indentation, complete markers, malformed brackets, and reply context. (src/auto-reply/reply/reply-utils.test.ts:1593, d8494d13cce4)
  • Current main still contains the duplication: The fetched main implementation retains the two separate boundary updates. Existing behavior already works; this PR contributes a source simplification rather than a missing delivery capability. (src/auto-reply/reply/streaming-directives.ts:46, adb6e518a442)
  • Release comparison: The latest supplied release also retains the separate predicates and boundary updates; this cleanup is not present there. (src/auto-reply/reply/streaming-directives.ts:46, 3a9d69db306c)
  • Verified hosted validation: GitHub confirms that the cited CI run completed successfully on the exact reviewed head. The cited Node shard also reports success. The captured body reports 43,627 equivalence inputs and 128 reply-utils tests; those counts were not independently verified because the raw job-log redirect was blocked by the network allowlist. No target code or tests were executed during this review. (d8494d13cce4)
  • Area history and routing: Current-main history includes Vincent Koc’s earlier unmatched-bracket repair and Peter Steinberger’s recent streaming refactors. GitHub independently identifies vincentkoc on the earlier repair. Historical blob availability prevented complete local blame verification, so routing does not claim source-line introduction. (src/auto-reply/reply/streaming-directives.ts, db633878d7a3)

Likely related people:

  • vincentkoc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Peter Steinberger: 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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-13T11:51:53.981Z sha d8494d1 :: needs maintainer review before merge. :: none

@vincentkoc
vincentkoc merged commit f96fed1 into main Sep 13, 2026
256 of 257 checks passed
@vincentkoc
vincentkoc deleted the refactor/streaming-media-tail-boundary-20260913 branch September 13, 2026 17:35
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 13, 2026
* commit '201f11afefdb19a9c75e9d3542bf7425c80df7a7': (141 commits)
  fix: keep catalog discovery scoped and execution lazy (#147159)
  fix: serialize reclamation worker shutdown with foreground writes (#147178)
  test(sessions): cover abrupt committed transcript recovery (#143984)
  fix: stop transcript storms during context overflow recovery (#147202)
  fix: reduce CPU overhead for small history and usage reads (#147205)
  fix: resume tasks after tools finish and the model times out (#147203)
  refactor(scripts): share SQLite reliability message waits (#146900)
  feat(exec): configure approval reviewer thinking and fastMode (#147192)
  test: remove redundant Bonjour module headers (#146981)
  refactor: share streaming media tail boundary update (#146989)
  refactor(tui): classify resume candidates once (#146983)
  improve: skip unused toast dismissal work (#147196)
  fix(linux): recover saved remote connections without replacing active sessions (#146047)
  fix: doctor stays silent when Windows state dir is under OneDrive (#123720)
  feat: announce successful Daybreak retries (#147146)
  feat(code-mode): reuse results across code cells (#147154)
  refactor(test): reuse CLI plugin fixture writer (#147186)
  test: skip unused compiler setup in routing fixtures (#147194)
  test: reuse LINE webhook runtime fixture (#146710)
  fix(code-mode): check automation and process result types (#147143)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 14, 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