Repository navigation
refactor(terminal): replay wrapped prefixes in one pass - #139240
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 5, 2026, 2:02 PM ET / 18:02 UTC. ClawSweeper reviewWhat this changesThe PR combines text collection and style/link reconstruction into one pass when wrapping terminal table cells, preserving the existing output. Merge readiness✅ Ready for maintainer review This remains a useful simplification absent from fetched main. No actionable correctness or security findings; the protected maintainer PR should remain open. Priority: P3 Review scores
Verification
How this fits togetherThe shared terminal table renderer turns CLI report rows into aligned text. It preserves colors and hyperlinks across wrapped cells before adding padding and borders. flowchart LR
A[CLI report rows] --> B[Table layout]
B --> C[Text and control tokens]
C --> D[Select emitted prefix]
D --> E[Collect text and continuation state]
E --> F[Close styles and links]
F --> G[Pad and print table]
E --> H[Reopen state for remaining text]
H --> D
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -14. Total -14 across 1 file. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep prefix replay inside the table renderer, using one local traversal and the existing parsers and continuation rules. Do we have a high-confidence way to reproduce the issue? Not applicable: this proposes a behavior-preserving refactor, not a reported failure; source confirms the repeated prefix traversals. Is this the best way to solve the issue? Yes. Consolidating the independent text/style/link passes at their existing owner is simpler than retaining single-use helpers or adding a shared abstraction; parsing and caller contracts remain intact. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 7af054ec87ad. 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 '911d7d5b0c107f7274f2415ca9655dcc6105f0e8': (867 commits) fix(skills): deliver pending Workshop approval controls (#139248) fix(gateway): deliver loopback ask_user prompts to the originating channel (#138831) docs: keep root agent instructions focused on repository policy (#139258) fix(matrix): exclude archived state roots from scans and selection (#112329) perf(agents): prepare exact tool names once per catalog batch (#139267) fix: preserve Swarm progress and simplify owner plumbing (#139269) fix(tailscale): release claims after gateway process-group exit (#139261) refactor(cli): simplify lazy command registration (#139108) test(ui): retain synthetic widget failure evidence (#139229) fix(buzz): keep implicit replies at thread root (#138879) test(diagnostics): await graceful Gateway shutdown before cleanup (#139247) fix(ci): unblock releases with different tooling package managers (#139259) feat(ui): add social preview links for private sessions (#139250) fix(codex): retain failed conversations for guarded continuation (#139246) chore(ui): refresh control ui locales (#139200) fix(ci): run browser checks for real-gateway inputs (#139256) fix(llama-cpp): reconcile managed router state before requests (#136363) chore(i18n): refresh native locales (#139237) refactor(worker): unify inference payload handling (#139245) refactor(terminal): replay wrapped prefixes in one pass (#139240) ...
Additional instructions
MUST: Keep Allow edits from maintainers enabled for this PR.
What Problem This Solves
Wrapped terminal cells traversed the same emitted prefix separately to collect text, reconstruct SGR styles, and reconstruct OSC-8 links. Two single-use helpers duplicated the replay structure.
Why This Change Was Made
Collect token values and update both continuation states in one local pass, then join the values once. The emitted prefix remains the sole owner of continuation state; buffered suffixes, style category order, and close/reopen ordering retain their existing behavior.
User Impact
The same table output with fewer token traversals and 14 fewer production lines. Wrapping, colors, links, Unicode widths, tabs/newlines and large-buffer handling retain their existing contracts.
Evidence
All 2,196 metric comparisons, including 897 adverse-direction values, remain recorded. Dense-control batch tails worsened in both orders, and first-call/memory results were mixed. These modest component gains support the local simplification; they do not establish a general CLI/Gateway latency or memory improvement. Actual terminal-emulator behavior was not part of this source-render comparison.
Current-main composition at
426ca0d50f303c7cbec46741be7ff51e99145a18is clean and the relevant table/parser/test owners are unchanged from the measured base. Production +22/−36, tests unchanged. No dependency, public API, configuration or intended visual-output change.