Repository navigation
refactor(agents): consolidate session text component reuse - #134105
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 31, 2026, 10:57 AM ET / 14:57 UTC. ClawSweeper reviewWhat this changesThe PR centralizes session-tool terminal text-component reuse in a shared helper and applies it to Bash, read, write, find, grep, and ls renderers. Merge readinessKeep open for normal maintainer review. The refactor is still necessary because current main retains the duplicated renderer sequence; the introduced helper preserves that sequence at each affected slot, with no concrete correctness or security finding. Priority: P3 Review scores
Verification
How this fits togetherSession tools define call and result renderers for the interactive terminal UI. Each render slot receives its prior component, refreshes it with current text, and returns it for display. flowchart LR
A[Session tool call or result] --> B[Tool-specific renderer]
B --> C[Shared text-component helper]
C --> D[Pi TUI text component]
D --> E[Interactive terminal UI]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -7, Tests +21, Other -3. Total +11 across 9 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Retain one shared helper for the identical Text lifecycle and land after normal exact-head CI and maintainer review. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR refactors existing terminal-renderer construction rather than addressing a reported user-visible failure. Is this the best way to solve the issue? Yes. A helper beside the existing rendering utilities removes repeated identical lifecycle code while preserving every affected renderer's slot-local behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 328f3ef8c20a. 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)
|
|
ClawSweeper rank-up move processed:
|
|
Merged via squash.
|
…134105) * refactor(agents): consolidate session text component reuse * chore: refresh CI after Windows worker repair * chore: refresh CI after gateway test repair
What Problem This Solves
Ten session tool text renderers independently repeated the same component construction, identity reuse, and text-cache invalidation sequence.
Why This Change Was Made
This consolidates that sequence in
reuseTextComponent, preserving the existing unchecked render-slot cast while making the sharedTextlifecycle explicit. The helper creates a zero-paddingTextwhen absent, callssetTextfor every render, and returns the same component instance.Installed
@earendil-works/pi-tuisource and types confirm the contract:TextimplementsComponent, andsetTextclears the cached text, width, and rendered lines before the next render.Renderer activation is explicitly out of scope.
wrapToolDefinitioncurrently drops these renderer hooks, so this PR does not claim a user-visible or live TUI behavior change.User Impact
No user-visible change. Bash, read, write-error, find, grep, and ls session text renderers retain their existing output and component identity semantics with one canonical implementation.
Evidence
node scripts/run-vitest.mjs src/agents/sessions/tools/render-utils.test.ts- 14 passed, 1 platform skip.pnpm check:changed- passed on the rebased diff.pnpm test:changed- first three partitions passed; the unit partition completed 10,807 passed and 17 skipped with one sparse-checkout fixture failure. Hydrating the trackedcustodian-skills/directory made that exact unrelated spec pass.git diff --check- passed.gpt-5.6-solhigh autoreview - scoped-clean, no actionable findings, overall correctness 0.99.bb46b79d3c1479f194a90afcf3dd69a1858a7898.codex-rs/cli/src/main.rs:220-245andcodex-rs/cli/src/main.rs:2840-2870are unrelated completion/config-normalization paths.