Skip to content

fix: hide agents excluded by operator roles from the picker - #161019

Merged
Patrick-Erichsen merged 5 commits into
mainfrom
fix/agent-picker-access
Sep 30, 2026
Merged

Patrick-Erichsen merged 5 commits into
mainfrom
fix/agent-picker-access

Conversation

@Patrick-Erichsen

@Patrick-Erichsen Patrick-Erichsen commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes private agents appearing in the Control UI picker and agent directory when the signed-in user’s role allows only a subset of agents.

User Impact

Users discover only agents allowed by their existing role. A saved selection falls back to an allowed agent; an empty allowlist clears the selection. Reloads and reconnects wait for current discovery instead of showing an older browser roster or remembered picker identity. Owners and roles with agents: "*" retain the full roster.

Why This Change Was Made

Filter agents.list using the current operator role after asynchronous preparation, then reconcile UI selection against the returned roster. Preserve Gateway routing defaults and ownership metadata; existing session/run authorization stays enforced. Discovery does not grant or revoke session-reading access. Remove the cached discovery fallback and require a live roster for new-session catalog targets; keep stored sessions, groups, transcripts, and draft intent.

Evidence

Gateway filtering

Real isolated Gateway + Control UI, synthetic accounts, identical role configuration. Guest allows only shared; owner allows *. Baseline uses the exact changed modules from 4d8c9bddda7f992e293005b78f6bc1f8adea81ed; candidate uses 9f53a63f3723452079ba2827895934a35031a8c4. No mocked RPC responses or personal gateway data.

Restricted user Before After
Desktop, 1440×900 Before: guest sees private and main agents After: guest sees only Shared Assistant
Mobile, 390×844 Before: private agents appear in mobile picker After: mobile picker exposes only allowed agent
Owner and empty-allowlist controls

Owner still sees the full roster

Empty allowlist returns no agents and clears the selection

  • Real authenticated RPC assertions: restricted user receives only ["shared"]; owner receives all three; empty allowlist receives []. Both original browser runs passed; this Gateway code is unchanged by the cache repair.
  • Gateway regressions: original handler 3 failed / 2 passed; candidate 5 passed. Covers subset, empty, wildcard, system owner, and role narrowing while catalog preparation is pending.
  • UI selection suite: original behavior 3 failed / 38 passed; candidate 41 passed. Covers saved forbidden/default selection and loaded-empty roster behavior in both sidebar modes.
  • Original Auto Review: no actionable P0–P2 findings; a later ClawSweeper review identified the persisted-roster gap addressed below.
  • Changed-file repository checks passed, including core/test/UI type checks, lint, dead-export scans, import cycles, and all selected guards. Supplemental formatting/lint for the new gateway test also passed. All six original uploaded images were verified rendered on this PR.
Test cost and capture scope

pnpm test src/gateway/server-methods/agents-list.test.ts --maxWorkers=1: 36.03s warm command wall, 38ms test bodies. Cold wall was 164.43s, dominated by shared worker compilation. Only workspace/model roster enrichment is mocked; the handler and role resolver are real.

ui/src/app/agent-selection.test.ts: 5.48s command wall, under 50ms test bodies. Browser proof is a local isolated integration run, not an added per-PR E2E suite (baseline 71.19s, candidate 106.82s scenario time).

Captured the actual sidebar picker on /agents, using synthetic trusted-proxy identities, disabled bundled plugins, and no mocked RPC responses. Desktop and mobile cover the changed rendered states. Owner and empty-role screenshots cover permission boundaries. The cache repair below additionally covers loading, reconnect, and failed-refresh states.

Persisted-roster and reconnect regression

The later ClawSweeper P1 is fixed by removing persisted agent rosters from discovery and suppressing remembered picker identities without a current roster row. These additional captures run the real Control UI, bootstrap, localStorage version2 boot-record reader, and agent capability against a synthetic WebSocket transport. They prove the browser lifecycle; the original real-Gateway evidence above proves server filtering. Baseline freezes the ten affected production modules at 9f53a63f3723452079ba2827895934a35031a8c4; candidate uses final source a4ccc69f5815cbd2c790bfbd880e9ce6262787a3 (UI tree ddcb19613aeb883ac46814c61ea82777f880f093, refreshed after integrating the tested CI main parent). All accounts and content are synthetic.

The same credential/profile starts with an old three-agent boot record while live discovery is held. The restricted response admits only Shared Assistant. A later successful broader response is delivered through config.changed; the transport then reconnects after the role narrows and fails the new roster request. No application state is patched.

Browser state Before After
Old version2 record; current roster pending Before: cached private agents appear while discovery is pending After: picker waits for current authorized discovery
Previously broader role; narrowed reconnect request fails Before: broader roster returns after reconnect failure After: reconnect failure cannot restore the old roster

After: successful current response shows only Shared Assistant

  • All six browser lifecycle assertions pass on the candidate; five expose excluded agents on the baseline. The successful response still selects and displays the allowed agent.
  • Regression-first proof: bootstrap/cache and failed-refresh cases failed before the repair; both now pass. Rendered picker-header regression failed before the repair and now passes for both pending and loaded-but-excluded discovery. Existing readable session labels remain visible.
  • Focused lifecycle/route/sidebar run: 254 passed initially; the sole failure was an old attention fixture expecting an agent header with no roster. Supplying that fixture's live roster repairs its premise; the affected sidebar rerun passed 21/21. Adjacent selection, bootstrap selection, submit-gate, palette, and model-default suites passed 102/102.

Tradeoff: the agent directory and picker wait for live discovery after reload/reconnect. Cached conversation content and groups remain available; shorthand chat routes wait for hello routing defaults. No protocol, config, or stored-data schema change.

  • Repair validation: all selected changed-file checks passed, including affected test/UI type checks, lint, format, and dead-export scans; the final attention-fixture format/lint supplement passed.
  • Final full-diff AutoReview against the integrated CI main parent: scoped-clean, no actionable P0–P2 findings, covering the complete privacy change and cancellation repair below. Index and working-tree bytes matched during review.

CI cancellation repair

The failing CI job exposed a pre-existing Stop race, also reproduced on its unmodified main parent 8c39234ebfff5ce5643bf3c9ee544ecac67e7705. A concurrent cancellation metadata write temporarily invalidated session facts between the terminal registry commit and publication, leaving the scheduler slot active.

The three-file repair uses the existing session publication FIFO around native persistence, acknowledgement, and publication. Snapshot capture/restore stays synchronous; transcript/plugin work and terminal cleanup stay outside the FIFO. Current-owner, generation, retirement, and replacement checks remain enforced. The original CI main parent was integrated specifically to repair this owner; the mechanical merge tree matches the inspected CI merge exactly.

Local regression proof Before After
Exact original 50-file CI plan 953 passed, 3 skipped, 2 failed; 152.70s 955 passed, 3 skipped, 0 failed; 134.55s
Real Stop fixture 10 passed, 2 failed; 47.38s 12 passed; 39.30s
Two new held-admission regressions Both fail; 5.27s command wall Full owner suite 21 passed; 2.27s command wall, new cases 4ms/3ms

The new cases prove staged terminal rows remain private while metadata publication is held, then publish for the current owner and refuse a replaced owner. These are local results; current-head hosted CI remains enforced by the normal landing workflow.

Selected final checks passed: repository guards, core production types, all 27 test type graphs, all three unused-export scans, scoped lint, format, import cycles, and storage/auth guards. Lint found two redundant default type arguments in the new test; those were removed and scoped lint/format plus all 21 publication tests passed again (3.24s wrapper wall). No behavioral source changed after the clean AutoReview.

Reconnect drafts and final browser regressions

