Skip to content

refactor(agents): retire unused private session layers - #177664

Merged
steipete merged 1 commit into
mainfrom
deslop/z33-25-private-settings-surface-20261015
Oct 19, 2026
Merged

steipete merged 1 commit into
mainfrom
deslop/z33-25-private-settings-surface-20261015

Conversation

@steipete

@steipete steipete commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The private embedded-session runtime still carries unused settings accessors, an uncalled tree-navigation layer, and a parser whose only caller is one of those accessors. They duplicate responsibilities already supplied by the prepared settings snapshot and supported transcript/extension owners.

User Impact

No intended user-visible change or operator action. All persisted setting keys and types remain, along with global/project reads, overrides, snapshots, queued writes, locks, nested sibling merging, malformed-file refusal and error attribution. Public transcript navigation, extension commands, shared summary generation and compaction remain.

Why This Change Was Made

Remove 69 unused private SettingsManager accessors and the additional branch-summary accessor orphaned by deleting the uncalled private AgentSession tree layer. Narrow its orphaned project writer to the global writes that actually run. Delete the orphan HTTP idle-timeout parser. Move the live extensionRunner getter unchanged onto concrete AgentSession.

The packaged openclaw/plugin-sdk/agent-sessions entrypoint selects neither AgentSession, SettingsManager nor the private session factory; the stable package has the same boundary. Returned public ExtensionRunner contexts expose transcript managers and discrete actions, not these private objects. Its public navigateTree handler is independently supplied and remains. This is not a Plugin SDK, config, protocol, persisted schema, durability, retention, permission or dependency change. Phase E standalone session memory and all its machinery and tests are untouched.

Against the pinned base, 576 net production lines removed across six production files. Two inventories shrink only by entries for deleted code/tests. Tests of deleted private entrypoints leave with their implementation; all retained metadata, cancellation, write settlement, publication, saved-default, storage scope and error assertions stay.

Best-effort tradeoffs accepted

  • Unsupported private-source callers can no longer call the retired accessors or private tree method. The in-tree production/dynamic/returned-object census found no caller or packaged export. refactor: internalize OpenClaw agent runtime #85341 internalized this runtime; refactor(agents): split AgentSession responsibilities #107948 only split its private layers, with no human incident or in-flight activation. Public transcript navigation and extension actions remain with their existing owners.
  • The unused private project-settings writer retires; production settings setters already target global scope. Project reads, external reloads and effective precedence remain. This removes an unreachable entrypoint, not a live concurrency or durability guard.
  • The HTTP parser retires only because its last private accessor retires; refactor: fold duplicated helpers onto canonical owners #159409 introduced ordinary consolidation, not a reported incident or activation foundation. Persisted HTTP settings and live transport contracts are unchanged.

Evidence

Complete owner/caller, public/stable/returned-object and provenance inspection; author simplification pass keeps existing owners without a compatibility shim, new export, cast or test-only production seam. Fresh isolated independent P0–P2 review is scoped-clean, with final source verification complete.

Fresh focused proof passes: 293 cases in 16 files across six configurations, including prompt-prefix stability, all four subprocess storage cases, saved-default publication and compaction admission. Targeted native typecheck (20 explicit roots), typed lint (14 TypeScript files), format, runtime cycles (0), static cycles (0), and all 14 lint-suppression cases pass. Source hashes were checked after the serial proof. The changed-check planner was run in dry-run mode only; full check-changed was not run.

The earlier focused run exposed implicit SDK mock setup inherited from a removed test and subprocess calls hidden inside source strings. Fixtures now establish their own complete stream and observe retained effective thinking levels or global-only saved-default snapshots. No assertion, timeout, retry or skip was relaxed. Fresh independent repaired-candidate review completed scoped-clean at P0–P2, with final source verification.

Local commands ran serially at nice10, focused wrapper Vitest with one worker, and isolated HOME/OpenClaw/XDG state. Format 1,045 ms; types 9,138 ms; typed lint 66,862 ms; focused wrapper 504,963 ms; runtime cycles 73,766 ms; static cycles 142,732 ms; suppressions 33,311 ms. Broad local builds, E2E, full check-changed and whole-graph typechecking are not run; exact-head PR CI is the broad gate.

