Skip to content

refactor(chat): share terminal ack normalization - #130263

Merged
vincentkoc merged 1 commit into
mainfrom
refactor/terminal-chat-send-ack-status
Aug 26, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
refactor/terminal-chat-send-ack-status

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Aug 26, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

ACP and TUI independently normalized the same terminal chat.send acknowledgement statuses. Keeping those predicates duplicated makes the accepted terminal set easier to drift across two operator-facing clients.

Why This Change Was Made

Move the existing ok / timeout / error normalization into one private shared helper and reuse it from ACP and TUI. Each caller keeps its existing success, failure, cleanup, and non-terminal behavior.

User Impact

No user-visible behavior change. Terminal chat acknowledgements now have one canonical normalization path across ACP and TUI.

Evidence

  • Focused ACP, TUI, and helper tests: 260 passed.
  • Fresh AWS Crabbox run run_33c91e58be63 on lease cbx_ba45a4cdcebf: frozen install passed; all 260 tests passed; lease stopped.
  • pnpm check:import-cycles: 0 runtime value cycles.
  • check-changed: passed.
  • Autoreview: clean, 0.99 confidence.
  • Production delta: +17 / -25, net -8 lines. Tests: +19 lines.

@clawsweeper

clawsweeper Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@vincentkoc vincentkoc self-assigned this Aug 26, 2026
@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Aug 26, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review August 26, 2026 17:35
@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 Aug 26, 2026
@clawsweeper

clawsweeper Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 1:42 PM ET / 17:42 UTC.

ClawSweeper review

What this changes

The PR centralizes ACP and terminal-UI handling of terminal chat.send acknowledgement statuses in a shared private helper.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

Keep this maintainer-owned refactor open. Current main still has the duplicated ACP and TUI acknowledgement predicates, while the PR replaces them with one private, behavior-preserving normalization boundary backed by existing client behavior tests and a focused helper test.

Priority: P3
Reviewed head: 4ccc8994747f1e923ae67a77b6bc9e53c8936dd9

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is a focused, net-negative consolidation with direct contract coverage and preserved caller-level behavior tests.
Proof confidence 🌊 off-meta tidepool Not applicable: This MEMBER-authored, behavior-preserving refactor is outside the external-contributor real-behavior-proof gate; the supplied focused Crabbox test run is supplemental evidence.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This MEMBER-authored, behavior-preserving refactor is outside the external-contributor real-behavior-proof gate; the supplied focused Crabbox test run is supplemental evidence.
Evidence reviewed 8 items Current main remains duplicated: Current main has separate local terminal-status predicates in ACP, so it does not yet implement the PR's central consolidation.
TUI semantics on current main: Current main independently classifies timeout and error as failure and ok as terminal in the TUI, matching the helper's three-value contract.
Shared boundary is narrow: The new helper normalizes input through the repository coercion contract and returns only ok, timeout, error, or undefined.
Findings None None.
Security None None.

Live Verification

Command: node scripts/run-vitest.mjs run src/shared/chat-send-ack-status.test.ts src/acp/translator.lifecycle.test.ts src/tui/tui-command-handlers.test.ts

Result: PASS (completed)

[test] starting test/vitest/vitest.unit-fast.config.ts

 RUN  v4.1.11 /tmp/clawsweeper-live-proof-130263-yBazpH/target

 ✓  unit-fast  src/shared/chat-send-ack-status.test.ts (10 tests) 5ms

 Test Files  1 passed (1)
      Tests  10 passed (10)
   Start at  17:43:52
   Duration  298ms (transform 95ms, setup 101ms, import 26ms, tests 5ms, environment 0ms)

[test] starting test/vitest/vitest.tui.config.ts

 RUN  v4.1.11 /tmp/clawsweeper-live-proof-130263-yBazpH/target

 ✓  tui  src/tui/tui-command-handlers.test.ts (219 tests) 1434ms
     ✓ uses the effective runtime for the no-arg /think usage  584ms

 Test Files  1 passed (1)
      Tests  219 passed (219)
   Start at  17:43:53
   Duration  11.53s (transform 7.88s, setup 1.01s, import 8.72s, tests 1.43s, environment 0ms)

