Repository navigation
feat: let agents query online people and device activity - #159117
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 27, 2026, 7:22 AM ET / 11:22 UTC (Revision 21). ClawSweeper reviewWhat this changesAdds a read-only presence tool so agents can query connected people, devices, activity, and optional IP location through the Gateway, including from compatible remote workers. Merge readiness⛔ Blocked before merge - 3 items remain Keep open. Current main exposes raw presence but lacks an agent-facing query for online people and device activity. The introduced Gateway and worker paths are coherent, and this review found no concrete blocking defect. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway receives live connection and node activity from clients. Its presence query groups those observations by person and device, checks the requester's authority, and returns a snapshot to an agent or Gateway client. flowchart LR
A[Connected clients and nodes] --> B[Gateway presence snapshot]
C[Agent or remote worker] --> D[Live read authorization]
D --> B
B --> E[Person and device summary]
F[Local IP location plugin] --> E
E --> G[Agent answer]
Before merge
Agent review detailsSecurityNone. PR surfacePR surface statistics unavailable: the file list is incomplete. Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep the Gateway as the live presence owner, preserve source-bound reads from local and remote agents, and leave IP geography with the geolocation plugin without retaining activity history. Do we have a high-confidence way to reproduce the issue? Not applicable: this proposes a new agent capability. Current main's hosted tool list and method catalog establish that the query is absent. Is this the best way to solve the issue? Yes. The Gateway already owns connections and identity, while the existing geolocation plugin owns address lookup; the branch uses those owners and gates remote-worker access on its original reader. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 4f227c5c76a6. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (20 earlier review cycles; latest 8 shown)
|
d28f65d to
41e895c
Compare
|
682d3b6 to
0b22147
Compare
Expose a read-only presence tool for online people, requester-scoped device activity, and optional network and IP geography. Reuse live connection, profile, node, and geolocation owners; preserve activity provenance and worker requester authority without retaining activity history.
Preserve authenticated Team read scopes and explicitly admitted owner or scheduled sources before synthetic Gateway dispatch. Retain the same source through worker execution and revalidate before returning observations. Append the advertised RPC to preserve existing method indices. Include the already-landed c0e6951 Cron fixture scheduler corrections so the branch typechecks independently. Add real local router and worker admission regressions for unknown, limited, scheduled, and revoked sources.
Keep the negative-type assertion from #159132 explicit in the inventory and bind its allowance to the exact synthetic invalid-input fixture. The existing zero-any and inventory checks remain active, and a changed-input control fails at the fixture qualification.
0b22147 to
ab9123e
Compare
|
|
Merged via squash auto-merge.
|
* commit '69809d7a94277d01be964bd1cbbb7aa0ebc58c9b': (219 commits) perf(agents): serialize large model requests once (#159574) refactor(cli): share capability agent-selection test cases (#159616) fix(workers): restore installation type checks (#159629) test(channels,qa,providers): remove low-value tests (batch d065) (#159627) test(doctor): run isolated migration cases concurrently (#159609) feat(apple): show agent identities in native chat (#159528) chore(i18n): refresh native locales (#159635) fix(gateway): keep node provisioning's installation contract after overlapped preparation fix(models): keep shared catalog requests alive for remaining callers (#157191) feat: let agents query online people and device activity (#159117) perf(gateway): first cloud dispatch prepares worker artifacts one after another (#159520) refactor(android): deslop Android app third pass (#159589) test(qa-lab,openshell,slack,reef,team-reports): remove low-value tests (batch d064) (#159607) fix: align process liveness checks (#151107) thanks @ekinnee fix: sessions model default does not clear the override (#159587) fix(ios): preserve typing during reentrant SwiftUI updates fix(ci): frozen 2026.8.33 validation fails on inherited test clock (#159594) perf(gateway): avoid duplicate recipient row lookup (#159595) refactor(gateway): deslop gateway fourth pass (#158786) test(agents): split subagent task-settlement test support under the line cap (#159584) ...
* commit '69809d7a94277d01be964bd1cbbb7aa0ebc58c9b': (219 commits) perf(agents): serialize large model requests once (#159574) refactor(cli): share capability agent-selection test cases (#159616) fix(workers): restore installation type checks (#159629) test(channels,qa,providers): remove low-value tests (batch d065) (#159627) test(doctor): run isolated migration cases concurrently (#159609) feat(apple): show agent identities in native chat (#159528) chore(i18n): refresh native locales (#159635) fix(gateway): keep node provisioning's installation contract after overlapped preparation fix(models): keep shared catalog requests alive for remaining callers (#157191) feat: let agents query online people and device activity (#159117) perf(gateway): first cloud dispatch prepares worker artifacts one after another (#159520) refactor(android): deslop Android app third pass (#159589) test(qa-lab,openshell,slack,reef,team-reports): remove low-value tests (batch d064) (#159607) fix: align process liveness checks (#151107) thanks @ekinnee fix: sessions model default does not clear the override (#159587) fix(ios): preserve typing during reentrant SwiftUI updates fix(ci): frozen 2026.8.33 validation fails on inherited test clock (#159594) perf(gateway): avoid duplicate recipient row lookup (#159595) refactor(gateway): deslop gateway fourth pass (#158786) test(agents): split subagent task-settlement test support under the line cap (#159584) ...
…9117) * feat(presence): let agents inspect people and active devices Expose a read-only presence tool for online people, requester-scoped device activity, and optional network and IP geography. Reuse live connection, profile, node, and geolocation owners; preserve activity provenance and worker requester authority without retaining activity history. * fix(presence): register tool display metadata * fix(presence): require live source authority for agent reads Preserve authenticated Team read scopes and explicitly admitted owner or scheduled sources before synthetic Gateway dispatch. Retain the same source through worker execution and revalidate before returning observations. Append the advertised RPC to preserve existing method indices. Include the already-landed 03f9f7e Cron fixture scheduler corrections so the branch typechecks independently. Add real local router and worker admission regressions for unknown, limited, scheduled, and revoked sources. * fix(protocol): regenerate appended presence method enum * fix(tooling): include presence schema in PR wrapper extraction * test(gateway): drain buffered MCP keepalives on shutdown * test: qualify synthetic approval kind assertion Keep the negative-type assertion from openclaw#159132 explicit in the inventory and bind its allowance to the exact synthetic invalid-input fixture. The existing zero-any and inventory checks remain active, and a changed-input control fails at the fixture qualification. * test(presence): reconcile rebased lookup and inventory fixtures * build(presence): refresh plugin assets after dependency update * test(presence): verify activity reporting retains device attribution


What Problem This Solves
Agents could not directly answer who is online or identify which connected machine produced a person’s latest activity. Raw presence duplicated tabs, and the active-computer prompt hint selected one machine across the whole Gateway.
User Impact
The core
presencetool supportslist,person, anddevicereads on personal and shared Gateways, including compatible remote workers.personacceptsme, a returned ID, or an unambiguous name. Agents can optionally include devices, observed IPs, client time zones, and approximate IP locations; list limits default to 50 and cap at 100.Names are grouped by qualified identity, activity retains its source device, and active-computer hints follow the requesting person. Shared or unidentified machines remain separate. This reads current connected presence; it adds no durable activity history, GPS sampling, storage migration, numeric protocol-version bump, or permission scope.
Why This Change Was Made
The query reuses existing connection, identity, node, and geolocation owners. Main’s
presence.activityreporter feeds the same activity owner: the UI keeps person-wide OpenClaw interaction timing for idle labels, while the agent retains per-connection and source-labelled native device activity. UI and agent reads share identity grouping.Reads preserve the original requester and recheck live authority after asynchronous work. Authenticated readers retain
operator.readaccess; unknown callers cannot inherit synthetic System read access. Worker authority stays on the admitting Gateway’s live owner. Optional location enrichment uses the existing local database with a five-minute cold-lookup budget. Existing rawsystem-presenceclients retain their contract; older workers omit the unsupported tool.Evidence
ab9123e8d373acb1adf299289b695be4b8db2586passed CI on its first attempt: 187 successful jobs, 9 skipped, no failures or cancellations, in 24m53s. Build Artifacts also passed, and exact-head ClawSweeper review reported no code or security findings. The comment-only CLI rebase passed 204 affected tests; the activity integration passed changed-file checks, core/UI typechecks, all core test type graphs, and full protocol checks. Merged asfe609d4ce1a82050b305e660925741793bb70f39.CI repairs and remaining diagnostic limits
The branch repairs missing display metadata, append-only native method ordering, native wrapper extraction inventory, and the MCP heartbeat fixture’s assumption that buffered heartbeats disappear at shutdown. The MCP fixture now drains to EOF within its unchanged deadline; 20 fresh processes passed 100 tests. Main owns the incorporated scheduler, suppression-inventory, database-cleanup, and roster repairs, including #159103, #159163, #159340, #159394, and #159553; duplicate branch work was removed. The approved three-entry lint inventory expansion is already in main.
An earlier macOS
lipoprocess-cleanup failure did not reproduce in its original 553-test selection; no fix was claimed. A separate unchanged SIWC callback-port retry failure did not reproduce in the original 39-file, two-worker selection: 922 passed/1 skipped in 628.96s on Node 24.21. Its original terminal error omitted the message, so the cause remains unproven.The unchanged legacy webhook listener fixture twice hit Linux
EADDRINUSEin different cases. A macOS replay passed, but used Node 24.21 rather than failing Blacksmith’s 24.19. The matching Linux original selection then passed 1,452 tests/5 skipped in 99.74s; five instrumented fresh fixture processes passed all 65 cases and captured only the intentionally occupied port. Node/libuv and cooperative-lock audits established no safe repair. The source, assertions, timeouts, and suppressions remain unchanged; the original failures and non-reproduction remain documented under the best-effort policy. Later hosted runs passed these runtime shards. Linux Testbox evidence, leasetbx_01m3grwkvf0ez2493c9z5bm5bn, is completed/stopped.The later Android
ChatControllerBranchCoordinationTest.rewindInvalidatesAHistoryResponseStartedBeforeTheMutationstalled in its coroutine body for 60 seconds. Controller, test, and dependencies are identical in both CI merge parents; the presence Android delta is only the generated method entry. A configured Blacksmith Testbox source-verified probe could not run the class because the prepared environment lacked CI’s pinned JDK 21.0.12.1, Android platform 37.0, and Robolectric initialization/cache. No Android test ran in that probe; the lease is stopped. Environment-gap evidence. The cause remains unproven; final-head hosted Android CI passed, with no timeout or assertion changes.Platform failures were distinct: one Rust installation failed on runner DNS; a later iPhone simulator reboot was killed before UI tests. iPad built and passed two screenshots, then XCTest timed out after 60s while Xcode acknowledged launch only after 77.7s. The artifact shows OpenClaw subsequently launched and became active, with no crash. No app readiness timeout or product code was changed for these failures. All final-head platform lanes passed.
Catalog discovery (synthetic)
Same Settings → Agents → Tools renderer and viewport, using the actual base and PR catalogs with a synthetic Demo Agent. The mock runtime preview is empty ("Not listed"); these images prove catalog discovery and enabled defaults. Gateway and worker tests prove execution.
Before:
After:
Focused test cost
Measured individually with
pnpm test <file> --maxWorkers=1; these wall times include wrapper/import overhead. Existing larger suites reuse their fixtures, and the cold-lookup regression advances a fake clock instead of sleeping.src/gateway/server-methods/presence.test.tssrc/gateway/server-methods.presence-activity.test.tssrc/gateway/node-registry.presence.test.tsextensions/geolocation/index.test.tsextensions/geolocation/src/lookup-route.test.tssrc/gateway/server/client-presence.test.tssrc/worker/worker-connection.test.tssrc/agents/tools/presence-tool.test.tssrc/gateway/worker-environments/worker-session-tool-executor.test.tssrc/gateway/server-methods-list.test.tssrc/gateway/mcp-http.keepalive.test.tsThe source-authorization file exercises the real router and summary handler, and the worker file exercises real placement and scheduled admission; a pure predicate test cannot prove these boundaries. Existing worker fixtures are reused. The final-head CI completed in 1,493s: 187 successful jobs and 9 skipped. Earlier successful hosted runtime shards took 654s (small-37) and 1009s (large-11), including runner setup.