Skip to content

fix(ui): Control UI floods agent.identity.get while the Gateway restarts - #165443

Merged
steipete merged 1 commit into
mainfrom
codex/stab-identity-storm
Oct 5, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/stab-identity-storm

Conversation

@steipete

@steipete steipete commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: the Control UI floods the Gateway with agent.identity.get while the Gateway is draining for a restart or finishing post-crash admission, because every sidebar render re-sends the rejected read immediately.

User Impact

User impact: an open Control UI tab no longer hammers a restarting Gateway; agent names and avatars keep their last loaded values while a refresh fails, and identity reads resume promptly after reconnect. No protocol or drain-policy change.

Why This Change Was Made

The identity cache deleted an entry as soon as its request was rejected. The sidebar requests identities on every update, so the next render issued a fresh request at once. The cache now keeps the rejected request shared until a retry deadline, backing off from 500 ms to 5 s with the existing resolveGatewayReadRetryDelayMs helper (which honors longer Gateway retryAfterMs hints). Successful reads keep their TTL; reconnect and explicit invalidation still clear the entry.

Evidence

Live: during a 315 s Gateway drain, one Control UI tab sent 65 rejected agent.identity.get requests in ~80 s, in bursts of up to 7 per second (UNAVAILABLE … unavailable during gateway restart).

Regression (fake clock, no sleeps or Gateway boots):

TMPDIR=/private/tmp/oc-identity-storm pnpm test ui/src/lib/agents/identity.test.ts --maxWorkers=1
main:   3 failed | 9 passed — expected 1 request, got 41 (4.5 s wall)
branch: 12 passed (2.9 s wall)

Consumers also pass: assistant-identity.node.test.ts, chat-avatar.test.ts, control-ui-agent-avatar.test.ts, control-ui-session-summary.test.ts (63 tests). pnpm tsgo:ui, pnpm tsgo:test:ui, targeted oxlint, pnpm docs:check-links, and git diff --check pass.

No visual change. Production +27/−17; tests +124/−1; docs +6.

Siblings checked

sessions.catalog.list and models.list already pace/coalesce. sessions.describe (failed reads evicted immediately), sessions.messages.unsubscribe (short fixed retries), and board.get (refresh notifications can wake backoff) have separate owners and are left for follow-ups.

Keep rejected identity requests in the shared per-agent cache until the read retry deadline, honoring Gateway retry hints and preserving the last displayed identity during failed refreshes. Reconnect and explicit invalidation retire the cooldown. Evict settled failures under the existing cache bound.

Regression proof: the original owner issued 41 requests for 40 repeated updates, while the fix issues one per retry window. Identity tests pass (12 cases, 2.86 s command wall time); focused consumers pass (63 cases). No Gateway protocol or drain-policy changes.
@clawsweeper

clawsweeper Bot commented Oct 5, 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 5, 2026 08:23
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui size: S labels Oct 5, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 5, 2026
@clawsweeper

clawsweeper Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 5, 2026, 4:28 AM ET / 08:28 UTC.

ClawSweeper review

What this changes

The Control UI shares failed agent-name and avatar requests until a retry deadline, honors Gateway retry hints, and documents reconnect recovery.

Merge readiness

✅ Ready for maintainer review

This remains a useful, focused repair: current main still immediately evicts failed identity requests, and the verified merge result preserves the proposed fix. No blocking correctness findings were identified.

Priority: P2
Reviewed head: 964b4a98f0535d9ec0e69890e648398a4161ef84

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level repair with meaningful deterministic regressions and no identified blocking defect.
Proof confidence 🌊 off-meta tidepool Not applicable: The verified repository-admin author is exempt from ordinary external-contributor proof requirements. Available evidence covers the pre-fix live identity-read storm and supplemental owner tests, without claiming after-fix live recovery; the cache remains in memory and changes no stored-data contract.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The verified repository-admin author is exempt from ordinary external-contributor proof requirements. Available evidence covers the pre-fix live identity-read storm and supplemental owner tests, without claiming after-fix live recovery; the cache remains in memory and changes no stored-data contract.
Evidence reviewed 7 items Pinned introduction and merge result: The merge-base-to-head patch introduces retry deadlines and failure counts only in the identity owner, its regression tests, and reconnect documentation. The test-merge comparison contains the same production change.
Current main still needs the repair: Current main deletes a cache entry on rejection. The sidebar invokes identity hydration during updates, so a subsequent update can immediately issue another rejected request.
Existing retry policy reused: The shared read-retry helper provides exponential delays from 500 ms to 5 seconds and preserves longer finite Gateway hints. The patch consumes this existing owner rather than adding competing retry policy.
Findings None None.
Security None None.

How this fits together

The Control UI’s identity cache shares Gateway reads between the sidebar and chat. It supplies agent names and avatars while connection and roster changes invalidate outdated results.

flowchart TD
  A[Sidebar updates] --> C[Shared identity cache]
  B[Chat identity reads] --> C
  C --> D{Retry deadline reached?}
  D -->|No| E[Reuse cached request]
  D -->|Yes| F[Gateway identity read]
  F --> C
  G[Reconnect or invalidation] --> C
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +10, Tests +123, Docs +6. Total +139 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 27 17 +10
Tests 1 124 1 +123
Docs 1 6 0 +6
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 157 18 +139

Review metrics

None.

Technical review

Best possible solution:

Keep retry pacing in the shared identity cache while preserving successful-read freshness, displayed identities, and immediate reconnect invalidation.

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

Yes, source establishes the path: rejected identity reads are evicted on current main and sidebar updates request them again. The PR reports a live storm and failing baseline regressions; this review did not execute them.

Is this the best way to solve the issue?

Yes, the patch repairs the shared request owner with the existing retry helper and retains connection-generation safeguards, avoiding separate sidebar and chat retry implementations.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: This repairs unnecessary Control UI request bursts during Gateway restart or admission without changing protocol, configuration, or message delivery.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The verified repository-admin author is exempt from ordinary external-contributor proof requirements. Available evidence covers the pre-fix live identity-read storm and supplemental owner tests, without claiming after-fix live recovery; the cache remains in memory and changes no stored-data contract.

Label justifications:

  • P2: This repairs unnecessary Control UI request bursts during Gateway restart or admission without changing protocol, configuration, or message delivery.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The verified repository-admin author is exempt from ordinary external-contributor proof requirements. Available evidence covers the pre-fix live identity-read storm and supplemental owner tests, without claiming after-fix live recovery; the cache remains in memory and changes no stored-data contract.

Evidence

What I checked:

  • Pinned introduction and merge result: The merge-base-to-head patch introduces retry deadlines and failure counts only in the identity owner, its regression tests, and reconnect documentation. The test-merge comparison contains the same production change. (ui/src/lib/agents/identity.ts:61, 964b4a98f053)
  • Current main still needs the repair: Current main deletes a cache entry on rejection. The sidebar invokes identity hydration during updates, so a subsequent update can immediately issue another rejected request. (ui/src/lib/agents/identity.ts:88, a9f4080f9749)
  • Existing retry policy reused: The shared read-retry helper provides exponential delays from 500 ms to 5 seconds and preserves longer finite Gateway hints. The patch consumes this existing owner rather than adding competing retry policy. (ui/src/lib/gateway-availability.ts:20, 964b4a98f053)
  • Regression coverage: The complete test file covers repeated failed reads, server retry hints, independent agent windows, recovery, retained display values, reconnect/config/agent invalidation, and stale-result rejection. The captured body reports three pre-fix failures and twelve passing branch cases in 2.9 seconds; these are contributor-reported results, not reviewer executions. (ui/src/lib/agents/identity.test.ts:14, 964b4a98f053)
  • Verified author role: GitHub’s collaborator-permission endpoint confirms steipete has repository admin permission, resolving the supplied association discrepancy. The ordinary external-contributor proof gate does not apply.
  • Area history and inspection limits: Current-main path history records Peter Steinberger’s avatar-cache work and subsequent identity-owner maintenance. Missing historical objects prevented complete blame and parent-patch inspection, so no source-line introduction attribution is claimed. Latest-release source inspection was also unavailable; release inclusion is not established. (ui/src/lib/agents/identity.ts, 4c0c0c0e3af9)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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.

@steipete
steipete merged commit ad9e92c into main Oct 5, 2026
137 of 140 checks passed
@steipete
steipete deleted the codex/stab-identity-storm branch October 5, 2026 08:51
@steipete

steipete commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 6, 2026
Keep rejected identity requests in the shared per-agent cache until the read retry deadline, honoring Gateway retry hints and preserving the last displayed identity during failed refreshes. Reconnect and explicit invalidation retire the cooldown. Evict settled failures under the existing cache bound.

Regression proof: the original owner issued 41 requests for 40 repeated updates, while the fix issues one per retry window. Identity tests pass (12 cases, 2.86 s command wall time); focused consumers pass (63 cases). No Gateway protocol or drain-policy changes.
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 P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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