Skip to content

refactor(ui): use native agent file read and save status - #179580

Merged
steipete merged 2 commits into
mainfrom
solid2/w-s2-agent-file-reads
Oct 22, 2026
Merged

steipete merged 2 commits into
mainfrom
solid2/w-s2-agent-file-reads

Conversation

@steipete

@steipete steipete commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor
Family Files base→candidate Production LOC base→candidate 1 handlers 2 lifecycle 3 reads C/E/U/N base→candidate 4 commands C/E/U/N base→candidate 5 lazy 6 collections 7 JSX 8 context 9 Reveal 10 owner APIs
Agents editor / non-memory 25→26 5,862→5,960 0→0 0→0 3C/0E/0U/9N→2C/0E/0U/10N 3C/0E/0U/4N→2C/0E/0U/5N 0→0 0→0 0→0 0→0 0→0 0→0
Agents memory 12→12 2,929→2,929 0→0 0→0 0C/0E/0U/5N→0C/0E/0U/5N 0C/1E/0U/2N→0C/1E/0U/2N 0→0 0→0 0→0 0→0 0→0 0→0
Config Appearance / shared 15→15 4,279→4,279 0→0 0→0 2C/1E/0U/5N→2C/1E/0U/5N 2C/1E/0U/2N→2C/1E/0U/2N 0→0 0→0 0→0 0→0 0→0 0→0
Config other 34→34 5,662→5,662 0→0 0→0 1C/0E/0U/3N→1C/0E/0U/3N 2C/1E/0U/2N→2C/1E/0U/2N 0→0 0→0 0→0 0→0 0→0 0→0
Config health 3→3 1,352→1,352 0→0 0→0 1C/0E/0U/0N→1C/0E/0U/0N 0C/0E/0U/1N→0C/0E/0U/1N 0→0 0→0 0→0 0→0 0→0 0→0
Config memory 5→5 1,319→1,319 0→0 0→0 0C/1E/0U/1N→0C/1E/0U/1N 2C/0E/0U/0N→2C/0E/0U/0N 0→0 0→0 0→0 0→0 0→0 0→0
Config Talk 4→4 1,476→1,476 0→0 0→0 0C/0E/0U/3N→0C/0E/0U/3N 2C/0E/0U/0N→2C/0E/0U/0N 0→0 0→0 0→0 0→0 0→0 0→0
Sessions 23→23 4,193→4,193 0→0 0→0 1C/0E/0U/3N→1C/0E/0U/3N 0C/0E/0U/8N→0C/0E/0U/8N 0→0 0→0 0→0 0→0 0→0 0→0
PAGES-A total 121→122 27,072→27,170 0→0 0→0 8C/2E/0U/29N→7C/2E/0U/30N 11C/3E/0U/19N→10C/3E/0U/20N 0→0 0→0 0→0 0→0 0→0 0→0

Base: 63415c568253b60f94f17a3707cb6539f9161ede; current head: 30eb823571ce48bba38900396174910d1cef567a. C/E/U/N = eligible candidate / named allowed exception / unresolved / native. This PR resolves only file-content reads and file Save/Overwrite: 19→17 eligible groups. Skills Reset keeps its existing native classification; other pending PRs receive no credit. Items 1, 2, 5–10 count eligible sites, with 24 existing owner/primitive exceptions retained. The five operation exceptions are unchanged.

What Problem This Solves

Agents Files still used a manual error field and discarded save completion promises, leaving the renderer outside Solid’s async/action model. This change exposes the admitted owner’s read and outcome receipts to a narrow Loading/Errored status slot, and presents Save/Overwrite with an optimistic saving action. The textarea remains mounted and editable while writes settle.

The page’s existing synchronous Skills Reset lifetime is now a small shared helper. Its four retirement sites are unchanged; Files captures that lifetime before admitting a write so navigation or reconnect can retire presentation while the plain owner still settles the write. Selected-file callbacks move into the existing file owner, preserving target and permission checks and shrinking the capped page-state file. Identity and Default remain unchanged.

The owner retains synchronous loading/saving admission facts, request generations, draft custody and conflict checks. Those are authority, not duplicate presentation state. No optimistic file bytes are invented: the operator’s editable draft is already visible. No affects/refresh is added to a receipt observer: it cannot refetch, and the admitted owner publishes its accepted result directly.

Evidence

Proof Result
UI types Passed: pnpm tsgo:ui
File owner ordering Passed: files.test.ts, 28 cases
Native status, retained draft, failed save Passed: file-status.test.tsx, 3 cases
RouterOutlet departure during write Passed: agents-page.file-route-retirement.test.tsx, 1 case
Independent review P0–P2 No actionable findings for the production candidate or subsequent two-file type repair
Full exact-head CI Run 39741290601 passed at 30eb823571c: 48 jobs succeeded, 24 skipped; all 16 UI jobs passed, including both real-Gateway shards
Exact failing test typecheck Passed: node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.ui-pages.json --incremental after the repair
Scoped lint, format, controller guard Passed; no baseline changes
Production Knip Exact base and head report the same 13 unused heartbeat files; logs are byte-identical, with no UI findings
Same-machine base/head build and strict budgets Both builds and paired strict check passed; byte counts below
Before/after synthetic screenshots Six states passed on each exact distribution; all six before/after PNG pairs are byte-identical and inspected, synthetic-only

