Commit Graph

27874 Commits

Author SHA1 Message Date
Kaspre
072fa9b174 fix(wake): handle relative + agent-prefixed session keys consistently in cron adapter
Address review findings from successive codex rounds:

1. next-heartbeat + sessionKey now fires a targeted immediate wake.
   The regularly-scheduled heartbeat fires for the agent's main session,
   not the supplied sessionKey, so an event queued for a non-main session
   would sit stranded indefinitely; an "event"-intent wake is also
   deferred as not-due by the heartbeat runner and not retried, so
   neither path delivers without an explicit immediate wake.

2. resolveCronWakeTarget now always runs through resolveCronAgent, both
   for agent-prefixed session keys (so non-default agents are honored)
   and relative keys (so the configured default agent is used instead
   of the hardcoded "main" returned by resolveAgentIdFromSessionKey).
   Mirrors the matching fix in the enqueueSystemEvent adapter so wake
   and enqueue resolve to the same target.

3. Generated Swift `WakeParams` models now expose the new optional
   `sessionkey` field (codingKey "sessionKey") in both the macOS and
   shared OpenClawKit copies. Locally regenerated from agent.ts via
   protocol:gen + protocol:gen:swift would have produced this; the
   environment couldn't run the generators (fs-safe transitive
   typecheck errors), so the diff was applied by hand to match what
   pnpm protocol:check would output.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-11 17:24:30 +01:00
Kaspre
4ddd942f5f feat(wake): expose typed sessionKey on wake protocol + system event CLI
Adds an optional sessionKey to the WakeParamsSchema and threads it through
the gateway wake handler, CronService.wake(), and the underlying timer.wake()
ops so callers can target a specific session for async-task completion
relays instead of always hitting the agent's main session.

Also adds --session-key to `openclaw system event`.

The schema rejects empty/non-string sessionKey at the gateway boundary;
mismatched session keys (a key that does not belong to the resolving agent)
fall back to the agent's main session inside resolveCronSessionKey, which
is the existing safety path.

Refs #52305 (companion to PR #50818, which closes the related cron-run
remap slice at internal enqueue sites). Doesn't depend on #50818.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-11 17:24:30 +01:00
Shakker
13bc7037b1 test: verify infra generated values 2026-05-11 17:23:49 +01:00
Peter Steinberger
f57afbbd16 test: remove agent async timer flushes 2026-05-11 17:21:53 +01:00
Shakker
ac478b2c6a test: verify diagnostics and session callbacks 2026-05-11 17:21:03 +01:00
Peter Steinberger
1f43e79a58 test: remove plugin contract timer flushes 2026-05-11 17:19:44 +01:00
Shakker
d4f3d4edad test: verify schema and timing messages 2026-05-11 17:18:19 +01:00
Shakker
8f79e34cbe test: verify install and runtime messages 2026-05-11 17:16:25 +01:00
Shakker
a63267eb6a test: verify generated core values 2026-05-11 17:07:48 +01:00
Peter Steinberger
6e7943f5bb refactor: share channel route target collection 2026-05-11 17:07:18 +01:00
Peter Steinberger
baba186717 test: wait for session history revocation 2026-05-11 17:07:09 +01:00
Peter Steinberger
d381879dd7 test: route extension ansi helpers through sdk 2026-05-11 17:06:47 +01:00
Peter Steinberger
19b78380f5 test: assert CLI lastCallUsage persists to session store 2026-05-11 17:06:47 +01:00
Neerav Makwana
af2897e29b fix: persist CLI lastCallUsage for session context totals (#78194)
- Session store: derive totalTokens for CLI providers from agentMeta.lastCallUsage
  when present (avoids cumulative usage; matches persistSessionUsageUpdate).
- Claude CLI runner: populate lastCallUsage from the final attempt usage blob.
- Add regression test for claude-cli lastCallUsage snapshot.

Fixes #78194.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-11 17:06:47 +01:00
Peter Steinberger
1fcb6e6427 test: remove inbound debounce timer flush 2026-05-11 17:05:28 +01:00
Peter Steinberger
0218afd8e3 test: wait for run-node spawn 2026-05-11 17:04:04 +01:00
Chinar Amrutkar
f2c15f94ae fix(channels): narrow bundled channel loader diagnostics
Narrow bundled channel wrong-loader diagnostics, preserve ordinary missing-register debug details, and add focused loader coverage.

Verification:
- pnpm test src/plugins/loader.test.ts src/plugins/loader.cli-metadata.test.ts -- --reporter=verbose
- env -u OPENCLAW_TESTBOX -u OPENCLAW_TESTBOX_REMOTE_RUN pnpm check:changed

CI notes:
- Real behavior proof passed with maintainer proof: override label.
- check-additional-boundaries-d is red from existing extension test imports outside this PR: extensions/telegram/src/bot.create-telegram-bot.test.ts and extensions/whatsapp/src/login.coverage.test.ts.

Co-authored-by: Chinar Amrutkar <chinar.amrutkar@gmail.com>
2026-05-11 16:58:06 +01:00
Peter Steinberger
c9c9c3f7f1 fix: surface plugin beta fallback outcomes 2026-05-11 16:57:27 +01:00
Peter Steinberger
63ba3cd63d fix(doctor): match route channel coverage to runtime 2026-05-11 16:53:05 +01:00
stainlu
d9862141c1 fix(doctor): keep message-tool warning deterministic 2026-05-11 16:53:05 +01:00
stainlu
f79b8468ac fix(doctor): respect default-account route coverage 2026-05-11 16:53:05 +01:00
stainlu
4ce4a951a1 fix(doctor): normalize channel route coverage 2026-05-11 16:53:05 +01:00
stainlu
0923e9e9d9 fix(doctor): honor account route coverage 2026-05-11 16:53:05 +01:00
stainlu
7382bdfaf8 fix(doctor): respect route account coverage 2026-05-11 16:53:05 +01:00
stainlu
aecebd3347 fix(doctor): warn for scoped channel fallbacks 2026-05-11 16:53:05 +01:00
stainlu
60acfd9dfe fix(doctor): include fallback channel warnings 2026-05-11 16:53:05 +01:00
stainlu
1831162ac1 fix(doctor): warn routed agents missing message tool 2026-05-11 16:53:05 +01:00
Peter Steinberger
5dc7a05f7f test: remove acp approval retry timer flush 2026-05-11 16:52:02 +01:00
Peter Steinberger
d4b2560d3c test: remove mcp shutdown timer flush 2026-05-11 16:50:20 +01:00
Peter Steinberger
accf0ff335 test: remove keyed queue timer flush 2026-05-11 16:48:31 +01:00
Peter Steinberger
49fa943eca test: remove hook queue timer flush 2026-05-11 16:45:58 +01:00
Peter Steinberger
f707f3a5bb test: fix main check failures 2026-05-11 16:41:46 +01:00
Val Alexander
6b3cd9043e fix(control-ui): keep channel statuses responsive
Summary:
- Keep Channels responsive by opening on cached/runtime snapshots, bounding live probes, and preventing stale slow probe results from replacing newer snapshots.
- Reduce Control UI churn by scoping Nodes polling to the active Nodes tab, debouncing sessions.changed reconciliation, and bounding secondary chat/session refreshes.
- Scope config schema analysis before section-limited renders so excluded root sections are not fully analyzed.

Verification:
- pnpm test ui/src/ui/app-channels.test.ts ui/src/ui/controllers/channels.test.ts ui/src/ui/app-settings.refresh-active-tab.node.test.ts ui/src/ui/app-gateway.sessions.node.test.ts ui/src/ui/app-lifecycle-connect.node.test.ts ui/src/ui/controllers/sessions.test.ts ui/src/ui/views/config.browser.test.ts src/gateway/server-methods/channels.status.test.ts src/gateway/control-ui.http.test.ts ui/src/ui/app-polling.node.test.ts ui/src/ui/app-gateway-chat-load.node.test.ts ui/src/ui/app-gateway.node.test.ts ui/src/ui/app-chat.test.ts ui/src/ui/app-render.helpers.node.test.ts ui/src/ui/app-lifecycle.node.test.ts
- pnpm exec oxfmt --check --threads=1 <changed files>
- git diff --check origin/main...HEAD
- node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.core.json <changed TypeScript files>
- pnpm changed:lanes --json

Note: local pnpm check:changed reached core lint and failed on src/gateway/server-methods/nodes.invoke-wake.test.ts, which is unchanged in this PR and already present on current origin/main; changed-file lint passed under the same repo wrapper.
2026-05-11 10:37:35 -05:00
Peter Steinberger
7e57b69e6e test: finish broad matcher cleanup 2026-05-11 16:30:29 +01:00
Shakker
46a0d3ba85 test: check node wake dynamic values 2026-05-11 16:28:50 +01:00
Shakker
08acf80891 test: check daemon install messages 2026-05-11 16:26:36 +01:00
Shakker
b11bdabfa2 test: check doctor plugin warnings 2026-05-11 16:25:36 +01:00
Shakker
6923cf348a test: check doctor allowlist warnings 2026-05-11 16:24:16 +01:00
Shakker
99ae349ad2 test: check gateway discovery logs 2026-05-11 16:23:09 +01:00
Shakker
6a1f53316f test: check tailscale preserve logs 2026-05-11 16:22:18 +01:00
Peter Steinberger
e8785972d0 test: tighten agent auth assertions 2026-05-11 16:21:43 +01:00
Shakker
07805cc75b test: check session memory filenames 2026-05-11 16:21:22 +01:00
Shakker
4630076381 test: check cron timer handles 2026-05-11 16:19:50 +01:00
Shakker
3ce0b9769e test: check cleanup backup prompts 2026-05-11 16:18:56 +01:00
Shakker
948e87939f test: check sandbox command messages 2026-05-11 16:18:12 +01:00
Peter Steinberger
9340105bb5 fix(agents): preserve media tools for alsoAllow policies 2026-05-11 16:17:39 +01:00
Shakker
70935a110c test: check gateway stage error logs 2026-05-11 16:17:18 +01:00
Neerav Makwana
5171c2654a fix(models/auth): preserve primary when login omits --set-default
Provider applyConfig patches merged during models auth login could replace
agents.defaults.model.primary even without --set-default. Snapshot the prior
defaults.model and restore it after the patch unless the user opts in.

Fixes #78162.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-11 16:16:49 +01:00
Peter Steinberger
eb34d09232 test: tighten agent assertions 2026-05-11 16:16:36 +01:00
Shakker
1067abc665 test: check device identity pem blocks 2026-05-11 16:16:20 +01:00