Skip to content

refactor(agents): read prepared settings directly - #178407

Merged
steipete merged 1 commit into
mainfrom
deslop/z19-96-native-settings-reader-20261015
Oct 20, 2026
Merged

steipete merged 1 commit into
mainfrom
deslop/z19-96-native-settings-reader-20261015

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Settings preparation still constructs a private storage backend and acquires writer locks even though the production settings writer has been retired.

User Impact

No settings migration or public contract change. Global and project settings keep their paths, keys, trust policy, and new/reset-session refresh boundary. Reads leave user files untouched. An overlapping external edit can produce an old, empty, or error snapshot until fresh preparation.

Why This Change Was Made

After #178049 made SettingsManager attempt-local and memory-only, preparation became the sole production consumer of FileSettingsStorage, only for reads. Replace that private single-implementation protocol/class with the existing scope reader taking a path; delete its orphan writer, lock machinery, and writer-only process harness. Migrate the isolated QA fixture's settings seed to direct file setup before Gateway readiness.

The reader opens directly and treats only ENOENT as absence. JSON/object validation and all other filesystem errors remain intact, including the ENOTDIR repair from the earlier review. Existing actual-file/reset/trust/plugin/model preparation tests remain; obsolete backend tests move to native file-error coverage rather than a replacement production seam.

This is a six-path owner area split: 73 net production and 398 net fixture/support lines removed (471 overall). Standalone session memory, public SDK/protocol/config shapes, and database schemas/durability/retention/permissions are unchanged.

Best-effort tradeoffs accepted

  • An old/private writer lock no longer delays read-only preparation. #133782 added synthetic ordering proof; refactor(agents): keep attempt settings directly in memory #178049 retired the in-tree writer. Preparation takes the current snapshot and refreshes at the documented session boundary.
  • External edits or historical in-place writers can expose old, empty, or malformed content. The parser returns the existing empty/error result without modifying bytes, and fresh preparation can read the completed edit. The current stable writer uses atomic replacement; historical in-place overlap is accepted. #124394 explicitly describes a private-class barrier reproduction, not observed interactive product use.
  • Stale or malformed lock/reclaim names no longer reject a read. They were writer-coordination artifacts, not authorization. JSON validation, actual filesystem errors, retired-key rejection, project trust and shell-key sanitation remain.

Evidence

The exact six-file composition passed targeted types, formatting, ordinary type-aware lint of all five core files and the E2E fixture, line caps, runtime/static cycles (zero), and independent P0–P2 review with no actionable findings. The temporary switch for another PR's repair was reversed by replaying these six exact postimages; all input hashes still match the reviewed candidate.

Fresh focused execution passed all three attempt-local SettingsManager cases and all 14 suppression checks. The next Gateway shard hit a worker-cache miss and began broad compiler preparation; only this task's compiler and runner were stopped to honor the local build budget. That attempt is incomplete, not a product failure or a pass. Fresh native-file, preparation/reset/trust, agent-settings, utility-harness, and prompt-prefix runtime results remain exact-head CI obligations. Earlier signed-input focused proof is historical, not a fresh current-base run.

The opt-in cron/Gateway E2E fixture has source and targeted-type/lint coverage but has not been executed locally; broad builds/E2E are outside this campaign's local proof budget. No timeout, retry, skip, assertion, baseline or suppression weakening.

@clawsweeper

clawsweeper Bot commented Oct 20, 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 20, 2026 12:37
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 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-20T12:40:37.852051Z 1ca664a 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 agents Agent runtime and tooling size: L labels Oct 20, 2026
@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. labels Oct 20, 2026
@clawsweeper

clawsweeper Bot commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

This PR reads prepared settings directly from their existing files and removes the unused private storage backend, writer, and associated fixtures.

Example: Global settings.json contains defaultThinkingLevel set to high.

  • Before: Preparation acquires a writer lock before reading the existing file.
  • After: Preparation reads high directly without creating writer sidecars.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The source cutover is coherent and exact-head CI passed, but settings-loading upgrade validation remains unestablished.
Proof confidence 🌊 off-meta tidepool Not applicable: The ordinary contributor-proof gate does not apply to this maintainer-authored PR; supplied checks do not establish fresh-install or stable-upgrade behavior of the changed settings-loading path.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
User problem: Settings preparation performs unnecessary writer coordination despite no longer having an in-tree production settings writer.
Reason: The maintainer-authored direction removes obsolete machinery and explicitly accepts overlapping-edit snapshot behavior while preserving ordinary settings paths, values, and trust policy.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep this PR open: it completes a useful, maintainer-directed simplification, and review found no actionable code defect.

Priority: P3
Reviewed head: 1ca664a7cf71c558d0574781d46d985d0639530f

Before merge

  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

None.

Tests

  • Missing end-to-end proof: Show fresh-install and v2026.10.5-to-head Gateway settings loading with global/project values, trust policy, reset refresh, and original file bytes preserved.
Agent review details

How this fits together

Agent preparation reads global, plugin, and project settings, applies existing precedence and trust policy, and supplies immutable snapshots to attempt-local managers and provider retry preparation.

flowchart TD
  A[Global settings file] --> D[Direct settings reader]
  B[Project settings file] --> D
  D --> E[Prepared settings snapshot]
  C[Enabled plugin settings] --> E
  E --> F[Trust policy and merge]
  F --> G[Attempt settings and retry preparation]
Loading

Technical review

Best possible solution:

Retain the direct reader and complete settings-loading compatibility validation before merging.

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

This is a refactor rather than a reported bug; source confirms that current main constructs the private backend solely for production reads.

Is this the best way to solve the issue?

The direct path is the smallest complete cutover: it reuses the existing parser, preserves settings ownership and trust policy, and removes the obsolete writer together with its callers and tests.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Locked settings reads changes intended behavior with a stated reason (7033862: Avoid absent-file sidecar work while preserving reads ordered behind an already active first writer.)
  • Atomic settings writer and writer-specific tests changes intended behavior with a stated reason (7dfdc08: Protect persisted settings from interrupted or partial writes; the production writer was subsequently retired by refactor(agents): keep attempt settings directly in memory #178049.)
  • Prepared snapshots and scope parsing keeps the original intent (f6f939a: Share prepared settings between native retry preparation and embedded setup while retaining their separate validation responsibilities.)

Testing

Proof path: unit tests only.

Security

None.

Evidence

What I checked:

Likely related people:

  • Vincent Koc: Raw commit f6f939a adds src/agents/agent-project-settings-prepared.ts:52 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: f6f939a8ebc6; files: src/agents/agent-project-settings-prepared.ts)

PR surface

Source -73, Tests -398. Total -471 across 6 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 17 90 -73
Tests 4 63 461 -398
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 80 551 -471

Review metrics

Metric Value Why it matters
Production versus tests and support Production +17/-90; tests and support +63/-461. The reduction removes an unused writer and its process scaffolding while retaining preparation coverage and adding native file-error cases.

Labels

Label changes:

  • add P3: This is a focused internal simplification with no intended change to ordinary settings behavior.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.

Label justifications:

  • P3: This is a focused internal simplification with no intended change to ordinary settings behavior.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.

Rank-up moves

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

  • Provide the fresh-install and stable-upgrade settings-loading evidence described in the testing review.

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 20, 2026, 8:54 AM ET / 12:54 UTC.

@steipete

Copy link
Copy Markdown
Contributor Author

Maintainer disposition: the review reports no actionable findings. This changes no stored data model: the Settings fields, global/project paths, JSON/object validation, error handling, trust policy, and new/reset-session refresh boundary remain intact. The production writer was already retired in #178049; this PR removes its unused implementation and read-side coordination. The reader never modifies existing file bytes.

Full fresh-install and stable-upgrade Gateway execution remains an explicit proof gap, as disclosed in the body. I’m treating the generic compatibility-proof hold as advisory for this internal, format-preserving cut, supported by source review and successful exact-head CI 39423745313. No scanner policy, fixture, permission, or schema is changed to release the hold.

@steipete
steipete merged commit 8f2586b into main Oct 20, 2026
193 of 194 checks passed
@steipete
steipete deleted the deslop/z19-96-native-settings-reader-20261015 branch October 20, 2026 12:59
steipete added a commit that referenced this pull request Oct 20, 2026
Remove orphaned context-engine assertions and the already-current convergence table after #178340 and #178341. Keep webhook, MCP authority, and JSON-target helpers local after #178399, #172026, and #178407; replace the test-only skill-authoring reset seam with module isolation.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 21, 2026
Read prepared global and project settings directly through their existing parser and paths. Remove the private single-implementation backend, unused writer, read locks, and writer-only fixtures after openclaw#178049 retired production persistence.

Keep ENOENT-only absence handling, native filesystem errors, trust/sanitization, refresh boundaries, and user file bytes. Old/private writers or overlapping external edits may produce an old/empty/error snapshot until fresh preparation; this best-effort read never writes user settings.

Targeted types, ordinary typed lint, formatting, caps, zero runtime/static cycles, independent review, and exact-head CI 39423745313 passed. Local runtime gaps and unrun opt-in Gateway/upgrade proof are disclosed. The generic automated proof hold is advisory; review identified no code finding.

PR openclaw#178407; 73 net production and 398 fixture/support lines removed. Standalone session memory is unchanged.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 21, 2026
Remove orphaned context-engine assertions and the already-current convergence table after openclaw#178340 and openclaw#178341. Keep webhook, MCP authority, and JSON-target helpers local after openclaw#178399, openclaw#172026, and openclaw#178407; replace the test-only skill-authoring reset seam with module isolation.
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. size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant