Skip to content

refactor: fold single-consumer frames into their owners - #181653

Merged
steipete merged 1 commit into
mainfrom
deslop/z25-133-private-owner-frames-20261015
Oct 23, 2026
Merged

steipete merged 1 commit into
mainfrom
deslop/z25-133-private-owner-frames-20261015

Conversation

@steipete

@steipete steipete commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Internal owners still carry single-use helper modules and named frames that make their only consumer harder to follow.

User Impact

No user-visible change, migration, or action required. Public SDK, protocol, config, CLI, and package exports remain intact; lazy-import boundaries and security checks are unchanged.

Why This Change Was Made

Fold single-consumer helpers into their existing owners and replace private, single-annotation aliases with their exact structural types. Terminal rendering coverage now exercises the real tool read path rather than a test-only exported helper. The provider-refusal parser lives in the diagnostics module that already publicly re-exported it; both package entry points remain supported.

Net production reduction: 153 lines (+299/-452 across 38 paths). Tests shrink by 9 lines; one orphaned wrapper-inventory row is also removed, neither counted as production.

Best-effort tradeoffs accepted

None added: this cut removes indirection, not guards or supported edge-case behavior. Existing validation, bounds, authority checks, ordering, and accepted terminal-emulation limitations remain unchanged. The standalone session-memory backend is untouched.

Evidence

Focused owner tests pass across terminal reads, HTTP/RPC invocation, proxy errors and prompt-prefix stability, rate-limit/failure copy, media parsing, Team Reports, logs, diagnostics, routing, session titles, YouTube links, and the changed UI type consumers. Targeted native typing, typed lint, and format pass per packet. The terminal's 16 rendering inputs and both refusal-parser cases passed through their public entry points before and after folding.

Final format parity, assertion/mock-export ratchets, lint-suppression tests, wrapper/eager-import closure, line caps, and UI controller guards pass. Runtime and static import cycles are both zero. Fresh isolated Codex review completed with no actionable P0–P2 findings.

Changed-test local wrapper wall times: terminal suite 34.98 seconds (including worker preparation), refusal suite 3.07 seconds. No timeouts, retries, skips, suppressions, or kept-behavior expectations were relaxed. Broad builds, whole-graph typing, and E2E are left to exact-head hosted CI under the campaign CPU budget; no live-channel or device proof is claimed.

Exact-head CI run 39961017564 completed with two inherited test leaves (four assertions) and the downstream aggregate; all 104 jobs and 242 checks were enumerated. Three cron delivery-source-ID mismatches and one subagent progress-card retirement mismatch match independent scheduled-main executions, with 23 unchanged determining inputs. Security checks and review statuses pass. The complete failure table and tested-merge attribution records the native inherited-failure exception; CI is not relabelled green. No CI rerun, rebase or repush.

@clawsweeper

clawsweeper Bot commented Oct 23, 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.

@steipete
steipete marked this pull request as ready for review October 23, 2026 13:25
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-23T13:28:04.506750Z 6118fe3 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui gateway Gateway runtime cli CLI command changes scripts Repository scripts agents Agent runtime and tooling plugin: team-reports size: L labels Oct 23, 2026
@steipete
steipete enabled auto-merge (squash) October 23, 2026 13:31
@steipete
steipete disabled auto-merge October 23, 2026 13:42
@steipete

Copy link
Copy Markdown
Contributor Author

Exact-head CI attribution for 6118fe354e8af8796a542ce0b85be624c9eaec0c:

CI run 39961017564, attempt 1 completed with two failed test jobs and their downstream aggregate. All 104 CI jobs and 242 check runs were enumerated. Security checks and both independent review statuses passed. Six cancelled contexts are superseded advisory auto-response/context automation, not cancelled runtime or security suites.

