Skip to content

fix(ui): refresh agent identity after Gateway file saves - #168170

Merged
steipete merged 3 commits into
mainfrom
steipete/perf-micro-identity-tests-after-167968-20260919
Oct 10, 2026
Merged

steipete merged 3 commits into
mainfrom
steipete/perf-micro-identity-tests-after-167968-20260919

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Open Control UI tabs could retain an old name or avatar after IDENTITY.md was saved through a Gateway file RPC. The connection-scoped identity cache introduced in #167968 had no notification for those writes.

User Impact

Successful identity-file saves through agents.files.set and sessions.files.set refresh open chats, the roster, and forwarded avatars. Idle identity reads remain suppressed. Direct filesystem/shell edits still require reload or reconnect; native clients retain their existing catalog-loading behavior.

Why This Change Was Made

The file RPCs publish agent.identity.changed only after a committed write. Session-file saves match the configured agent workspace's exact identity path, excluding unrelated project and nested files. Before publishing, the writer drains any older identity-file read so an immediate client refresh cannot join a stale in-flight result. The existing UI identity owner handles invalidation and stale-response rejection.

The obsolete TTL assertions reported by CI are already corrected on the main base. This PR adds the missing production notification path and its boundary regressions. The file-write tests use the existing real-storage fixture; the oversized mutation suite shrinks.

Non-test LOC delta: +43, needed for the write/event contract and read ordering. No new polling loop, cache, config option, module, export, or schema change.

Evidence

  • Run 37999811982, head f8239ea9470d13d70cd222d992b79582604db816, jobs 114055137248 and 114055137269: four stale-TTL assertions. Blacksmith Testbox tbx_01m4hesfbrtm9b3xjfdqz8qn18 reproduced all four (149 other tests passed, 4.89 s). The added identity-event browser case failed on the original consumer.
  • Linux Node 24.19.0, CI UI configuration and three workers: the original failing files plus identity tests passed three repetitions, 169 tests each (8.12 / 4.53 / 4.41 s). Five bundled Chromium cases passed in 36.34 s. Over 10 virtual idle minutes, there was one bootstrap identity read and zero additional reads, versus 11 before perf(ui): stop idle identity reads and restart probes #167968. Announced drain added zero identity/catalog/cron reads.
  • AWS Crabbox cbx_8d08927d2d6d: 7,051 UI sibling tests across 495 files passed (three skips); 221 Gateway tests across 13 files passed (11 skips). The one-worker pnpm test <files> --maxWorkers=1 batch passed in 26.63 s for Gateway files and 7.74 s for UI files.
  • Authorized Linux rig, pinned source and Node 24.19.0: the relocated file-RPC batch passed 72 tests in 39.29 s with pnpm test src/gateway/server-methods/agents-files.test.ts src/gateway/server-methods/agents-mutate.test.ts --maxWorkers=1. Fourteen GNU-shell cases were conditionally skipped because the host uses uutils; no remote-shell coverage is claimed. The local-disk negative control fails on the original code and observes committed bytes when repaired.
  • Core, core-test, and UI typechecks; ownership/format/protocol/i18n guards passed. Three unrelated dead-export findings also fail on the unchanged base and are fixed by fix(ci): retired exports break main checks #168048, now included by rebase. Final-head dead-export scans pass with zero entries; targeted source lint and all 1,339 script files pass. Remaining structural checks and final-head Gateway/browser smoke tests pass. Previously passing full type/ownership checks were reused across the unchanged feature patch; the final rebase adds the canonical dead-export repair.
  • Independent Codex review: clean through P2. Final aggregate review of commit 14189fde0588c58d37e3ab90be1593d5ed0f9821: clean through P2.

Validation used synthetic browser data and isolated temporary state, with no production Gateway or live channel account. Before/after screenshots show Atlas/🦞 becoming Cedar/🌻 while preserving the unsent draft and session.

Final-head smoke: all five bundled-browser cases passed in 58.37 s. The original full type-check batch, final-head dead-export scan, targeted source/style/script lint, and remaining structural guards all passed.

Before: Atlas identity and unsent draft

After: Cedar identity with the same unsent draft

Keep the idle identity cache while publishing committed identity-file changes to open Control UI tabs. Drain older file reads before publishing so event-driven refreshes cannot retain stale identity. Replace obsolete TTL test expectations with explicit invalidation.
Keep the oversized mutation suite shrinking by moving raw identity-save coverage to the existing local and remote file-storage fixture. Observe committed bytes at publication and preserve rejection controls.
@clawsweeper

clawsweeper Bot commented Oct 10, 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 docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime scripts Repository scripts size: M labels Oct 10, 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: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 10, 2026
@clawsweeper

clawsweeper Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Refresh open Control UI names and avatars after committed Gateway saves to an agent’s IDENTITY.md file.

Example: Save the main agent’s identity from Atlas/🦞 to Cedar/🌻 through a Gateway file RPC.

  • Before: An open chat can retain Atlas and its old avatar until reload.
  • After: The chat and roster refresh to Cedar while preserving the session and unsent draft.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Focused, useful repair with inspected browser evidence, complementary boundary regressions, and no actionable correctness finding.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (screenshot): Inspected before/after screenshots exercise the bundled browser UI with synthetic Gateway data and show refreshed identity with the draft preserved; separate submitted file-RPC regressions cover committed storage and stale-read ordering, without claiming a live Gateway-to-browser round trip.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Open chats can show an obsolete agent name or avatar after a successful Gateway identity-file save.
Reason: Restores freshness through the existing identity owner without polling, configuration, or duplicated state.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR supplies a useful identity-refresh notification missing from current main. No concrete introduced defect was found, and the previous draft blocker is resolved.

Priority: P2
Reviewed head: 14189fde0588c58d37e3ab90be1593d5ed0f9821

Before merge

None.

Findings

None.

Agent review details

How this fits together

Gateway file handlers commit workspace edits and publish a scoped invalidation that the existing Control UI identity owner consumes.

flowchart LR
 A[Gateway file RPC] --> B[Workspace write owner]
 B --> C[Drain earlier identity read]
 C --> D[Scoped identity event]
 D --> E[UI identity owner]
 E --> F[Chat and roster]
Loading

Technical review

Best possible solution:

Retain event-driven identity caching and notify its existing owner after committed Gateway identity-file saves.

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

Current-main source retains successful identity reads indefinitely while both file-save handlers lack invalidation notifications; submitted baseline controls report the corresponding failure, but no target code was executed during this review.

Is this the best way to solve the issue?

The patch repairs the missing producer notification and preserves existing cache, stale-response, and idle-read suppression contracts.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Connection-scoped identity caching keeps the original intent (00b00e2: Avoid repeated idle identity reads while retaining explicit invalidation and reload behavior for direct filesystem edits.)
  • Open-chat identity subscription keeps the original intent (edd440b: Refresh visible identity through the existing capability while preserving the session and unsent draft.)
  • Raw identity-file access keeps the original intent (95bac01: Remove the competing freeform identity editor tab while retaining raw file-RPC access.)
  • Shared avatar refresh ownership keeps the original intent (7126225: Share connection-scoped identity requests and image ownership while protecting reconnect and refresh ordering.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 7126225 adds ui/src/lib/agents/identity.ts:66 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 712622517abb; files: ui/src/lib/agents/identity.ts)
  • Abdullah Mansour | عبد الله منصور: Raw commit edd440b adds ui/src/pages/chat/chat-pane-lifecycle.ts:385 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: edd440bd391b; files: ui/src/pages/chat/chat-pane-lifecycle.ts)

PR surface

Source +41, Tests +174, Docs 0, Other +2. Total +217 across 15 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 7 58 17 +41
Tests 6 216 42 +174
Docs 1 1 1 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 0 +2
Total 15 277 60 +217

Review metrics

Metric Value Why it matters
Production versus test LOC Production +58/-17; tests +216/-42 Production growth supplies committed-write notification and read ordering; tests protect distinct storage, recipient, stale-response, and browser contracts.

Labels

Label changes:

  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: Stale identity presentation affects open Control UI views without blocking chat or losing drafts.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • 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 need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-10T04:08:16.541Z sha 14189fd :: needs changes before merge. :: none

Reviewed October 10, 2026, 12:16 AM ET / 04:16 UTC (Revision 2).

@steipete
steipete marked this pull request as ready for review October 10, 2026 04:10
@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 10, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

The only CI failures on reviewed head 14189fde0588c58d37e3ab90be1593d5ed0f9821 are inherited. Run 38023143774 finished with two root failures and their downstream CI gate:

  • checks-node-changed-compact-small-7: src/plugins/status.test.ts fails “applies the full bundled provider compat chain before loading plugins” and “projects imported state before and after diagnostics evaluate native modules” with params.diagnostics is not iterable.
  • checks-ui-e2e (2/9): chat-active-turn-recovery.e2e.test.ts fails “keeps all run commentary and tools before its steer through a full reload” on existing message ordering; session-management.mutation-scope.e2e.test.ts fails “keeps All rows, pagination, and updates after another agent's rename settles” because the rename modal intercepts the agent-switch click.

Independent Linux rig proof on unchanged main 2d6f7a3052a03867896f10d521969c78c4555d9a reproduced all four exact failures. node scripts/run-vitest.mjs src/plugins/status.test.ts returned two failures/five passes in 127.29 s. The two named browser files, selected by their failing test names under test/vitest/vitest.ui-e2e.config.ts, returned the same two failures/one pass in 80.78 s. Neither baseline contains this PR.

All other selected CI groups passed; no CI rerun or branch update was used. The exact-head identity proof remains green: 49 Gateway tests and five bundled browser cases, with the platform-conditional GNU-shell cases explicitly skipped. The original failing identity files passed three CI-topology repetitions (169 tests each), and the proof preserves one bootstrap read with zero added reads over ten virtual idle minutes. Independent and hosted reviews found no actionable defect.

Landing under the authorized inherited-failure exception; these unrelated failures remain visible and are not claimed fixed by this PR.

A later independent workflow also reported _test_setReconnectBackoffMs(_:) and _test_reconnectBackoffMs() as dead Swift declarations (job 114132035380). All native app sources, the intersection script, and its workflow are byte-identical between that tested merge and its main baseline. Replaying the exact intersection command and captured iOS/macOS scan artifacts on unchanged main 2d6f7a3052a reproduced both declarations with exit 1. This qualifies the unchanged artifact-consumer failure; it is not a claim of a new native platform rescan.

The native merge helper was stopped before creating any merge intent because its cleanup unconditionally issues a Git push deletion, which conflicts with this lane's push restriction. Its retained lock was recovered after verifying no child tools remained. The explicitly authorized REST squash fallback will pin the exact reviewed head above.

@steipete
steipete merged commit 51dfee3 into main Oct 10, 2026
232 of 240 checks passed
@steipete
steipete deleted the steipete/perf-micro-identity-tests-after-167968-20260919 branch October 10, 2026 04:46
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 11, 2026
…8170)

Publish committed identity-file changes to open Control UI tabs through the existing identity cache owner. Preserve zero idle identity reads and stale-response ordering.
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 docs Improvements or additions to documentation 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: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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