The route’s existing lazy boundary, host tags, selectors and CSS classes are preserved. There are no dependency changes. Touched production: 2,226→2,324 LOC (+98); tests/support: 3,403→3,730 LOC (+327). The page-state owner shrinks 998→957 lines. Growth provides the native status/action boundary and focused lifetime proof; no new rendering abstraction beyond the shared 11-line lifetime helper.

The final test-only correction adds missing fixture fields to its type and uses the supported anchored button-name selector. Production blobs are unchanged from the reviewed, behavior-tested candidate. The exact failed test typecheck and full replacement-head CI passed; unchanged focused behavioral proof is reused.

Surface Base gzip Head gzip Delta
Startup JavaScript 316,233 B 316,240 B +7 B
Startup CSS (one request) 40,894 B 40,894 B 0 B
Chat boot JavaScript 1,439,144 B 1,439,189 B +45 B
New Session boot JavaScript 1,016,091 B 1,016,133 B +42 B

Startup remains below 325,000 B. All seven startup JavaScript assets have identical content after normalizing generated chunk URL hashes; no startup modules were added. Every increase stays below 64 B. The paired strict checker reports no violations or warnings, including locale budgets.

Builds use fixed metadata on the same machine. Full input and publication manifests independently qualify the copied distributions against the exact commits: 3,289 base / 3,290 head tracked inputs, the same 10 generated inputs, and 6,999 publication files per side. Only the six authored production build inputs differ. The screenshot-only Playwright runs use Node for the browser/photon helpers; normal focused Vitest proof uses the pinned default runtime.

The following 1440×1000 captures use only synthetic Garden helper data. Each pair is byte-identical; pending and failed reads, pending and failed saves, and conflict recovery retain the existing layout and editable draft.

State Before After
Pending file read Before: Pending file read After: Pending file read
Failed file read Before: Failed file read After: Failed file read
Pending save Before: Pending save After: Pending save
Failed save Before: Failed save After: Failed save
File conflict Before: File conflict After: File conflict
Conflict after refresh Before: Conflict after refresh After: Conflict after refresh

@steipete steipete added the ci:full Keep ordinary native-locale CI selection on the next PR run. label Oct 21, 2026
@clawsweeper

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 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-22T07:08:12.971658Z dcb1bb1 New commits
ℹ️ 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 clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 21, 2026
@openclaw-barnacle openclaw-barnacle Bot added the gateway Gateway runtime label Oct 21, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 47d9ba6f5d

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

const version = state.agentFileEditors[name]?.version;
const resolution = operation.kind === "read" ? operation.resolution : undefined;
const completion = Promise.withResolvers<AgentFileOutcome>();
state.agentFileOutcome = completion.promise;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve pending write outcomes across concurrent reads

Reads and writes use different busy flags, so a user can click Save and then select another file or Refresh while that write is pending. The new read replaces this single agentFileOutcome promise; if the write later fails, its promise resolves without any rendered boundary observing it, silently dropping the save error and potentially causing the user to believe the draft was persisted. Keep read and write outcomes separate, or prevent reads while a write is pending.

AGENTS.md reference: ui/AGENTS.md:L18-L18

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 15fa1b1a76

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ui/src/pages/agents/panels-files.tsx Outdated
Comment on lines +128 to +130
const saving = () =>
params.readData().agentFileSaving ||
(optimisticSaving() && params.readData().agentFilesLoading);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Retire optimistic save state after reconnect

If a save remains unresolved across a same-client reconnect, invalidateTransientRequests() clears the owner’s saving flag but this component retains optimisticSaving(). A subsequent file refresh or tab read then sets agentFilesLoading, causing this expression to resurrect the retired operation as “Saving” and disable the Save button for the unrelated read. Scope or reset the optimistic transaction when its connection generation is invalidated instead of masking it with the loading flag.

AGENTS.md reference: ui/AGENTS.md:L17-L17

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added the clawsweeper:intake:feature Preliminary submission classification; full source review pending. label Oct 21, 2026
@clawsweeper clawsweeper Bot removed the clawsweeper:intake:feature Preliminary submission classification; full source review pending. label Oct 21, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. 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 Oct 21, 2026
@clawsweeper

clawsweeper Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR presents agent-file reads, errors, and saving feedback through native Solid async boundaries while retaining the existing file owner.