Live-only discovery also retires the settings editor's selected target during reconnect. Preserve its unsaved identity draft privately and restore it only when current discovery re-admits the same agent for the same profile and selection intent. Source/profile changes and a newer selection discard it. The page's draft-retention owner keeps discovery and actions unavailable while the roster is absent.

Real Control UI against the existing synthetic Gateway fixture, identical interrupted-save scenario. Baseline is a4ccc69f5815cbd2c790bfbd880e9ce6262787a3; candidate is 607311074a83df2a9ee300c02f1d0d43170709db. The typed name is lost before the repair and retained after live rediscovery.

After reconnect interrupts saving Before After
Unsaved identity edit Before: reconnect loses the unsaved agent name After: reconnect preserves the unsaved agent name
Focused local regression proof Before After
Same-target identity draft + rejection controls Same-target fails; 4 rejection controls pass, 1.82s Full selection/identity suites: 28 pass, 1.40s
Save interrupted at update/config read 2 fail, 18.25s 2 pass, 13.94s
Sidebar fixture prerequisites 3 fail, 3.52s Both affected suites: 256 pass, 29.03s
Memory import failed roster then explicit retry Original case fails, 2.94s Complete suite: 12 pass, 2.52s; revised case 78ms
New-session live workspace defaults Explicit-folder case fails, 29.52s Complete browser file: 4 pass, 22.96s; changed cases 3.96s/4.05s
Qualified warm-reload conversation Original matching-profile case fails, 22.46s All 4 profile cases pass, 17.82s

The reconnect cases retain their original assertions. New-session now exercises live roster admission before explicit workspace selection, then holds discovery during reconnect to verify draft retention and blocked dispatch. Warm reload uses a literal conversation key so the test retains its pre-hello transcript/auth-isolation contract; shorthand main routes intentionally require live routing defaults. The draft extraction also shrinks the existing settings page, with the repository size guard passing. These are local command wall times; hosted timing remains visible in the linked CI run.

The earlier CI run also reported a single 120s mobile GitHub-hovercard timeout. Its test and owning hovercard/registration code are unchanged by this PR. An original-order replay of all 21 cases passed in34.83s; this is a non-reproduction, not a repair. CI diagnostics suggest the deferred preview request was never observed after mobile resize/focus, but did not preserve the failing page state, so the cause remains unresolved. No assertion, timeout, or retry policy was weakened; final-head CI remains required.

Independent incremental AutoReview completed at P0–P2 with one suggestion, inspected and rejected: discard a retained local draft when the same operator keeps read access but loses identity-write permission. The draft contains that operator’s own typed input and is restored only for a currently discoverable agent; preserving it does not grant write access. Existing overview controls remain disabled without agents.update authority, and saveIdentityDraft checks current operator.admin permission both at entry and immediately before dispatch. Clearing the draft would introduce avoidable data loss rather than repair an authorization leak. No accepted actionable findings remain.

Follow-up selected checks passed: repository guards, all 8 affected test type graphs, UI types, i18n, three unused-export scans, formatting, scoped lint, and stylelint. Lint identified a shadowed callback variable; its local name was changed without affecting behavior, followed by passing format/lint/stylelint.

Inherited cancellation fixture failure

The final Node shard on a4ccc69 stalled in chat.abort-errors.test.ts (cascade native new), then the reset/delete cases failed cleanup. The original-order 10-case file reproduces 7 passes and 3 failures both on the tested merge 75b750f9 and its unmodified main parent b09d30a, using bounded diagnostic timeouts. The fixture held a child metadata writer while waiting for terminal publication through that same writer queue.

Main already contains the canonical repair 79f0e9bf127: hold the original abort-marker call after termination, then delegate to the real helper, preserving all lifecycle/transcript assertions. Its published validation reports 10/10 focused cases and 424/424 in the original 31-file group on Linux. No duplicate fixture change or production adjustment is added here; current-head CI must exercise the PR with that main fix.

Receiving validation of canonical 79f0e9bf127: the unchanged 10-case abort/reset file passes on the previously failing exact PR merge with only the canonical test blob applied, using normal configured budgets (73.51s test duration / 76.73s command wall). The formerly stalled native-new/reset/delete cases take 1.59s / 1.94s / 2.92s. This is local receiving proof; current-head hosted CI remains required.

@clawsweeper

clawsweeper Bot commented Sep 29, 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 size: M labels Sep 29, 2026
@clawsweeper

clawsweeper Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 30, 2026, 6:48 PM ET / 22:48 UTC (Revision 5).

ClawSweeper review

What this changes

The branch filters agent discovery by operator role, makes Control UI pickers wait for live discovery, preserves unsaved agent edits across reconnect, and serializes subagent completion publication.

Merge readiness

✅ Ready for maintainer review

Keep open: current main and v2026.9.7 still expose the full agent roster to role-limited operators. This branch addresses that distinct problem, and this review found no new blocking defect.

Priority: P1
Reviewed head: 607311074a83df2a9ee300c02f1d0d43170709db

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The branch has strong Gateway and browser evidence, with a coherent broad patch and no established blocking defect.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): The pinned PR body reports an isolated authenticated Gateway run showing restricted, owner, and empty-allowlist responses, plus real Control UI before-and-after browser runs for picker, reconnect, and draft recovery. Four prepared picker images were inspected directly; later linked reconnect images were not in the local manifest, a reviewer inspection gap. The unchanged version-2 boot-record format remains readable while cached groups are preserved.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (screenshot): The pinned PR body reports an isolated authenticated Gateway run showing restricted, owner, and empty-allowlist responses, plus real Control UI before-and-after browser runs for picker, reconnect, and draft recovery. Four prepared picker images were inspected directly; later linked reconnect images were not in the local manifest, a reviewer inspection gap. The unchanged version-2 boot-record format remains readable while cached groups are preserved.
Evidence reviewed 11 items Current main remains unfiltered: The current handler maps or returns every agent in the result without applying the role’s agent allowlist.
Released behavior remains unfiltered: The latest release also returns the full roster from agents.list.
Introduced Gateway role filter: After asynchronous roster preparation, the proposed handler resolves the role from current config and filters returned agents before responding.
Findings None None.
Security None None.

How this fits together

The Gateway turns configured agents and the caller’s operator role into an agent roster. The Control UI uses that roster for its picker and directory; subagent completion separately publishes through the session write queue.

flowchart LR
A[Configured agents] --> C[Gateway discovery]
B[Current operator role] --> C
C --> D[Live UI roster]
D --> E[Picker and directory]
F[Subagent completion] --> G[Session publication queue]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +50, Tests +336, Docs +11. Total +397 across 38 files.

View PR surface stats
Area Files Added Removed Net
Source 16 244 194 +50
Tests 20 621 285 +336
Docs 2 13 2 +11
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 38 878 481 +397

Review metrics

Metric Value Why it matters
Code growth production +244/-194 (net +50); tests +621/-285 (net +336) The production growth supports reconnect draft retention and publication ordering, with focused regression coverage.

Technical review

Best possible solution:

Keep discovery tied to the current Gateway role and live roster while preserving separately authorized session reads and same-owner unsaved drafts.

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

Yes. Current main returns an unfiltered roster, and the contributor’s isolated Gateway before-and-after evidence exercises a restricted role; this read-only review did not execute current main.

Is this the best way to solve the issue?

Yes. Filtering at the Gateway discovery owner and withholding stale browser rosters addresses the reported picker exposure while preserving session-read authorization.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 0935289e2e7b.

Labels

Label changes:

No label changes.

Label justifications:

  • P1: Restricted operators can currently discover agent rows excluded by their role.
  • merge-risk: 🚨 compatibility: Existing offline picker and directory behavior changes to live-only discovery; the recorded disposition accepts this documented tradeoff.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): The pinned PR body reports an isolated authenticated Gateway run showing restricted, owner, and empty-allowlist responses, plus real Control UI before-and-after browser runs for picker, reconnect, and draft recovery. Four prepared picker images were inspected directly; later linked reconnect images were not in the local manifest, a reviewer inspection gap. The unchanged version-2 boot-record format remains readable while cached groups are preserved.
  • proof: sufficient: Contributor real behavior proof is sufficient. The pinned PR body reports an isolated authenticated Gateway run showing restricted, owner, and empty-allowlist responses, plus real Control UI before-and-after browser runs for picker, reconnect, and draft recovery. Four prepared picker images were inspected directly; later linked reconnect images were not in the local manifest, a reviewer inspection gap. The unchanged version-2 boot-record format remains readable while cached groups are preserved.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The pinned PR body reports an isolated authenticated Gateway run showing restricted, owner, and empty-allowlist responses, plus real Control UI before-and-after browser runs for picker, reconnect, and draft recovery. Four prepared picker images were inspected directly; later linked reconnect images were not in the local manifest, a reviewer inspection gap. The unchanged version-2 boot-record format remains readable while cached groups are preserved.

Evidence

What I checked:

Likely related people:

  • Patrick-Erichsen: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • shakkernerd: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Peter Steinberger: Raw commit f2889ab adds src/agents/subagents/registry/subagent-registry-persistence.ts:620 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: f2889ab09f80; files: src/agents/subagents/registry/subagent-registry-persistence.ts)

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.

History

Review history (4 earlier review cycles)
  • reviewed 2026-09-29T06:26:37.602Z sha 9f53a63 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-29T06:34:10.551Z sha 9f53a63 :: needs real behavior proof before merge. :: [P1] Invalidate cached rosters before role-scoped discovery renders
  • reviewed 2026-09-30T21:26:22.524Z sha a9a5ec4 :: blocked before merge. :: none
  • reviewed 2026-09-30T22:13:34.083Z sha a4ccc69 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 29, 2026
@Patrick-Erichsen

Patrick-Erichsen commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor Author

The persisted-roster finding is repaired in a9a5ec48a3308477e2e1283416915fb0ceed3fec. The PR body now includes inspected before/after proof for old version2 cache, same-profile role narrowing on reconnect, failed refresh, and successful restricted discovery, alongside the original real-Gateway evidence. All 11 images render.

Maintainer decision confirmed for this change: the role agent allowlist is also the discovery ceiling. Existing session-read policy remains independent, as documented; readable cached conversations and group preferences are preserved.

Revision 3 maintainer disposition: accept live-only agent discovery and the resulting offline picker/directory limitation for this privacy fix. A saved roster cannot establish the current role's permission to discover an agent. Cached conversations, transcripts, and groups remain available; the documentation now states the tradeoff. The changed paths have no listed CODEOWNERS rule. The required security review passed on the repaired head.

The remaining CI failure is being investigated separately against the exact tested merge; it concerns the unchanged session-cancellation fixture.

@clawsweeper

clawsweeper Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@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. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 30, 2026
@Patrick-Erichsen

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Published a4ccc69f5815cbd2c790bfbd880e9ce6262787a3 with the independently reproduced CI Stop-race repair. The existing session publication FIFO now covers registry persistence through acknowledgement/publication; capture and terminal cleanup remain outside it, with current-owner guards preserved. The exact original 50-file CI plan changed from 2 failures to 955 passed / 3 skipped / 0 failed. Both new admission regressions fail on the baseline; the repaired owner suite passes 21/21. Final full-diff AutoReview is clean at P0–P2, and all selected static checks pass after removing two redundant test type arguments.

The PR body includes refreshed, inspected screenshots from the final UI source. Revision 3's product disposition remains accepted: picker/directory discovery requires a current live roster; cached conversations and groups remain available. This follows the requested privacy fix and explicit landing instruction. No live Gateway or operator configuration was changed.

@clawsweeper

clawsweeper Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling and removed size: L labels Sep 30, 2026
@clawsweeper