Failed job Exact failures Independent scheduled-main evidence
compact-small-3 / 120439370425 run.operator-continuation.test.ts: restart boundary; restart with prior operator source; restart with prior operator source and steering. All three assert restartRecoveryDeliverySourceRunId at line 763 and receive a different UUID. All three signatures occur on scheduled main 39946814546 / job 120391829344, also personally observed on the other five earlier scheduled runs. Eleven determining inputs are unchanged.
compact-large-13 / 120439370435 subagent-control.worker.test.ts: “settles the progress card according to intentional external silence”; draft.retire expected once, called zero times, stack lines 616/652. Exact title, assertion and stack independently refreshed on scheduled main 39919120448 / job 120300139686, within the current last-six completed schedule window. Twelve determining inputs are unchanged.
openclaw/ci-gate / 120446244078 Downstream aggregate of those two leaves. The automatic table says “unknown” because the newest scheduled run has different job planning. Attribution above compares exact failures, not job names.

Both failed jobs actually tested merge 8b5b70b5d331377a3201947aabd6b932c2f9fd7c, whose ordered parents are main 538efdf2794e0ffdc2aa4f486a6f4b6ed1e004fa and this PR head. Its tree was reconstructed and matched; the branch base was not substituted for the tested merge. All 23 selected determining source blobs match their positive scheduled baselines and the actual CI merge.

This is matching-signature inherited attribution, not a full dependency-disjointness claim: the subagent test imports the changed terminal tool through the coding-tool owner, and intervening main changes in subagent delivery are disclosed. The inspected folds preserve those algorithms and checks; the exact failures already execute on independent main. No failure is reported fixed or relabelled green.

Proceeding through the native inherited-failure exception under the standing maintainer instruction. The earlier accepted auto request was explicitly retired once before selecting the same reviewed head. No CI rerun, rebase, repush, weakened assertion, timeout, retry, skip, suppression or security waiver.

@clawsweeper

clawsweeper Bot commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR folds private single-consumer helpers into their existing owners and replaces private type aliases with equivalent inline types.

Example: An agent reads terminal output containing 10%\r20%\r100%\ndone.

  • Before: The separate terminal renderer returns 100%\ndone.
  • After: The terminal tool’s private renderer returns the same text.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A useful, source-consistent consolidation with meaningful retained tests; evidence is primarily in-process coverage, and the exact-head CI gate remains red on independently observed failure signatures.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored behavior-preserving refactor is outside the contributor proof gate; supplied evidence consists of reported owner tests and CI, including terminal reads through an injected PTY backend, with no live-channel or device proof claimed.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
Reason: The maintainer-authored direction removes single-consumer indirection and test-only exposure without adding configuration, changing public contracts, or expanding behavior.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-directed refactor removes private indirection without an identified behavior regression, and both failing test signatures also occur on another merged PR.

Priority: P3
Reviewed head: 6118fe354e8af8796a542ce0b85be624c9eaec0c

Before merge

None.

Findings

None.

Agent review details

How this fits together

Gateway tools, agent error handling, shared parsers, Team Reports, and Control UI owners consume requests and runtime facts and produce tool results, messages, or presentation data.

flowchart LR
  Clients[CLI and Control UI] --> Gateway[Gateway invocation owner]
  Gateway --> Tools[Agent tools]
  Tools --> Results[Tool results]
  Providers[Provider responses] --> Parsers[Diagnostics and text owners]
  Parsers --> Results
Loading

Technical review

Best possible solution:

Land the owner-local consolidation through the existing CI policy while preserving the public exports and established runtime contracts.

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

This PR claims a behavior-preserving refactor rather than a bug fix; source comparison supports that scope, and this review executed no target code.

Is this the best way to solve the issue?

Applying pr-simplify steps 1–3 found a complete cutover using existing owners, equivalent inline types, and retained observable terminal cases without new machinery.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Terminal rendering keeps the original intent (5938c78: Terminal replay and plain-text reads were introduced together; later changes preserved carriage-return semantics and filtered C1 controls.)
  • Provider-refusal parsing keeps the original intent (48f664c: Preserve bounded, exact provider findings and continuation text for explicit operator review.)
  • Gateway upload classification and action merging keeps the original intent (feat(gateway): let operators disable client file and image uploads #158567: Reject disabled client uploads through shared HTTP/RPC invocation while retaining final-write policy checks; action merging originated with the shared tools.invoke engine.)
  • Rate-limit reply copy keeps the original intent (c0effea: Keep saved-login labels out of public cooldown replies while retaining provider-authored recovery guidance.)
  • Proxy error-body reading keeps the original intent (cc75783: Fail fast on oversized or stalled proxy responses; the inline implementation retains the same byte limit, timeout, decoding, and catch behavior.)
  • UI parsing, route memory, and session-link titles keeps the original intent (feat: play YouTube videos inline in Control UI chats #164576: Existing owners normalize supported YouTube links, prevent one-shot drafts from replaying, and resolve titled session links; the folds retain those decisions and outputs.)
  • Private structural types keeps the original intent (unknown: Scoped history, including earlier UI paths, shows incremental feature work and consolidation rather than one originating decision for these aliases; their exact structural contracts remain unchanged.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 20d748a adds src/agents/tools/terminal-tool.ts:238 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 20d748a4f0e6; files: src/agents/tools/terminal-tool.ts)
  • Ayaan Zaidi: Raw commit 52f445a adds ui/src/lib/chat/thinking.ts:62 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 52f445a0b104; files: ui/src/lib/chat/thinking.ts)
  • Pavan Kumar Gondhi: Raw commit c0effea adds src/agents/failover/user-copy.ts:444 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: c0effea2ca1b; files: src/agents/failover/user-copy.ts)

PR surface

Source -153, Tests -9, Other -1. Total -163 across 42 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 38 299 452 -153
Tests 3 32 41 -9
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 0 1 -1
Total 42 331 494 -163

Review metrics

Metric Value Why it matters
Production versus test LOC Production +299/-452; tests +32/-41 The reduction removes private indirection while moving terminal coverage to its production consumer.

Labels

Label changes:

  • add P3: This is internal cleanup with no intended user-visible behavior change.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P3: This is internal cleanup with no intended user-visible behavior change.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 23, 2026, 9:43 AM ET / 13:43 UTC.

@steipete
steipete merged commit 5014091 into main Oct 23, 2026
244 of 254 checks passed
@steipete
steipete deleted the deslop/z25-133-private-owner-frames-20261015 branch October 23, 2026 13:47
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 24, 2026
Grynn added a commit to Grynn/openclaw that referenced this pull request Nov 13, 2026
Semantically retain 9f935a5 through the current terminal read owner. Default reads return the latest 32,768 raw UTF-16 units; optional cursor and maxChars provide incremental pages capped at 131,072 units, with retained-range, truncation and remaining-output metadata. Advance past a leading surrogate half and preserve a complete pair at the page end, including a one-unit forward budget.

Derive absolute cursor ranges from the existing output controller and ring, with no new persistent state. Keep the current ownedSession adoption/exact-incarnation gate and retain snapshotAgent for existing input checks and consumers. Incognito policy, current-run input authority, operator approval and shell-creation restrictions remain untouched. Document raw-output cursor semantics and how a prior cursor detects eviction.

Proof: seven intended baseline failures; 83 focused tool, terminal lifecycle/rendering, Incognito and prompt-prefix checks passed. Core, agents-tools and gateway-other types plus four-file typed lint, format and line-cap checks passed. Fresh canonical independent review is clean through P2; clarified its below-threshold documentation observation without changing reviewed runtime/test source. No live Gateway, real platform PTY, deployment or latency benchmark claim. Related tools work: openclaw#125312

Rebase note: upstream openclaw#181653 folded renderTerminalBufferText into terminal-tool.ts; cursorSlice sits beside it, and its rendered-buffer table test now also asserts the paging fields.

Local-Feature: bounded-terminal-paging
Semantic-Source: 51c5867
Upstream-Tracking: openclaw#125312
Drop-When: Upstream supplies bounded raw UTF-16 cursor paging with surrogate-safe boundaries and eviction metadata.
Rebase-Base: 0220489
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui cli CLI command changes gateway Gateway runtime plugin: team-reports scripts Repository scripts size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant