Commit Graph

3225 Commits

Author SHA1 Message Date
Peter Steinberger
21a80ced0e test: guard label generator mock calls 2026-05-12 03:56:31 +01:00
Peter Steinberger
6538dc58a3 test: guard sandbox media scp mock call 2026-05-12 03:39:45 +01:00
pashpashpash
85bf8cdf8f fix: add message tool delivery hint to inbound context (#80821) 2026-05-12 10:14:55 +09:00
Peter Steinberger
427372b3f9 test: guard auto reply null helpers 2026-05-11 21:10:16 +01:00
Peter Steinberger
5899db7b1c test: consolidate group runtime reset coverage 2026-05-11 20:51:10 +01:00
Peter Steinberger
63af3bcfdb test: guard remaining truthiness assertions 2026-05-11 20:45:49 +01:00
Peter Steinberger
5b4940e41c test: guard auto-reply helper assertions 2026-05-11 20:19:34 +01:00
Peter Steinberger
5f00135a44 test: guard support helper assertions 2026-05-11 20:16:47 +01:00
samzong
04002e374b fix(auto-reply): precompile directive regexes
Signed-off-by: samzong <samzong.lu@gmail.com>
2026-05-11 18:14:47 +01:00
Peter Steinberger
9f625fe5e1 test: wait for node invoke forwarding by assertion 2026-05-11 18:12:05 +01:00
Shakker
a17277d9b4 test: verify auto-reply payloads 2026-05-11 18:07:29 +01:00
Shakker
27e705f7cd test: check auto-reply diagnostics 2026-05-11 18:02:36 +01:00
Shakker
d9491a8a98 test: check auto-reply missing files 2026-05-11 17:54:19 +01:00
Peter Steinberger
4f7606f2cc fix(gateway): narrow reply session end reason 2026-05-11 17:28:23 +01:00
pandadev66
376c7aea7f fix(gateway): await session_end during shutdown drain and track channel + compaction lifecycle paths (#57790)
Tighten the shutdown finalizer so it actually waits for plugin handlers
under its bounded budget and so it covers every session lifecycle path,
not just the centralized emitters in `session-reset-service.ts`.

- `drainActiveSessionsForShutdown` previously called
  `emitGatewaySessionEndPluginHook`, which fires `runSessionEnd` as
  fire-and-forget (`void hookRunner.runSessionEnd(...)`). The bounded
  2 s timeout then raced only the synchronous for-loop, so the close
  handler could proceed to subsystem teardown while a database-writing
  `session_end` plugin was still in flight -- the exact ghost-session
  failure this PR is supposed to fix. Inline the emit path: build the
  `buildSessionEndHookPayload` + `resolveStableSessionEndTranscript`
  payload directly in the drain and `await hookRunner.runSessionEnd(...)`
  under the bounded race. A never-resolving handler now surfaces as
  `timedOut=true` and the close handler records `session-end-drain` as
  a warning, but is never blocked.
- The channel reply path in `src/auto-reply/reply/session.ts` and the
  compaction lifecycle helper in `src/auto-reply/reply/session-updates.ts`
  emit `session_start` / `session_end` directly through the global hook
  runner without going through `emitGatewaySessionStartPluginHook`, so
  the shutdown tracker never saw normal channel sessions or rolled-over
  compacted sessions. Wire the tracker `note` / `forget` calls into both
  paths so every public lifecycle emitter participates in the same
  tracker, and so a compacted session is both forgotten (previous id)
  and re-noted (new id) on rollover.

Tests:

- `src/gateway/drain-active-sessions-for-shutdown.test.ts` gains two
  cases: one proves the drain genuinely waits for an in-flight handler
  to settle before returning, the other proves a never-resolving handler
  is cut off at the configured budget with `timedOut=true`.

Refs #57790.
2026-05-11 17:28:23 +01:00
leonaIee
503cb8d59f fix(auto-reply): keep silent turn errors visible 2026-05-11 17:26:12 +01:00
Peter Steinberger
1fcb6e6427 test: remove inbound debounce timer flush 2026-05-11 17:05:28 +01:00
Peter Steinberger
16b33fc91e test: tighten auto reply assertions 2026-05-11 15:51:21 +01:00
Peter Steinberger
0693603e5f test: tighten remaining plugin sdk assertions 2026-05-11 15:41:25 +01:00
Shakker
4b6c43af48 test: check media path resolver options 2026-05-11 15:37:51 +01:00
Shakker
cd5018b40e test: check export session arguments 2026-05-11 15:36:41 +01:00
Shakker
99bac079ed test: check models command workspace args 2026-05-11 15:35:50 +01:00
Shakker
8f66462125 test: verify restart sentinel payloads 2026-05-11 15:34:48 +01:00
Shakker
69f4639aac test: check stop target payloads 2026-05-11 15:33:09 +01:00
Shakker
9139ce0652 test: inspect reply dispatch hook inputs 2026-05-11 15:32:00 +01:00
Shakker
e521f56116 test: check directive alias parsing 2026-05-11 15:30:04 +01:00
Shakker
f9c3d683cd test: cover queued followup retargeting 2026-05-11 15:28:54 +01:00
Shakker
ec5a97467c test: cover reply routing decisions 2026-05-11 15:28:05 +01:00
Shakker
3255d2e09d test: check session fork headers 2026-05-11 15:27:15 +01:00
Shakker
754450cbb9 test: verify transcript replay records 2026-05-11 15:26:14 +01:00
Shakker
1f8d29e532 test: pin command registry checks 2026-05-11 14:25:18 +01:00
Feelw00
137d566422 fix(auto-reply): guard FOLLOWUP_QUEUES delete against late drain finally
Regression: the drain IIFE finally (`drain.ts:263-271`) performed an
unconditional `FOLLOWUP_QUEUES.delete(key)` + `clearFollowupDrainCallback(key)`
using only the key, without checking whether the captured `queue` still matched
the map entry. Under the `/stop` + immediate followup sequence, a late-returning
D1 finally could delete the map entry for a fresh Q2 and orphan it until the
next enqueue.

Fix: only remove the map entry and drain callback when `FOLLOWUP_QUEUES.get(key)
=== queue`. Mirrors the identity pattern noted in
`subagent-announce-queue.ts:62-64`.

Adds `src/auto-reply/reply/queue/drain.identity-guard.test.ts` which uses real
`enqueueFollowupRun` / `scheduleFollowupDrain` / `clearSessionQueues` (no
module mocks) and a Deferred gate to park D1 inside `runFollowup`. The test
uses `restartIfIdle=false` on the Q2 enqueue so D1's finally is the only
mutator that can touch the map entry, producing deterministic pre/post-fix
differentiation:
  pre-fix  : get(key) === undefined (Q2 orphaned), depth === 0
  post-fix : get(key) === Q2,                     depth === 1

AI-assisted (fully tested). 1082 auto-reply/reply tests pass, pnpm check +
pnpm build clean.
2026-05-11 14:07:58 +01:00
samzong
1ecd46f49b fix(channels): cache selected channel registry lookups 2026-05-11 13:58:14 +01:00
Ayaan Zaidi
377d7a0b4c fix(telegram): simplify thinking defaults 2026-05-11 18:04:53 +05:30
VACInc
9a47f0fd3d fix: preserve native status thinking precedence 2026-05-11 18:04:53 +05:30
VACInc
d468741c5b test: fix native status alias index mock 2026-05-11 18:04:53 +05:30
VACInc
8192147b90 fix: respect native status thinking overrides 2026-05-11 18:04:53 +05:30
VACInc
6562bac624 fix: show Telegram thinking defaults 2026-05-11 18:04:53 +05:30
Shakker
c2346d1042 test: pin conversation label calls 2026-05-11 13:24:55 +01:00
Shakker
f60a12ccca test: pin fast reply bootstrap checks 2026-05-11 13:23:34 +01:00
Shakker
a62b8c77a4 test: assert followup collect prompts 2026-05-11 12:57:48 +01:00
Shakker
06292d83a5 test: assert get-reply fixture config 2026-05-11 12:24:05 +01:00
Kaspre
7eefb26bc8 fix(heartbeat): remap cron-run exec events to session keys (#80214)
Summary:
- Remap cron-run async exec, ACP, node-event, and watchdog completion events to the queue heartbeat drains.
- Route per-sender cron-run events to the agent main queue and global-scope events to `global` while preserving the originating `agentId`.
- Tighten exec-completion classification and treat cron-run descendants as ephemeral for retention pruning.

Verification:
- CI: https://github.com/openclaw/openclaw/actions/runs/25625964382 passed.
- Real behavior proof: https://github.com/openclaw/openclaw/actions/runs/25666664248/job/75340798016 passed.
- PR targeted validation: `node scripts/run-vitest.mjs run --config test/vitest/vitest.unit.config.ts src/routing/session-key.test.ts src/infra/heartbeat-events-filter.test.ts src/agents/bash-tools.exec-runtime.test.ts src/agents/acp-spawn-parent-stream.test.ts src/cron/session-reaper.test.ts`.
- PR targeted typecheck: `pnpm tsgo:core`.

Refs #52305.
Related: #18237, #14191.

Co-authored-by: Kaspre <kaspre@gmail.com>
2026-05-11 12:13:17 +01:00
Peter Steinberger
3e8ea999ba test: tighten directive parser assertions 2026-05-11 10:46:07 +01:00
Peter Steinberger
bbd3e7da75 test: tighten agent runner utility assertions 2026-05-11 10:44:10 +01:00
Peter Steinberger
3939750648 test: tighten tts command assertions 2026-05-11 10:41:46 +01:00
Peter Steinberger
c880d917cd test: tighten session lifecycle assertions 2026-05-11 10:39:24 +01:00
Peter Steinberger
f28a987442 refactor: centralize reply prompt envelope 2026-05-11 07:56:45 +01:00
Peter Steinberger
6715ee6a2b test: tighten reset hook assertions 2026-05-11 07:52:41 +01:00
Peter Steinberger
94c7882713 test: tighten usage command assertions 2026-05-11 07:50:46 +01:00