fix: cron announce response prefix, issue 29600#29687
fix: cron announce response prefix, issue 29600#29687sahilsatralkar wants to merge 3 commits intoopenclaw:mainfrom
Conversation
Greptile SummaryApplied Key changes:
Implementation quality:
Confidence Score: 5/5
Last reviewed commit: f5426fd |
|
Hi @onutc , the CI checks-windows is failing because of likely Feishu integration bug that's unrelated to my PR. Would you be able to take a look ? Happy to help if needed |
…cation, hook bridge Comprehensive cron subsystem reliability overhaul addressing 9 open issues: **Configurable retry policy (openclaw#29527, openclaw#29546)** - Extract backoff logic into `retry-policy.ts` with configurable `cron.retryBackoff` schedule and `cron.stuckRunTimeoutMs` config fields - Classify execution errors as transient (retry with backoff) or terminal (disable job immediately) to prevent futile retry storms - Add Zod validation for new config fields **Fix delivery status reporting (openclaw#29660)** - `resolveDeliveryStatus` now accepts `deliveryAttempted` and returns "not-delivered" when delivery was attempted but not confirmed - Add explicit `delivered: false` to all error paths in delivery-dispatch.ts - Pass `deliveryAttempted` through the full result chain **Configurable response prefix (openclaw#29687)** - Add `responsePrefix` to CronServiceDeps (defaults to "Cron") - Use dep-injected prefix for main session summary messages **Strip directive tags from cron output (openclaw#29646)** - Strip `[[reply_to_current]]`, `[[reply_to:<id>]]`, `[[audio_as_voice]]` from isolated cron run output before delivery **Startup schedule preservation (openclaw#29690)** - Use maintenance-only recompute in `start()` to avoid advancing past-due `nextRunAtMs` values for jobs that `runMissedJobs` intentionally skipped - Clear `nextRunAtMs` for interrupted jobs so they get fresh schedule computation **Internal hook bridge (openclaw#29682)** - Add "cron" to `InternalHookEventType` with `CronExecutionHookEvent` type - Bridge `emitJobFinished` to `triggerInternalHook` so extensions can react to cron job completions (alerting, chaining, etc.) - Add `isCronExecutionEvent` type guard **Per-job skip-if-active flag (openclaw#29659)** - Add `skipIfRunActive?: boolean` to CronJob type for semantic overlap prevention Tests: 290 cron tests + 21 new retry-policy tests pass. Fixes: openclaw#29527, openclaw#29546, openclaw#29601, openclaw#29646, openclaw#29659, openclaw#29660, openclaw#29682, openclaw#29687, openclaw#29690
|
Thanks for the work and tests. Closing this PR for now because the change is not aligned with this hygiene workstream and needs broader delivery-surface validation before merge (all delivery modes/channels and existing prefix behavior). Please reopen as a narrowly scoped follow-up with explicit compatibility coverage if this is still needed. |
Summary
Describe the problem and fix in 2–5 bullets:
Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
Cron jobs with delivery.mode: "announce" will now prepend the configured responsePrefix (e.g., [AgentName]) to the message text, matching interactive reply behavior.
Security Impact (required)
Repro + Verification
Environment
Steps
Expected
Message prefixed with [BotName] (or [AgentName] if auto)
Actual
Before fix: Raw text without prefix
After fix: Text with prefix applied
Evidence
Attach at least one:
Test Results
5 new tests added in src/cron/isolated-agent.delivery-response-prefix.test.ts:
Test Output
✓ src/cron/isolated-agent.delivery-response-prefix.test.ts (5 tests) 40ms
Full test suite: 959 tests passed (274 cron tests)
Human Verification (required)
What you personally verified (not just CI), and how:
Compatibility / Migration
Failure Recovery (if this breaks)
Risks and Mitigations
List only real risks for this PR. Add/remove entries as needed. If none, write
None.NoneBuilt with OpenCode and MiniMax M2.5
Build prompt-
Implementation Plan: Fix Cron Announce Delivery responsePrefix (Issue #29600)
Issue Summary
When
delivery.mode: "announce"sends a cron job's response text to a chat channel, theresponsePrefix(e.g.,[Thames]) is not applied to the message. Interactive replies correctly resolveresponsePrefix: "auto"viaresolveIdentityNamePrefix(), but cron delivery sends raw response text.Baseline Verification
Before starting implementation, establish a test baseline:
pnpm testto establish current test statuspnpm buildpnpm tsgopnpm checkStep-by-Step Implementation Plan
Step 1: Fork and Branch Setup
fix/cron-announce-response-prefixbranch created earliergit statusStep 2: Add Import for resolveResponsePrefix
src/cron/isolated-agent/delivery-dispatch.tsimport { resolveResponsePrefix } from "../../agents/identity.js";pnpm tsgopnpm test src/cron -- --rungit add src/cron/isolated-agent/delivery-dispatch.ts && git commit -m "imports: add resolveResponsePrefix for cron delivery"Step 3: Fix deliverViaDirect Function (Direct Delivery Path)
src/cron/isolated-agent/delivery-dispatch.tsdeliverViaDirectfunction (around line 154), add responsePrefix resolution:pnpm tsgopnpm test src/cron -- --rungit add src/cron/isolated-agent/delivery-dispatch.ts && git commit -m "fix(cron): apply responsePrefix to direct delivery path"Step 4: Fix deliverViaAnnounce Function (Announce Delivery Path)
src/cron/isolated-agent/delivery-dispatch.tsdeliverViaAnnouncefunction (around line 229), add responsePrefix resolution after resolving announceSessionKey:pnpm tsgopnpm test src/cron -- --rungit add src/cron/isolated-agent/delivery-dispatch.ts && git commit -m "fix(cron): apply responsePrefix to announce delivery path"Step 5: Add Test Coverage
src/cron/isolated-agent/delivery-dispatch.response-prefix.test.tsresponsePrefix: "[AgentName]"applies prefixresponsePrefix: "auto"resolves to[AgentName]pnpm test src/cron -- --runpnpm test:coverage -- --run src/crongit add src/cron/isolated-agent/delivery-dispatch.response-prefix.test.ts && git commit -m "test(cron): add responsePrefix coverage for delivery-dispatch"Step 6: Full Verification
pnpm testpnpm buildpnpm tsgopnpm checkStep 7: Push to Remote Fork
git remote add fork [email protected]:<your-fork>/openclaw.gitgit push -u fork fix/cron-announce-response-prefixNotes
resolveResponsePrefix()function fromsrc/agents/identity.tswhich handles:messages.responsePrefixconfiguration (L4)"auto"value which resolves to[AgentName]viaresolveIdentityNamePrefix()responsePrefixis definedsynthesizedTextexistssynthesizedTextdoesn't already start with the prefix (to avoid duplicates)Related Files
src/cron/isolated-agent/delivery-dispatch.tssrc/cron/isolated-agent/delivery-dispatch.response-prefix.test.tssrc/agents/identity.ts(containsresolveResponsePrefix)src/agents/identity.per-channel-prefix.test.ts(example test patterns)GitHub Issue
#29600