feat(monitor): route explicit process exits#1108
Merged
Merged
Conversation
- what changed: add opt-in process_exit monitor events for armed background exec sessions and route them through monitor.routeEvent - why: explicit waits need durable event wakeups without polling or waking every background completion - behavior/risk: foreground and unarmed background execs stay silent; routing failures are logged and do not break exec completion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Review Fast Path
tsgo,format:check,git diff --check, andcodex review --base origin/mainpass.Summary
monitorExitfor background exec sessions, routesprocess_exitenvelopes throughmonitor.routeEvent, persists process-exit evidence intolastCheckpoint, and replays bounded pending process exits when a matching monitor is created./goalsystem, no broad UX rewrite, no node-host process-exit wiring, no live Telegram/WhatsApp/Gmail listener implementation, and no default wake for unarmed background execs.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
execcan now be explicitly armed withmonitorExit=true; when that armed process exits, Jarvis emits aprocess_exitmonitor event.lastCheckpoint.processExitEvent.Security Impact (required)
NoNoNoYesNomonitorExitis opt-in, background-only, and routes only through existingmonitor.routeEventgateway scope. Routing failures are logged and do not change exec completion semantics.Repro + Verification
Environment
Steps
process_exittrigger for a specific exec session.monitorExit=true.process_exitmonitor event envelope.Expected
Actual
Evidence
Human Verification (required)
npx -y pnpm@10.23.0 vitest run src/monitor/event-router.test.ts src/gateway/server-methods/monitor.test.ts src/agents/bash-tools.test.ts-> 3 files, 71 tests passed.npx -y pnpm@10.23.0 vitest run src/gateway/server-cron.test.ts src/gateway/server.cron.test.ts-> 2 files, 19 tests passed.npx -y pnpm@10.23.0 vitest run src/monitor/event-router.test.ts src/gateway/server.hooks.test.ts src/gateway/server-methods/monitor.test.ts src/agents/tools/monitor-tool.test.ts src/agents/tools/goal-tools.test.ts src/config/sessions/goals.test.ts src/agents/bash-tools.exec.approval-id.test.ts src/agents/bash-tools.exec-runtime.test.ts src/agents/bash-tools.test.ts src/gateway/server-cron.test.ts src/gateway/server.cron.test.ts-> 11 files, 152 tests passed.npx -y pnpm@10.23.0 tsgo-> passed.npx -y pnpm@10.23.0 format:check-> passed.git diff --check-> passed.codex review --base origin/main-> no introduced correctness issues found.monitorExitprocess_exitdoes not wakeprocess_exitbefore monitor creation is buffered and replayedpnpm build/ packaged CLI runtime proofReview Conversations
Compatibility / Migration
YesNoNopendingEventscontinue to load. The new top-levelpendingEventsfield is optional and bounded.Failure Recovery (if this breaks)
src/agents/bash-*,src/gateway/server-methods/monitor.ts,src/gateway/server-cron.ts,src/monitor/*.pendingEventsbeing lost during concurrent cron writes.Risks and Mitigations
process_exitevents are stored in a bounded pending-event backlog and replayed duringmonitor.create.withMonitorStoreWriteLock.AI Assistance