Example: Save edited AGENTS.md instructions for Garden helper.

  • Before: The renderer uses manual error state and the owner's saving flag.
  • After: Solid observes completion receipts and presents saving feedback while the editor retains the editable draft.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Inspected browser proof, preserved owner contracts, focused lifecycle coverage, and successful exact-head full CI support the patch; the separate body-format check remains red.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): Inspected synthetic browser captures exercise the built Agents Files presentation for pending and failed reads and saves plus conflict recovery; focused owner and mounted-page tests support ordering and retirement, and exact-head full CI succeeded.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
User problem: File-editor status presentation still uses manual error state and does not consume save completion through Solid actions.
Reason: The maintainer-authored direction aligns the editor with established Solid conventions while retaining drafts, conflict recovery, permissions, and layout.

Merge readiness

✅ Ready for maintainer review

Keep this PR open. The maintainer-directed refactor resolves the prior findings, preserves file-owner responsibilities, and introduces no actionable defects found in this review.

Priority: P2
Reviewed head: 30eb823571ce48bba38900396174910d1cef567a

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Control UI Agents Files panel sends read and write requests through the existing Gateway client; the synchronous file owner retains drafts, checks request generations and conflicts, and publishes results for rendering.

flowchart LR
  A[Agents Files panel] --> B[Selected file actions]
  B --> C[Synchronous file owner]
  C --> D[Gateway file RPC]
  D --> C
  C --> E[Completion receipts]
  E --> F[Solid status and saving presentation]
  G[Page retirement lifetime] --> F
Loading

Technical review

Best possible solution:

Retain the existing synchronous file owner and use its receipts and shared retirement lifetime for native Solid presentation.

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

This is a behavior-preserving refactor; source inspection and supplied browser captures establish the affected paths without executing target code.

Is this the best way to solve the issue?

The change follows the existing owner-backed Solid recipe, removes manual error presentation, and preserves write admission and settlement in the established owner.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • File read/write ordering and draft custody keeps the original intent (fc6cf5e: Prevent overlapping refreshes from replacing accepted saves or restoring obsolete metadata.)
  • Conditional writes and conflict recovery keeps the original intent (42db921: Preserve concurrent workspace edits through version checks, retained drafts, Reload, and explicit Overwrite.)
  • Skills Reset presentation retirement keeps the original intent (0af411d: Present optimistic reset feedback while synchronous lifecycle retirement releases obsolete presentation.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit fc6cf5e adds ui/src/pages/agents/files.ts:69 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: fc6cf5e6907d; files: ui/src/pages/agents/files.ts)
  • Yuval Dinodia: Raw commit 42db921 adds ui/src/pages/agents/files.ts:100 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 42db92136247; files: ui/src/pages/agents/files.ts)

PR surface

Source +98, Tests +327. Total +425 across 17 files. Added test files: 2.

View PR surface stats
Area Files Added Removed Net
Source 6 193 95 +98
Tests 11 402 75 +327
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 17 595 170 +425

Review metrics

Metric Value Why it matters
Production versus tests Production +193/-95; tests/support +402/-75. Production growth supplies receipt presentation and shared retirement while relocating existing callbacks; test growth covers status rendering, reconnect retirement, and route departure.

Labels

Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: Normal-priority refactor of file-editor loading, error, and save presentation with preserved user behavior.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-21T22:07:39.445Z sha e08c945 :: needs changes before merge. :: [P2] Migrate the remaining Gateway assertions to completion receipts | [P2] Retire optimistic saving feedback with the admitted request

Reviewed October 22, 2026, 4:19 AM ET / 08:19 UTC (Revision 2).

@steipete
steipete force-pushed the solid2/w-s2-agent-file-reads branch from e08c945 to dcb1bb1 Compare October 22, 2026 07:04
@steipete

Copy link
Copy Markdown
Contributor Author

Both historical findings are addressed in 30eb823571c:

  • Concurrent read/write outcome: accepted success and failure settlement republishes the admitted receipt in files.ts; the owner tests cover a read starting before or during a failed write and retain the failure after that read settles.
  • Reconnect saving feedback: the action now races its admitted completion against the page retirement captured before admission. Reconnect retires that lifetime before clearing the owner's transient state. The existing four retirement sites are preserved.

The coupled Gateway assertions now await completion receipts. Full CI 39741290601 is green on the current head. The PR body now includes the same-machine strict budget comparison and six inspected, synthetic before/after pairs; each PNG pair is byte-identical.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed 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. clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Oct 22, 2026
@steipete
steipete merged commit 05768fb into main Oct 22, 2026
157 of 161 checks passed
@steipete
steipete deleted the solid2/w-s2-agent-file-reads branch October 22, 2026 08:23
@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

app: web-ui App: web-ui ci:full Keep ordinary native-locale CI selection on the next PR run. clawsweeper:intake:feature Preliminary submission classification; full source review pending. gateway Gateway runtime P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: L 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