Skip to content

fix(hooks): reuse webhook sessionKey for isolated agent runs - #33175

Closed
sxu75374 wants to merge 5 commits into
openclaw:mainfrom
sxu75374:knuth/fix-29518-webhook-sessionkey
Closed

sxu75374 wants to merge 5 commits into
openclaw:mainfrom
sxu75374:knuth/fix-29518-webhook-sessionkey

Conversation

@sxu75374

@sxu75374 sxu75374 commented Mar 3, 2026 •

Copy link
Copy Markdown

Summary

  • keep isolated cron runs stateless only for empty session keys
  • allow isolated webhook runs (delivery.mode=webhook) to reuse stable session keys
  • add e2e coverage for both webhook reuse and cron stateless behavior

Tests

  • pnpm vitest --config vitest.e2e.config.ts --run test/cron/isolated-agent.webhook-session-key.e2e.test.ts
  • pnpm vitest --run src/cron/isolated-agent.uses-last-non-empty-agent-text-as.test.ts
  • pnpm vitest --run src/gateway/server.hooks.test.ts

Signed-off-by: sxu75374 [email protected]

@greptile-apps

greptile-apps Bot commented Mar 3, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR refines session isolation logic for isolated agent runs: webhook-triggered runs (hook:* keys) can now reuse stable sessions while scheduled cron jobs (cron:* keys) remain stateless. The implementation correctly achieves this via the condition sessionTarget === "isolated" && baseSessionKey.startsWith("cron:") on line 219, and e2e tests verify both paths work as intended.

Confidence Score: 5/5

  • Safe to merge. The core logic correctly isolates cron runs while allowing webhook session reuse, and both behaviors are verified by e2e tests.
  • The PR achieves its stated goals with correct implementation and comprehensive test coverage. No functional issues found in the session isolation logic or test harness. The condition properly distinguishes between cron: (stateless) and hook: (reusable) session keys.
  • No files require special attention

Last reviewed commit: 7728265

Small and others added 5 commits March 4, 2026 10:05
Webhook-triggered isolated runs should preserve session continuity when a stable hook sessionKey is provided. Keep forceNew behavior for scheduled cron keys only.

Signed-off-by: sxu75374 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants