Skip to content

fix(tui): keep stale agent picker closed after refresh failure - #116715

Merged
steipete merged 1 commit into
mainfrom
codex/autoqa-tui-agent-refresh-20260731
Jul 31, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/autoqa-tui-agent-refresh-20260731

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where /agents or Ctrl+G could open the last cached agent roster after agents.list failed. An operator could then select stale data and mutate the local agent/session tuple while the Gateway was unavailable.

Why This Change Was Made

Agent roster refresh now returns an explicit binary result. The TUI preserves the last good roster for passive display, but the interactive picker opens only after a fresh successful response; failures remain visible in the chat log.

User Impact

When agent discovery fails, the TUI shows the actionable error and keeps the stale picker closed. A later successful refresh still opens the normalized current roster normally.

Evidence

  • Real TUI PTY proof: the fixture loaded a valid cached roster, forced the next agents.list call to fail, displayed agents list failed: gateway unavailable, and then delivered typed input to sendChat. That final input proves no stale picker overlay consumed it. Verdict: PASS, with two refresh calls and visible failure, on Testbox tbx_01kyvh5p4hzyrzr520yvmf5mgz (run 30612928358).
  • Focused final-tree proof: 206/206 TUI session-action and command-handler tests passed on the same lease.
  • Final-tree changed gate: core production/test typechecks, lint, formatting, architecture, database-first, pairing, webhook, and boundary guards passed.
  • Final Codex autoreview: clean, no accepted/actionable findings; overall correctness 0.95.

@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Jul 31, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. P2 Normal backlog priority with limited blast radius. labels Jul 31, 2026
@clawsweeper

clawsweeper Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 31, 2026, 3:53 AM ET / 07:53 UTC.

ClawSweeper review

What this changes

The PR changes the terminal UI so the agent picker opens only after a successful fresh roster response, while a failed refresh retains the cached roster for passive display and reports the gateway error.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep this PR open for explicit maintainer handling: the targeted freshness gate is a focused, source-consistent repair with supplied PTY proof, but the maintainer label prevents automatic cleanup or landing decisions.

Priority: P2
Reviewed head: 7c06142f5139d365c2b9fcbc0891f0ec7279ecf3
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A small, coherent state-safety repair with direct regression coverage and credible real terminal proof; remaining approval is policy and final-CI handling, not a detected patch defect.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The PR body provides an after-fix Testbox PTY scenario with a forced Gateway failure, visible actionable error, preserved chat input, and a linked successful proof run; no private information is included in the supplied description.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR body provides an after-fix Testbox PTY scenario with a forced Gateway failure, visible actionable error, preserved chat input, and a linked successful proof run; no private information is included in the supplied description.
Evidence reviewed 4 items Freshness boundary: The new helper returns a binary Result: it applies only a successful roster and reports the formatted error without changing the cached roster on failure.
Picker gate: The command handler now returns before constructing the selectable-agent overlay when refreshAgents reports failure, preventing stale roster selection after an unavailable Gateway.
Regression coverage and runtime proof: The branch adds tests for preserving cached state after agents.list failure and for successful normalized refresh; the PR body also reports a real PTY Testbox run that shows the failure message and confirms typed chat input was not consumed by a stale overlay.
Findings None None.
Security None None.

How this fits together

The terminal UI fetches the Gateway’s agent roster and stores the normalized result in local session state. Slash commands and keyboard shortcuts use that state to open the agent picker, which can change the active agent and session selection.

flowchart LR
  A[User runs /agents or Ctrl+G] --> B[Terminal UI command handler]
  B --> C[Refresh agent roster]
  C --> D{Gateway response succeeds?}
  D -->|Yes| E[Normalize and store fresh roster]
  E --> F[Open agent picker]
  D -->|No| G[Show actionable error]
  G --> H[Keep cached roster closed for display only]
Loading

Decision needed

Question Recommendation
Should the TUI owner approve the new rule that cached agent data remains visible after a Gateway failure but cannot be used to open the interactive picker? Approve the freshness gate: Accept the PR’s safer behavior: show the Gateway error, retain cached display data, and require a successful current roster before allowing selection.

Why: This is a user-visible session-selection policy during backend unavailability, and the protected maintainer label requires an explicit human decision even though the implementation and supplied proof are focused.

Before merge

  • Resolve merge risk (P0) - The branch changes when interactive agent/session selection is permitted during a Gateway outage; maintainers should retain the successful PTY scenario and let the remaining exact-head checks complete before landing.
Agent review details

Security

None.

PR surface

Source +23, Tests +129. Total +152 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 3 33 10 +23
Tests 2 130 1 +129
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 163 11 +152

Review metrics

None.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep the explicit successful-refresh result at the TUI session-action boundary, preserve cached data only for non-interactive display, and merge after the responsible TUI reviewer accepts the outage behavior and the remaining checks finish.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep the explicit successful-refresh result at the TUI session-action boundary, preserve cached data only for non-interactive display, and merge after the responsible TUI reviewer accepts the outage behavior and the remaining checks finish.

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

No live current-main reproduction was independently run in this read-only review, but the failure path is source-reproducible: a rejected agents.list call previously left cached agents available to the picker. The PR supplies a real PTY reproduction-and-fix transcript for that path.

Is this the best way to solve the issue?

Yes. Returning an explicit refresh result at the session-action boundary lets the command handler distinguish fresh data from cached display state without discarding the last good roster or adding configuration surface.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 37b1a7165406.

Labels

Label changes:

  • add P2: A failed agent discovery request can otherwise expose stale interactive session-selection state, but the repair is narrow and does not indicate a broad availability or data-loss incident.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides an after-fix Testbox PTY scenario with a forced Gateway failure, visible actionable error, preserved chat input, and a linked successful proof run; no private information is included in the supplied description.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body provides an after-fix Testbox PTY scenario with a forced Gateway failure, visible actionable error, preserved chat input, and a linked successful proof run; no private information is included in the supplied description.

Label justifications:

  • P2: A failed agent discovery request can otherwise expose stale interactive session-selection state, but the repair is narrow and does not indicate a broad availability or data-loss incident.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body provides an after-fix Testbox PTY scenario with a forced Gateway failure, visible actionable error, preserved chat input, and a linked successful proof run; no private information is included in the supplied description.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides an after-fix Testbox PTY scenario with a forced Gateway failure, visible actionable error, preserved chat input, and a linked successful proof run; no private information is included in the supplied description.

Evidence

What I checked:

  • Freshness boundary: The new helper returns a binary Result: it applies only a successful roster and reports the formatted error without changing the cached roster on failure. (src/tui/tui-agent-list-refresh.ts:7, 7c06142f5139)
  • Picker gate: The command handler now returns before constructing the selectable-agent overlay when refreshAgents reports failure, preventing stale roster selection after an unavailable Gateway. (src/tui/tui-command-handlers.ts:290, 7c06142f5139)
  • Regression coverage and runtime proof: The branch adds tests for preserving cached state after agents.list failure and for successful normalized refresh; the PR body also reports a real PTY Testbox run that shows the failure message and confirms typed chat input was not consumed by a stale overlay. (src/tui/tui-session-actions.test.ts:134, 7c06142f5139)
  • Current review state: The provided PR state reports the branch as cleanly mergeable, with the real-behavior-proof workflow successful and several exact-head CI jobs still in progress; no merged replacement or current-main implementation provenance is provided. (37b1a7165406)

Likely related people:

  • steipete: The available concrete provenance identifies this person as author of the focused TUI refresh commit; no older current-main ownership history was available in the supplied read-only review context. (role: recent TUI contributor; confidence: low; commits: 7c06142f5139; files: src/tui/tui-agent-list-refresh.ts, src/tui/tui-command-handlers.ts, src/tui/tui-session-actions.ts)

Rank-up moves

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

  • Let the remaining exact-head CI jobs finish, then obtain the required TUI maintainer decision on the outage interaction policy.

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

Copy link
Copy Markdown
Contributor Author

TUI owner decision: accepted. We accept the safer outage policy on this exact head: cached agent data may remain visible for passive context, but /agents and Ctrl+G require a successful fresh roster before opening the interactive picker. The retained PTY proof covers the failed-refresh path, and exact-head openclaw/ci-gate run 30613997481 is complete and green.

@steipete
steipete merged commit 5fc9765 into main Jul 31, 2026
128 of 136 checks passed
@steipete
steipete deleted the codex/autoqa-tui-agent-refresh-20260731 branch July 31, 2026 08:05
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit to dwc1997/openclaw that referenced this pull request Jul 31, 2026
* repair/pr-111802-preserve: (3263 commits)
  test: type session request parameters (openclaw#116713)
  fix: retain event invalidation for pagination
  docs: note queued session refresh fix
  fix: preserve queued session refresh options
  fix(exec): require approval for abbreviated inline eval flags [AI] (openclaw#116529)
  fix: keep owner-only tools out of non-owner skill commands [AI] (openclaw#116532)
  fix(ui): bound Talk relay microphone uplink
  fix(tui): require a fresh agent roster (openclaw#116715)
  fix(memory-wiki): preserve user edits when rolling back ChatGPT imports (openclaw#116517)
  fix(agents): cron failures preserve timeout and cancellation reasons (openclaw#116566)
  fix(release): unblock beta validation workflows (openclaw#116708)
  fix(ci): discover frozen target startup benchmark cases (openclaw#116711)
  fix(session): preserve reset message payloads (openclaw#116195)
  fix(qa): tolerate loaded-runner bus delivery stalls (openclaw#116448)
  improve(ci): rebalance embedded agent test configs (openclaw#116436)
  fix(browser): return committed trace path (openclaw#116702)
  fix(qa): exceed Slack table aggregate limit in fallback probe (openclaw#116447)
  fix(qa): use built plugin tools server (openclaw#116442)
  fix(test): keep memory FD repro config valid (openclaw#116698)
  fix(telegram): keep queued tool progress in one message (openclaw#116685)
  ...
vincentkoc added a commit to zw-xysk/openclaw that referenced this pull request Jul 31, 2026
* preserve/pr-109971-ollama-show-inspection-20260731: (4302 commits)
  fix(agents): resume interrupted turns past progress commentary (openclaw#116725)
  fix(gateway): sign device proofs with challenge time (openclaw#116679)
  fix(testing): load relay smoke through UI Vite config
  test(testing): guard realtime relay smoke module path
  fix(testing): repair realtime relay live smoke import
  test: type session request parameters (openclaw#116713)
  fix: retain event invalidation for pagination
  docs: note queued session refresh fix
  fix: preserve queued session refresh options
  fix(exec): require approval for abbreviated inline eval flags [AI] (openclaw#116529)
  fix: keep owner-only tools out of non-owner skill commands [AI] (openclaw#116532)
  fix(ui): bound Talk relay microphone uplink
  fix(tui): require a fresh agent roster (openclaw#116715)
  fix(memory-wiki): preserve user edits when rolling back ChatGPT imports (openclaw#116517)
  fix(agents): cron failures preserve timeout and cancellation reasons (openclaw#116566)
  fix(release): unblock beta validation workflows (openclaw#116708)
  fix(ci): discover frozen target startup benchmark cases (openclaw#116711)
  fix(session): preserve reset message payloads (openclaw#116195)
  fix(qa): tolerate loaded-runner bus delivery stalls (openclaw#116448)
  improve(ci): rebalance embedded agent test configs (openclaw#116436)
  ...
vincentkoc added a commit to wahaha1223/openclaw that referenced this pull request Jul 31, 2026
* preserve/pr-107473-ollama-stream-ndjson-cap: (5598 commits)
  chore(changelog): remove release-owned entry
  fix(agents): resume interrupted turns past progress commentary (openclaw#116725)
  fix(gateway): sign device proofs with challenge time (openclaw#116679)
  fix(testing): load relay smoke through UI Vite config
  test(testing): guard realtime relay smoke module path
  fix(testing): repair realtime relay live smoke import
  test: type session request parameters (openclaw#116713)
  fix: retain event invalidation for pagination
  docs: note queued session refresh fix
  fix: preserve queued session refresh options
  fix(exec): require approval for abbreviated inline eval flags [AI] (openclaw#116529)
  fix: keep owner-only tools out of non-owner skill commands [AI] (openclaw#116532)
  fix(ui): bound Talk relay microphone uplink
  fix(tui): require a fresh agent roster (openclaw#116715)
  fix(memory-wiki): preserve user edits when rolling back ChatGPT imports (openclaw#116517)
  fix(agents): cron failures preserve timeout and cancellation reasons (openclaw#116566)
  fix(release): unblock beta validation workflows (openclaw#116708)
  fix(ci): discover frozen target startup benchmark cases (openclaw#116711)
  fix(session): preserve reset message payloads (openclaw#116195)
  fix(qa): tolerate loaded-runner bus delivery stalls (openclaw#116448)
  ...
vincentkoc added a commit that referenced this pull request Jul 31, 2026
…-supported-paths

* origin/main: (115 commits)
  test: type session request parameters (#116713)
  fix: retain event invalidation for pagination
  docs: note queued session refresh fix
  fix: preserve queued session refresh options
  fix(exec): require approval for abbreviated inline eval flags [AI] (#116529)
  fix: keep owner-only tools out of non-owner skill commands [AI] (#116532)
  fix(tui): require a fresh agent roster (#116715)
  fix(memory-wiki): preserve user edits when rolling back ChatGPT imports (#116517)
  fix(agents): cron failures preserve timeout and cancellation reasons (#116566)
  fix(release): unblock beta validation workflows (#116708)
  fix(ci): discover frozen target startup benchmark cases (#116711)
  fix(session): preserve reset message payloads (#116195)
  fix(qa): tolerate loaded-runner bus delivery stalls (#116448)
  improve(ci): rebalance embedded agent test configs (#116436)
  fix(browser): return committed trace path (#116702)
  fix(qa): exceed Slack table aggregate limit in fallback probe (#116447)
  fix(qa): use built plugin tools server (#116442)
  fix(test): keep memory FD repro config valid (#116698)
  fix(telegram): keep queued tool progress in one message (#116685)
  fix(qa): stop waiting on yielded fanout runs (#116440)
  ...

# Conflicts:
#	src/system-agent/setup-inference-detect.ts
#	ui/src/e2e/model-setup.e2e.test.ts
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 1, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 1, 2026
…-supported-paths

* origin/main: (115 commits)
  test: type session request parameters (openclaw#116713)
  fix: retain event invalidation for pagination
  docs: note queued session refresh fix
  fix: preserve queued session refresh options
  fix(exec): require approval for abbreviated inline eval flags [AI] (openclaw#116529)
  fix: keep owner-only tools out of non-owner skill commands [AI] (openclaw#116532)
  fix(tui): require a fresh agent roster (openclaw#116715)
  fix(memory-wiki): preserve user edits when rolling back ChatGPT imports (openclaw#116517)
  fix(agents): cron failures preserve timeout and cancellation reasons (openclaw#116566)
  fix(release): unblock beta validation workflows (openclaw#116708)
  fix(ci): discover frozen target startup benchmark cases (openclaw#116711)
  fix(session): preserve reset message payloads (openclaw#116195)
  fix(qa): tolerate loaded-runner bus delivery stalls (openclaw#116448)
  improve(ci): rebalance embedded agent test configs (openclaw#116436)
  fix(browser): return committed trace path (openclaw#116702)
  fix(qa): exceed Slack table aggregate limit in fallback probe (openclaw#116447)
  fix(qa): use built plugin tools server (openclaw#116442)
  fix(test): keep memory FD repro config valid (openclaw#116698)
  fix(telegram): keep queued tool progress in one message (openclaw#116685)
  fix(qa): stop waiting on yielded fanout runs (openclaw#116440)
  ...

# Conflicts:
#	src/system-agent/setup-inference-detect.ts
#	ui/src/e2e/model-setup.e2e.test.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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