Skip to content

refactor: remove dead branches and test-only helpers - #121345

Merged
steipete merged 5 commits into
mainfrom
steipete/dead-branches-and-types-cleanup-221d12
Aug 10, 2026
Merged

steipete merged 5 commits into
mainfrom
steipete/dead-branches-and-types-cleanup-221d12

Conversation

@steipete

@steipete steipete commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

OpenClaw retained dead configuration branches, cosmetic private error subclasses with no type-sensitive consumers, and runtime-located helpers used only by tests. That stale surface made ownership and protocol review harder without preserving live behavior.

While this PR was open, it temporarily carried a repair for the delivery-custody architecture introduced by #121507. Current main explicitly reverted #121507, so commit d9fe1554e49d9741ae06d39ccccf468d670ce2cb and all ten of its delivery/test-harness paths were dropped before the final rebase. This PR does not partially restore that reverted architecture.

This cleanup was AI-assisted and maintainer-reviewed.

Why This Change Was Made

The change removes verified zero-set-site options and unused private error subclasses, and moves live-test-only helpers under test-support ownership. Messages and meaningful cause chains are preserved with native Error and AggregateError; named error types that still carry a real consumer contract remain untouched.

ErrorCodes.NOT_LINKED and ErrorCodes.AGENT_TIMEOUT have no current server emitters, but they are shipped public API through the Gateway protocol and generated Swift. They therefore remain as deprecated source-compatibility constants without a protocol version bump. Their dormant admin HTTP mappings and documentation also remain because the generic adapter may receive these codes from external or plugin Gateway errors.

MCP_APP_VIEW_EXPIRED remains unchanged because it has a live producer in the Gateway MCP app handler and live consumers in the Control UI. Live contracts including worker error metadata, swarm guest error shape, and reply-session generation invalidation semantics are also unchanged.

The cache regression runner and related live-only utilities now live under src/agents/test-helpers/, the test-project router follows their new path, and the prompt-caching documentation points to the canonical runner location.

User Impact

Runtime behavior is unchanged. Existing TypeScript and Swift clients retain both compatibility Gateway error-code cases, with no protocol, config, schema, migration, or changelog change.

Rename-aware review metrics against final origin/main: production +66/-191 (net -125); tests and test support +54/-46 (net +8); docs net zero; generated API baseline net zero; one obsolete Knip exception removed.

Evidence

Final exact branch head: f3fb726aad82e4fe757eb1e20e4662abe590cfde.

  • Original nine-file focused cleanup suite: 96 tests passed across five current Vitest shards.
  • Codex session-catalog, Gateway error-code, and admin HTTP compatibility suites: 121 tests passed across three shards.
  • Test-project routing assertion for the relocated helper: 1 passed, 258 filtered.
  • pnpm protocol:check:swift: passed.
  • pnpm protocol-registry:check: passed.
  • pnpm plugin-sdk:surface:check: passed (4,847 public exports; 2,917 public callable exports).
  • Canonical pnpm plugin-sdk:api:gen was used after taking current main's generated baseline; pnpm plugin-sdk:api:check passes.
  • Targeted Oxfmt, docs formatting, pnpm docs:list, and git diff --check: passed.
  • Fresh full-branch Codex autoreview against origin/main: three complete chunks, zero findings, clean secret scan, overall patch-correct confidence 0.99.
  • Delegated changed-check/Testbox run 31392496042 passed conflict-marker classification and stopped only at the known repository-wide environment-variable ratchet (503 observed versus budget 507). This PR does not edit that protected budget; exact-head pull-request CI remains the landing authority.
  • Direct sibling openai/codex inspection confirms the retained contract: codex-rs/app-server-protocol/src/protocol/common.rs:504 maps ThreadFork to thread/fork, and codex-rs/app-server-protocol/src/protocol/v2/thread.rs:509 defines ThreadForkParams. The removed private OpenClaw cleanup-error subclass does not cross that protocol boundary.
  • Range-diff matches the five intended cleanup/compatibility/doc commits; the generated baseline is the sole mechanically regenerated commit. None of the ten paths from dropped commit d9fe1554e49 appears in the final branch diff.

@clawsweeper

clawsweeper Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@steipete steipete self-assigned this Aug 10, 2026
@steipete
steipete marked this pull request as ready for review August 10, 2026 01:57
@steipete
steipete requested a review from a team as a code owner August 10, 2026 01:57
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: telegram Channel integration: telegram channel: tlon Channel integration: tlon channel: whatsapp-web Channel integration: whatsapp-web app: web-ui App: web-ui gateway Gateway runtime extensions: memory-core Extension: memory-core cli CLI command changes scripts Repository scripts agents Agent runtime and tooling extensions: codex extensions: admin-http-rpc size: M maintainer Maintainer-authored PR labels Aug 10, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 10, 2026
@clawsweeper

clawsweeper Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 10, 2026, 8:00 AM ET / 12:00 UTC.

ClawSweeper review

What this changes

Removes unused private branches and error subclasses, moves live-test-only helpers under test support, and preserves deprecated Gateway error-code constants for client compatibility.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

Keep open for maintainer handling: the cleanup remains useful and no discrete source-level defect was found, but the branch is behind main, its current-head checks are not green, and the required direct Codex-contract inspection was unavailable.

Priority: P3
Reviewed head: 38e8761864a04b0fe172906591858f0462ad0bef
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The cleanup is coherent and net-negative, but current-head CI and the required direct Codex-contract review remain unresolved.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored, behavior-preserving cleanup is not subject to the external-contributor real-behavior-proof gate.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored, behavior-preserving cleanup is not subject to the external-contributor real-behavior-proof gate.
Evidence reviewed 6 items Current main still contains the cleanup targets: Current main retains the optional lifecycle-start switch and its conditional emitter; repository-wide source search found no setter outside that definition and implementation, so the proposed removal remains useful rather than already implemented.
Published Gateway cases remain intact on the PR head: The branch retains NOT_LINKED and AGENT_TIMEOUT as deprecated constants, preserving the public ErrorCode union rather than removing client-visible protocol cases.
Prior documentation finding is addressed: The branch documentation names the relocated live-cache runner, and the script imports the same test-helper path.
Findings None None.
Security None None.

How this fits together

The PR touches agent execution, bundled channel plugins, Gateway protocol errors, and test-only live-validation utilities. Runtime paths emit errors and lifecycle events to clients, while the relocated helpers feed expensive provider-backed regression tests.

flowchart LR
A[Agent and channel runtime] --> B[Private errors and lifecycle paths]
B --> C[Gateway protocol clients]
A --> D[Live test helpers]
D --> E[Regression test runners]
C --> F[Operator and client behavior]
Loading

Decision needed

Question Recommendation
Should this maintainer-labelled cleanup be rebased and its failing exact-head checks resolved or explicitly waived after a reviewer directly verifies the Codex thread/fork contract? Refresh and verify before landing: Rebase onto current main, resolve or document each exact-head check result, and repeat the direct Codex source inspection.

Why: The protected maintainer label prevents automated closure, while repository policy requires personal inspection of the sibling Codex source for this dependency-backed change and the available check state does not establish a landable head.

Before merge

  • Resolve merge risk (P1) - The branch is behind current main and its current-head check set is failing; merge should wait for an exact-head rebase and either repairs or maintainer-approved waivers.
  • Resolve merge risk (P1) - The Codex session-catalog change cannot receive the repository-required direct upstream-contract verdict until a reviewer can inspect the sibling Codex source.
  • Complete next step (P2) - A maintainer must reconcile the behind branch, exact-head check state, and unavailable direct Codex-contract inspection; no narrow automated repair is established.
Agent review details

Security

None.

PR surface

Source -125, Tests 0, Docs 0, Generated 0, Other +7. Total -118 across 43 files.

View PR surface stats
Area Files Added Removed Net
Source 30 85 210 -125
Tests 8 25 25 0
Docs 1 1 1 0
Config 0 0 0 0
Generated 1 466 466 0
Other 3 10 3 +7
Total 43 587 705 -118

Review metrics

Metric Value Why it matters
Production versus test delta production +69/-194 (net -125); tests/test support +51/-44; generated baseline +466/-466; docs +1/-1 The code change is materially net-negative; the generated baseline is a compatibility record rather than new runtime surface.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/infra/device-identity.ts, persistent cache schema: docs/reference/prompt-caching.md, persistent cache schema: scripts/check-live-cache.ts, persistent cache schema: src/agents/context.ts, persistent cache schema: src/agents/live-cache-regression-runner.ts, persistent cache schema: src/agents/live-cache-regression.live.test.ts, and 5 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Rebase the coherent net-negative cleanup onto current main, establish an exact-head green or explicitly waived CI result, and directly recheck the upstream Codex contract before landing.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Rebase the coherent net-negative cleanup onto current main, establish an exact-head green or explicitly waived CI result, and directly recheck the upstream Codex contract before landing.

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

Not applicable: this PR removes source-proven zero-set-site switches and private error types rather than fixing a reported runtime failure.

Is this the best way to solve the issue?

Yes, conditionally: deletion at the private owner boundaries and relocation to test support are the cleanest shape, but landing still requires base-refresh, check, and Codex-contract evidence.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 6b565c047f98.

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.

Label justifications:

  • P3: This is a behavior-preserving maintenance cleanup, not a user-facing regression or new capability.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored, behavior-preserving cleanup is not subject to the external-contributor real-behavior-proof gate.

Evidence

What I checked:

  • Current main still contains the cleanup targets: Current main retains the optional lifecycle-start switch and its conditional emitter; repository-wide source search found no setter outside that definition and implementation, so the proposed removal remains useful rather than already implemented. (src/auto-reply/reply/agent-runner-cli-dispatch.ts:422, 6b565c047f98)
  • Published Gateway cases remain intact on the PR head: The branch retains NOT_LINKED and AGENT_TIMEOUT as deprecated constants, preserving the public ErrorCode union rather than removing client-visible protocol cases. (packages/gateway-protocol/src/gateway-error-details.ts:4, 38e8761864a0)
  • Prior documentation finding is addressed: The branch documentation names the relocated live-cache runner, and the script imports the same test-helper path. Public docs: docs/reference/prompt-caching.md. (docs/reference/prompt-caching.md:184, 38e8761864a0)
  • Current-area provenance: Blame attributes the current session-adoption cleanup path to Peter Steinberger's recent onboarding repair; the PR commits are also authored by that contributor. (extensions/codex/src/session-catalog.ts:909, 890a5e895b4c)
  • Required Codex source check unavailable: The branch directly changes the Codex session catalog and its stated evidence relies on the upstream thread/fork contract, but the required sibling Codex checkout is absent; local partial-clone retrieval also cannot reach GitHub DNS. (extensions/codex/src/session-catalog.ts:909, 38e8761864a0)
  • Current-head merge gate remains unresolved: The provided PR state reports a mergeable but behind branch and completed failures in test types, multiple compact Node shards, UI E2E shards, and the CI gate; their logs were not available to attribute the failures to this patch. (38e8761864a0)

Likely related people:

  • steipete: Current-main blame and path history attribute the central session-adoption code to Peter Steinberger, who also authored the PR's focused cleanup commits. (role: recent area contributor; confidence: high; commits: 890a5e895b4c, 63ef4624a843, 38e8761864a0; files: extensions/codex/src/session-catalog.ts, src/auto-reply/reply/agent-runner-cli-dispatch.ts)

Rank-up moves

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

  • Rebase and obtain an exact-head green or explicitly waived check set.
  • Inspect the sibling Codex protocol source and record the contract result.

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 (8 earlier review cycles)
  • reviewed 2026-08-10T02:46:57.460Z sha ec3848c :: found issues before merge. :: [P1] Retain the exported Gateway error constants
  • reviewed 2026-08-10T03:44:24.573Z sha 4d0cb66 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-10T03:55:54.233Z sha 02c2f68dc285c568c77877005bc1ac4a19ed5a6a :: found issues before merge. :: [P1] Preserve the published Gateway error-code cases
  • reviewed 2026-08-10T04:57:24.486Z sha 73a55b8d95c1eef26362e6a2488f38603f4614ac :: found issues before merge. :: [P1] Retain the published Gateway error-code cases
  • reviewed 2026-08-10T06:56:01.786Z sha 4f19215 :: found issues before merge. :: [P1] Retain the published Gateway error-code cases
  • reviewed 2026-08-10T09:01:34.244Z sha 5537334 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-10T10:01:38.588Z sha 87091ff6e27780eaaf4206cf9aa2a722a7501e85 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-10T10:50:51.049Z sha e21c0d5 :: found issues before merge. :: [P3] Update the live-cache runner path in docs

@steipete
steipete force-pushed the steipete/dead-branches-and-types-cleanup-221d12 branch 2 times, most recently from 7946ee6 to 4d0cb66 Compare August 10, 2026 03:19
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Aug 10, 2026
@clawsweeper

clawsweeper Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@steipete
steipete force-pushed the steipete/dead-branches-and-types-cleanup-221d12 branch 3 times, most recently from 47c51e5 to 87091ff Compare August 10, 2026 09:55
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 10, 2026
@steipete
steipete force-pushed the steipete/dead-branches-and-types-cleanup-221d12 branch from 87091ff to e21c0d5 Compare August 10, 2026 10:44
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Aug 10, 2026
@steipete
steipete force-pushed the steipete/dead-branches-and-types-cleanup-221d12 branch from e21c0d5 to c4ee38c Compare August 10, 2026 10:55
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 10, 2026
@steipete
steipete force-pushed the steipete/dead-branches-and-types-cleanup-221d12 branch from c4ee38c to 399a8a6 Compare August 10, 2026 11:16
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Aug 10, 2026
@openclaw-barnacle openclaw-barnacle Bot added channel: discord Channel integration: discord size: L and removed size: M labels Aug 10, 2026
@steipete
steipete force-pushed the steipete/dead-branches-and-types-cleanup-221d12 branch 2 times, most recently from d9fe155 to 78d6af3 Compare August 10, 2026 13:18
@steipete

Copy link
Copy Markdown
Contributor Author

Final-head review refresh requested for f3fb726aad82e4fe757eb1e20e4662abe590cfde.

The previous review's rank-up moves are addressed on this head:

  • Rebase/checks: the branch is rebased onto f286928210f2db7b05534fa03c472a9b1ddcf297; exact-head pull-request CI is attached and running. Focused proof, protocol/SDK checks, formatting/docs, and three complete Codex autoreview chunks are clean. The delegated changed check stopped only on the unrelated repository env-count ratchet (503 versus budget 507), which this PR does not edit.
  • Direct dependency contract: sibling openai/codex inspection confirms thread/fork at codex-rs/app-server-protocol/src/protocol/common.rs:504 and ThreadForkParams at codex-rs/app-server-protocol/src/protocol/v2/thread.rs:509; the removed private cleanup error never crosses that boundary.

The head changed materially since the prior review: commit d9fe1554e49d9741ae06d39ccccf468d670ce2cb and all of its delivery/test-harness files were dropped because current main explicitly reverted #121507. The final PR contains only the cleanup, compatibility, generated baseline, and doc work; NOT_LINKED, AGENT_TIMEOUT, and live MCP_APP_VIEW_EXPIRED remain.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Command router queued. I will update this comment with the next step.

@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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 channel: telegram Channel integration: telegram channel: tlon Channel integration: tlon channel: whatsapp-web Channel integration: whatsapp-web cli CLI command changes docs Improvements or additions to documentation extensions: codex extensions: memory-core Extension: memory-core gateway Gateway runtime maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: M 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