clawsweeper Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@Patrick-Erichsen
Patrick-Erichsen merged commit 5ad2c6b into main Sep 30, 2026
206 of 207 checks passed
@Patrick-Erichsen
Patrick-Erichsen deleted the fix/agent-picker-access branch September 30, 2026 22:59
@Patrick-Erichsen

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 1, 2026
…#161019)

* fix: hide agents excluded by operator roles from the picker

* fix: require live discovery before showing agent rosters

* fix: serialize subagent completion publication with session metadata

* fix: retain authorized agent drafts across live rediscovery
@VACInc

VACInc commented Oct 1, 2026

Copy link
Copy Markdown
Member

Integration cross-reference: #160760 has merged to main as 6daee6e. During its final conflict resolution it reused the canonical subagent completion-publication implementation already landed here as 5ad2c6b, and removed its superseded local completion wrapper and duplicate fixture instead of retaining a second owner.

That integration is separate from #160760’s remaining CLI/MCP exec handoff. This PR remains merged; this cross-reference does not reopen it or claim that all unrelated subagent/Stop reports are resolved.

steipete added a commit that referenced this pull request Oct 1, 2026
…rite

Scheduled main run 36780090668 failed sessions.abort-embedded.test.ts when
a parent Stop's child-row writes (session timing, abort marker) overlapped
the killed collector's terminal commit. A session-entry worker write holds
the agent-database writer FIFO from its commit grant through settlement,
and in that window the collector's retained generation reads as
unavailable, so completion failed or was declined and never released its
swarm scheduler slot.

#161019 moved the collector registry write and publication into that
writer turn and #161676 deferred the remaining pre-capture currency check
into it. Neither added coverage for the collector path: #161019's worker
test stubs assertCurrent, and reverting #161676's deferral leaves every
existing test green.

Add an end-to-end regression with real SQLite writers: after completion
retains generation facts, hold a real child metadata write between its
native commit and settlement. Completion must join that writer, keep the
staged terminal row off the live registry while waiting, preserve the
metadata write, reach terminal state and release its swarm slot. It fails
with the original CI error when #161676's deferral is reverted.
steipete added a commit that referenced this pull request Oct 1, 2026
…rite (#162359)

Scheduled main run 36780090668 failed sessions.abort-embedded.test.ts when
a parent Stop's child-row writes (session timing, abort marker) overlapped
the killed collector's terminal commit. A session-entry worker write holds
the agent-database writer FIFO from its commit grant through settlement,
and in that window the collector's retained generation reads as
unavailable, so completion failed or was declined and never released its
swarm scheduler slot.

#161019 moved the collector registry write and publication into that
writer turn and #161676 deferred the remaining pre-capture currency check
into it. Neither added coverage for the collector path: #161019's worker
test stubs assertCurrent, and reverting #161676's deferral leaves every
existing test green.

Add an end-to-end regression with real SQLite writers: after completion
retains generation facts, hold a real child metadata write between its
native commit and settlement. Completion must join that writer, keep the
staged terminal row off the live registry while waiting, preserve the
metadata write, reach terminal state and release its swarm slot. It fails
with the original CI error when #161676's deferral is reverted.
steipete added a commit that referenced this pull request Oct 1, 2026
Agent discovery became live-only in #161019, but short-route cache
resolution still required agentsList to provide routing defaults. A warm
reload could finish reading its transcript snapshot and still wait for
Gateway connect before returning the route.

Project only mainKey and scope through the existing session cache lifecycle.
Retire these hints on connect, credential/Gateway changes, and disposal.
Keep agent discovery live-only, preserve reserved main-key URL parsing,
and retain exact-session live revalidation and refusal on reconnect.

Bundled Chromium reloads on two isolated Gateways using the same compiled
runtime at 83a9740, identical synthetic sessions, immutable assets, and
TCP delays: four interleaved rounds per RTT, alternating before/after order.
Median visible time (ms): 0 RTT 321 -> 314; 80 RTT 436.5 -> 316.5;
200 RTT 766 -> 404.5. Per-run before/after values:
0: 329,313,343,307 / 315,313,313,396
80: 429,439,441,434 / 327,323,310,290
200: 770,760,762,776 / 400,417,403,406
At 200 RTT, the original trace read the snapshot at 337 ms, received
connect at 671 ms, and rendered at 759 ms. The fixed trace read at 358 ms,
rendered at 436 ms, and received connect at 723 ms.

Regression proof fails on original production code and passes with the fix.
Relevant role-discovery, routing, cache, and reconnect coverage passes:
270 tests across 16 focused files. Repaired the cold-route fixture's missing
session capability without changing its assertions. Per-file test wall cost:
route-warm-boot 3.49 s; session-roster-warm-boot 10.05 s; route 3.84 s.

Validation: core/UI/core-test/root-test tsgo; both import-cycle checks (0);
all five typed core lint stripes; oxfmt; diff check; bundled UI build and
performance budgets; independent Codex review scoped-clean through P2.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 2, 2026
…rite (openclaw#162359)

Scheduled main run 36780090668 failed sessions.abort-embedded.test.ts when
a parent Stop's child-row writes (session timing, abort marker) overlapped
the killed collector's terminal commit. A session-entry worker write holds
the agent-database writer FIFO from its commit grant through settlement,
and in that window the collector's retained generation reads as
unavailable, so completion failed or was declined and never released its
swarm scheduler slot.

openclaw#161019 moved the collector registry write and publication into that
writer turn and openclaw#161676 deferred the remaining pre-capture currency check
into it. Neither added coverage for the collector path: openclaw#161019's worker
test stubs assertCurrent, and reverting openclaw#161676's deferral leaves every
existing test green.

Add an end-to-end regression with real SQLite writers: after completion
retains generation facts, hold a real child metadata write between its
native commit and settlement. Completion must join that writer, keep the
staged terminal row off the live registry while waiting, preserve the
metadata write, reach terminal state and release its swarm slot. It fails
with the original CI error when openclaw#161676's deferral is reverted.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 2, 2026
…62794)

Agent discovery became live-only in openclaw#161019, but short-route cache
resolution still required agentsList to provide routing defaults. A warm
reload could finish reading its transcript snapshot and still wait for
Gateway connect before returning the route.

Project only mainKey and scope through the existing session cache lifecycle.
Retire these hints on connect, credential/Gateway changes, and disposal.
Keep agent discovery live-only, preserve reserved main-key URL parsing,
and retain exact-session live revalidation and refusal on reconnect.

Bundled Chromium reloads on two isolated Gateways using the same compiled
runtime at 1eea3b8, identical synthetic sessions, immutable assets, and
TCP delays: four interleaved rounds per RTT, alternating before/after order.
Median visible time (ms): 0 RTT 321 -> 314; 80 RTT 436.5 -> 316.5;
200 RTT 766 -> 404.5. Per-run before/after values:
0: 329,313,343,307 / 315,313,313,396
80: 429,439,441,434 / 327,323,310,290
200: 770,760,762,776 / 400,417,403,406
At 200 RTT, the original trace read the snapshot at 337 ms, received
connect at 671 ms, and rendered at 759 ms. The fixed trace read at 358 ms,
rendered at 436 ms, and received connect at 723 ms.

Regression proof fails on original production code and passes with the fix.
Relevant role-discovery, routing, cache, and reconnect coverage passes:
270 tests across 16 focused files. Repaired the cold-route fixture's missing
session capability without changing its assertions. Per-file test wall cost:
route-warm-boot 3.49 s; session-roster-warm-boot 10.05 s; route 3.84 s.

Validation: core/UI/core-test/root-test tsgo; both import-cycle checks (0);
all five typed core lint stripes; oxfmt; diff check; bundled UI build and
performance budgets; independent Codex review scoped-clean through P2.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. 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. size: XL 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.

2 participants