Repository navigation
fix(memory-core): suppress startup "cron service unavailable" warning (closes #69939) - #69941
Conversation
Greptile SummaryThis PR fixes a log-noise regression in Confidence Score: 5/5Safe to merge — change is minimal, correctly scoped, and fully covered by new regression tests. No P0 or P1 issues found. The fix accurately models the startup-race cause, the flag lifecycle is preserved correctly (unavailableCronWarningEmitted stays false on startup so the runtime path can still warn), and both the suppression and the genuine-failure paths are exercised by the new tests. Optional-chaining on debug?.() is appropriate for loggers that may not implement debug. No files require special attention. Reviews (1): Last reviewed commit: "fix(memory-core): suppress startup "cron..." | Re-trigger Greptile |
…closes openclaw#69939) memory-core registers a gateway:startup hook that runs reconcileManagedDreamingCron() before deps.cron is attached to the startup event (the startup hook is deferred via a 250ms setTimeout in server.impl). Downgrade the first startup-time "cron service unavailable" warning to a debug log, and rely on the existing runtime reconciliation path to warn if the cron service truly stays unavailable after boot. The managed dreaming cron job itself runs correctly — this was a log-noise regression, not a functional failure. Signed-off-by: Sanjay Santhanam <[email protected]>
3228dcf to
fd281d3
Compare
|
Landed via rebase onto main.
Thanks @Sanjays2402! |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fd281d393b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (params.reason === "startup") { | ||
| api.logger.debug?.( | ||
| "memory-core: cron service not yet available at gateway:startup; deferring to runtime reconciliation.", | ||
| ); |
There was a problem hiding this comment.
Retain cron-unavailable warning when heartbeats are off
The new startup branch always demotes missing-cron to debug and does not set the warning flag, so the only remaining warn path is runtime reconciliation. In this plugin, runtime reconciliation is only reached from before_agent_reply when ctx.trigger === "heartbeat"; if heartbeats are disabled (or no heartbeat run happens after boot), a genuinely unavailable cron service is now silent forever. This regresses the stated “preserve genuine-failure signal” behavior for non-heartbeat environments.
Useful? React with 👍 / 👎.
|
Related work from PRtags group Title: Open PR duplicate: memory-core startup cron warning suppression
|
Closes #69939.
Bug
On every gateway startup,
memory-corelogs:The warning fires once (guarded by
unavailableCronWarningEmitted), but recurs on every cold/warm restart. The managed dreaming cron job itself runs correctly — this is purely a log-noise regression, not a functional failure.Root cause
In
src/plugins/core/server.implthegateway:startupevent is emitted via a deferredsetTimeout(~250ms).deps.cronis not yet attached to the event context when memory-core's startup hook runs, soresolveCronServiceFromStartupSource(startupCronSource)→source.context.cron ?? source.deps?.cronreturnsnullon the first invocation.reconcileManagedDreamingCron()then emits the warning on the startup path, even though the cron service comes up seconds later and the runtime heartbeat reconciliation path successfully attaches the job.Reporter's diagnosis and reproduction steps are in the issue (thanks @mlaihk).
Fix — Option A (minimally invasive)
In
reconcileManagedDreamingCron(), only emit thewarnwhen the function is called from the runtime reconciliation path (before_agent_replyheartbeat). On the startup path withcron == null, demote the message tologger.debugand leave theunavailableCronWarningEmittedflag unset so that if cron genuinely fails to initialize, the next runtime reconciliation still warns.This preserves the existing "cron service is actually missing" signal — we only silence the known startup race.
Before
After
Considered but rejected:
cronServiceSeen): more state for the same observable behavior.deps.cronis attached before emittinggateway:startup): correct fix long-term, but touchesserver.impland the core startup sequencer — out of scope for a log-noise patch. Worth tracking separately.Tests
Added to
extensions/memory-core/src/dreaming.test.ts:does not emit the cron-unavailable warning on gateway:startup when deps.cron is missing (regression #69939)— reproduces the issue: firesgateway:startupwithdeps: {}, assertslogger.warnis never called with"cron service unavailable", and asserts the debug message is logged instead.still warns on runtime reconciliation when cron remains unavailable (preserves #69939 genuine-failure signal)— fires startup with no cron (silent), then aheartbeatbefore_agent_replywith no cron, and asserts the warning does fire — ensuring the genuine reconciliation-failure signal is preserved.Also added
debug: vi.fn()to the existingcreateLogger()test helper to observe the downgraded log.Test run
Full memory-core suite (
test/vitest/vitest.extension-memory.config.ts):Scope
server.impl, the 250ms startup setTimeout, or the cron service itself.