[test] starting test/vitest/vitest.acp.config.ts

 RUN  v4.1.11 /tmp/clawsweeper-live-proof-130263-yBazpH/target

 ✓  acp  src/acp/translator.lifecycle.test.ts (14 tests) 110ms

 Test Files  1 passed (1)
      Tests  14 passed (14)
   Start at  17:44:05
   Duration  2.45s (transform 1.75s, setup 1.00s, import 973ms, tests 110ms, environment 0ms)

[test] passed 3 Vitest shards in 27.88s
[test] starting test/vitest/vitest.unit-fast.config.ts

 RUN  v4.1.11 /tmp/clawsweeper-live-proof-130263-yBazpH/target

 ✓  unit-fast  src/shared/chat-send-ack-status.test.ts (10 tests) 5ms

 Test Files  1 passed (1)
      Tests  10 passed (10)
   Start at  17:44:21
   Duration  217ms (transform 22ms, setup 34ms, import 15ms, tests 5ms, environment 0ms)

[test] starting test/vitest/vitest.tui.config.ts

 RUN  v4.1.11 /tmp/clawsweeper-live-proof-130263-yBazpH/target

Assertions:

  • PASS expect_output: Test Files

How this fits together

ACP and the terminal UI both submit chat turns through the Gateway and interpret immediate acknowledgements before updating prompt or viewport state. The shared helper classifies only terminal ok, timeout, and error responses; each client retains its own completion and cleanup behavior.

flowchart LR
  A[Operator prompt] --> B[ACP or terminal UI]
  B --> C[Gateway chat request]
  C --> D[Chat acknowledgement]
  D --> E[Shared terminal-status normalization]
  E --> F[Client completion or error handling]
Loading

Before merge

  • Complete next step (P2) - This member-authored, maintainer-labeled PR needs the normal exact-head CI and merge review path rather than an automated repair.
Agent review details

Security

None.

PR surface

Source -8, Tests +19. Total +11 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 3 17 25 -8
Tests 1 19 0 +19
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 36 25 +11

Review metrics

Metric Value Why it matters
Production versus test delta production −8 lines; tests +19 lines The refactor removes duplicated production predicates while adding focused contract coverage.

Technical review

Best possible solution:

Rebase onto current main, retain the private shared helper and focused mapping test, then merge after exact-head checks complete.

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

Not applicable: this PR refactors an existing internal acknowledgement classification rather than reporting a user-facing defect.

Is this the best way to solve the issue?

Yes. A narrow private helper removes duplicated terminal-status policy while preserving the ACP and TUI callers' distinct lifecycle behavior.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 3be7baa1a37c.

Labels

Label changes:

  • add P3: This is a small behavior-preserving maintenance refactor with no stated user-visible change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This MEMBER-authored, behavior-preserving refactor is outside the external-contributor real-behavior-proof gate; the supplied focused Crabbox test run is supplemental evidence.

Label justifications:

  • P3: This is a small behavior-preserving maintenance refactor with no stated user-visible change.
  • 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: This MEMBER-authored, behavior-preserving refactor is outside the external-contributor real-behavior-proof gate; the supplied focused Crabbox test run is supplemental evidence.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Current-main blame attributes both ACP and TUI terminal acknowledgement predicates to the same feature introduction. (role: introduced the current duplicated behavior; confidence: high; commits: 8c1c1f8c8f50; files: src/acp/translator.prompt-stream.ts, src/tui/tui-command-handlers.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Rebase onto current main and allow the required exact-head checks to complete.

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.

@vincentkoc
vincentkoc merged commit 4c72e55 into main Aug 26, 2026
761 of 770 checks passed
@vincentkoc
vincentkoc deleted the refactor/terminal-chat-send-ack-status branch August 26, 2026 18:35
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

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: S 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