Skip to content

feat(scheduler): wire mission autopush to main bot on completion#46

Open
jsmninvest wants to merge 1 commit into
earlyaidopters:mainfrom
jsmninvest:builder/mission-autopush-wire
Open

feat(scheduler): wire mission autopush to main bot on completion#46
jsmninvest wants to merge 1 commit into
earlyaidopters:mainfrom
jsmninvest:builder/mission-autopush-wire

Conversation

@jsmninvest

Copy link
Copy Markdown

Summary

  • Restores src/mission-autopush.ts + test (lost in rebuild commit 111d22a)
  • Adds autopushed_at column, markMissionAutopushed() CAS, and RetryReason type to db.ts
  • Wires notifyMissionCompletion(mission.id) into all 4 completion paths in scheduler.ts (timeout, acceptance-pass, acceptance-fail, catch-block)

Why

Missions queued by Rudy (created_by='main') were completing silently — Aditya had no visibility unless he polled. This closes the loop by pushing a short Telegram notification to the main bot chat whenever a main-created mission finishes.

Exactly-once delivery is guaranteed by markMissionAutopushed(), which CAS-stamps autopushed_at iff currently NULL. The 4 call sites all go through the same CAS, so even if the completion path is re-entered, Telegram is pinged exactly once.

Test plan

  • npm run build clean
  • npm test -- --run src/mission-autopush.test.ts — 13/13 pass
  • Canary mission 878dee40 (priority 5, ops) completed with autopushed_at=1776884052
  • scheduler.ts grep shows exactly 4 call sites + 1 import

🤖 Generated with Claude Code

@rubening rubening left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review (Overnight Agent, Night #97)

The mission autopush feature itself is solid -- CAS-based exactly-once Telegram delivery, clean autopushed_at column, 13/13 tests passing. Good work.

Issue: The PR carries ~15K lines across 63 files, but the actual autopush feature is only 3-4 files (src/mission-autopush.ts, src/db.ts column, src/scheduler.ts call sites, migration). The rest appears to be branch divergence from when main was rebuilt.

Request: Could you rebase onto current main and squash down to only the autopush-specific changes? That would make this reviewable and mergeable quickly. The feature is good -- the branch just needs cleanup.

Note: PR #47 depends on this, so rebasing here means #47 will need to be rebased on top afterward.

Restores the mission-autopush module (dropped during rebuild in 111d22a)
and wires notifyMissionCompletion into scheduler.ts so every completeMissionTask()
call in runDueMissionTasks also fires the autopush hook.

Why: missions created by Rudy (created_by='main') would complete silently.
Aditya had no visibility unless he polled the CLI. This closes the loop.

Exactly-once delivery is guaranteed by db.markMissionAutopushed(), which CAS-stamps
the autopushed_at column iff currently NULL. 4 call sites added in scheduler.ts
(timeout, acceptance-pass, acceptance-fail, catch-block) — the CAS absorbs any
double-invocation.

Restored from 1906b01:
- src/mission-autopush.ts + src/mission-autopush.test.ts (13 tests, all pass)
- db.ts: markMissionAutopushed, RetryReason, autopushed_at on MissionTask,
  autopushed_at column + idempotent migration

Canary mission 878dee40 (priority 5, ops) completed with autopushed_at set.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jsmninvest jsmninvest force-pushed the builder/mission-autopush-wire branch from a84035d to dda2f75 Compare May 19, 2026 14:18
mm-consult-gautam pushed a commit to morphingmachines/claudeclaw-os-mm-public-claudeclaw-backup-2026-05-25 that referenced this pull request May 25, 2026
* fix(windows): first-class Windows support in setup + Gemini model update

Setup wizard:
- Native Windows acknowledged as fully supported (PM2 for auto-start)
- WSL2 mentioned as neutral alternative, not the recommended path
- Python discovery uses Windows py launcher (py -3.13, etc.) and "python"
- Venv paths use Scripts\python.exe and Scripts\pip.exe on Windows
- Activate instructions show Windows syntax when on win32
- Python install guidance includes python.org, winget, and PATH reminder
- uv detected and used for faster venv creation + pip install when available
- Auto-start uses PM2 as primary option, Task Scheduler as fallback

Gemini:
- Default model updated from gemini-2.0-flash to gemini-2.5-flash
  (2.0-flash returns 404 for new users)
- generateContent and embedText return empty when GOOGLE_API_KEY is
  not set instead of throwing, so memory/consolidation degrade gracefully

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(windows): runtime error messages + npm shell fix

Runtime error messages (index.ts, meet-cli.ts):
- War Room venv-not-found and deps-not-installed messages now detect
  uv and show uv commands first, then Windows paths, then POSIX
- Hardcoded /tmp/warroom-debug.log replaced with tmpDir() and the
  crash-disabled message references the actual resolved log path
- Added "uv detected" log line at War Room startup

Setup (setup.ts):
- All spawnSync('npm', ...) calls now use shell:true so npm.cmd
  resolves correctly on Windows (was causing silent build failures)
- Removed unnecessary shell:true from Python py launcher detection
  (args are already split, fixes Node DEP0190 deprecation warning)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(windows): add windowsHide to all spawn/exec calls

Prevents console popup windows from flashing on Windows when the bot
spawns subprocesses. Every spawn(), spawnSync(), execSync(), and exec()
call that runs a Windows command (taskkill, tasklist, wmic, powershell,
schtasks) or Python subprocess now includes windowsHide: true.

Files: index.ts, meet-cli.ts, dashboard.ts, platform.ts, security.ts,
skill-health.ts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(windows): address PR earlyaidopters#46 review

1. synthesizeBrief now uses os.tmpdir() instead of hardcoded /tmp/,
   so meeting briefs land in %TEMP% on Windows. (Mark item earlyaidopters#1.)

2. setup.ts wires in getVenvPython() and a new getVenvPip() helper
   from platform.ts instead of inline path.join with platform
   conditionals. Single source of truth. (Mark item earlyaidopters#2.)

3. Reverted the Gemini default model from gemini-2.5-flash back to
   gemini-2.0-flash. The 2.5 migration is real (2.0-flash retires
   June 2026; new GCP projects already see 404s) but it isn't a
   Windows fix and changes pricing/rate limits for every existing
   user on next restart. Will land in its own PR with a changelog
   note. (Mark item earlyaidopters#3.)

4. shell: true on the npm spawnSync calls in setup.ts is now gated
   on PLATFORM === 'win32'. The execSync('npm start', ...) call
   dropped its explicit shell option entirely — execSync always
   uses a shell, so the option was redundant. (Mark item earlyaidopters#4.)

5. findProcessesByPattern skips wmic and uses PowerShell's
   Get-CimInstance directly. wmic was removed in Windows 11 22H2+
   and every failed spawn cost ~100ms before the fallback. (Mark
   item earlyaidopters#5.)

6. War Room venv error messages in index.ts and setup.ts now show
   distinct PowerShell vs Command Prompt commands so users know
   which form to paste. (Mark item earlyaidopters#6.)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* refactor(setup): Task Scheduler as primary Windows auto-start, PM2 as fallback

Task Scheduler runs at logon without elevated privileges and has no
extra dependencies. PM2 is still offered as an alternative when already
installed (restart-on-crash, log rotation), but defaults to No.

This also avoids the VBScript deprecation warnings from pm2-windows-startup
on Windows 11, which uses wscript.exe to launch invisible.vbs on boot.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants