Repository navigation
Description
Context
brain-ui-cron crontab adds module jobs only when module discovery succeeds at the moment the cron service starts. If discovery returns nothing usable, the crontab silently gets only the core jobs, and stays that way until the next container start:
readModuleListreturnsnullfor a non-zero exit, empty stdout or an unparseable payload, without writing anything to stderr (packages/ui-server/src/bin/brain-ui-cron.ts:160-188).- When the host is not
reconciled, discovery is skipped andmodulesisnull, also silently (brain-ui-cron.ts:223). - Only a thrown error reaches the
module discovery unavailablestderr line (brain-ui-cron.ts:226). emitCrontabthen writes the comment# (brain module list unavailable — module cron skipped)(packages/ui-server/src/cron/emit.ts:175). Nothing retries, nothing appears in Activity, and the job's last failure just stops recurring.
Observed on a hosted 0.44.0 install: after one container start the crontab carried only the core jobs and that comment, and the supervisor's cron error log was empty. Run by hand an hour later as the same uid, through the same maintenance worker, brain-ui-cron crontab emitted the module job correctly. So discovery failed transiently at boot, most likely while app or native readiness was still settling, and a scheduled module job (odysseus-beacon-run in the Odysseus example) stopped running without any signal.
Scope
- Report why discovery yielded nothing: exit code, the stderr tail, or "host not reconciled".
- Retry discovery a bounded number of times before falling back to core jobs only.
- Make "module jobs skipped" visible to the operator, for example a status/Activity entry or a failure notification, not only a crontab comment.
Out of scope
- The module job execution boundary itself.
- Re-running discovery periodically after boot. Note it as an option only.
Acceptance criteria
- A test with a discovery that fails once and then succeeds produces a crontab containing the module job.
- A test with persistent failure writes a stderr line naming the cause, and records an operator-visible "module cron skipped" state.
- The existing byte layout of a successful crontab is unchanged.
Verification
Unit tests over emitCrontab and the crontab subcommand with a stubbed boundary; no live host.
Contract impact
None beyond operator diagnostics.
Activity
schlessera commentedon Nov 2, 2026
Triaged: ready to work. The acceptance criteria, scope and verification are checkable, and no ruling is needed. Set to p1 under the blocker-priority rule, because silently dropping every module job breaks a scheduled nightly job. Milestone 0.45.0.
schlessera commentedon Nov 2, 2026
Claiming (claim token
wi-3381-6fdbc75a). Branch:fix/3381-cron-discovery-retryfromorigin/main@ f8284d6. Collision report for the cited files: closure-only (#3056, #3059, #3069, #3116, #3292, #3293), no direct path collision. Staying out of #3380's scope.