The post-publication dependency-free detector scanned 23,278 production files in one nice10 process on this exact head. Both measured settings seeds (s-3c1558a5c78e, s-68f5c2864693) are absent. Test/support net removal is 124 lines, separate from the 576 production-line reduction. No whole-tree exhaustion claim.

@clawsweeper

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

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts agents Agent runtime and tooling size: XL labels Oct 19, 2026
@steipete
steipete marked this pull request as ready for review October 19, 2026 19:47
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 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-19T19:54:55.669218Z 8659afb 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.

@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. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 19, 2026
@clawsweeper

clawsweeper Bot commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Removes unused private session settings accessors, tree-navigation machinery, and an orphaned HTTP timeout parser.

Example: Global compaction settings contain reserveTokens: 32768, and the session disables compaction.

  • Before: The scoped writer saves enabled: false while preserving reserveTokens: 32768.
  • After: The narrowed global writer preserves the same saved settings and project-read behavior.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Focused owner-level validation and green CI support a coherent cleanup; evidence is harness-based rather than a shipped-entry-point demonstration, which is exempt for this maintainer-authored change.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored private refactor is outside the ordinary contributor proof gate; supplied validation covers settings persistence, subprocess storage, compaction admission, and prompt stability, supported by successful exact-head CI.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
User problem: Unused private runtime surfaces increase maintenance burden without serving a supported user flow.
Reason: The maintainer has explicitly chosen this retirement, and caller/export inspection supports the private boundary and retained behavior.

Merge readiness

✅ Ready for maintainer review

This PR is a useful, maintainer-directed cleanup of unused private code. I found no actionable introduced defect; the supported SDK boundary remains intact and exact-head CI is green.

Priority: P3
Reviewed head: 8659afb3641fb95c57dc74620b9126be634f3599

Before merge

None.

Findings

None.

Agent review details

How this fits together

The embedded agent runtime prepares settings snapshots and constructs private AgentSession objects; retained settings operations feed agent execution and queued global persistence, while the public SDK exposes transcript managers and separately bound extension actions.

flowchart TD
A[Global and project settings] --> B[Prepared settings snapshot]
B --> C[Private SettingsManager]
C --> D[Embedded AgentSession]
C --> E[Queued global settings writer]
F[Public agent sessions SDK] --> G[Transcript managers and extension actions]
Loading

Technical review

Best possible solution:

Retire the unreachable private paths while retaining the existing settings, transcript, and extension owners as this PR does.

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

This is a refactor rather than a reported runtime bug; source inspection confirms the removed accessors have no remaining runtime callers and the public extension navigation path is independent.

Is this the best way to solve the issue?

The diff is a focused deletion using existing owners: it preserves the live extensionRunner getter, specializes the existing global writer, and adds no compatibility shim or competing state owner.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 2cd23b665868.

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit f746a65 adds src/agents/sessions/settings-manager.ts:401 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: f746a653139d; files: src/agents/sessions/settings-manager.ts)

PR surface

Source -576, Tests -123, Other -2. Total -701 across 19 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 6 36 612 -576
Tests 11 156 279 -123
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 2 0 2 -2
Total 19 192 893 -701

Review metrics

Metric Value Why it matters
Production versus test changes Production +36/-612 (net -576); tests/support +156/-279 (net -123). The reduction removes unused private implementations and their obsolete tests; retained tests exercise existing settings and lifecycle boundaries.

Labels

Label changes:

  • add P3: Behavior-preserving private runtime cleanup with no established user-facing failure or urgent regression.
  • 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: Behavior-preserving private runtime cleanup with no established user-facing failure or urgent regression.
  • 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 19, 2026, 4:06 PM ET / 20:06 UTC.

@steipete
steipete merged commit 75884a2 into main Oct 19, 2026
233 of 235 checks passed
@steipete
steipete deleted the deslop/z33-25-private-settings-surface-20261015 branch October 19, 2026 20:13
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

steipete added a commit that referenced this pull request Oct 19, 2026
Drop five forwarding exports left unused by #177664. Preserve canonical branch summaries, extension event types, and persisted package and warning settings.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 20, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 20, 2026
Drop five forwarding exports left unused by openclaw#177664. Preserve canonical branch summaries, extension event types, and persisted package and warning settings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling 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: XL 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