Record wake outcomes and expand Monitor tab history rows - #27
Merged
Merged
Conversation
Deploying opentradeoss with
|
| Latest commit: |
c62b631
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://5e7dabed.opentradeoss.pages.dev |
| Branch Preview URL: | https://feat-wake-history-detail.opentradeoss.pages.dev |
Automage
force-pushed
the
feat/wake-history-detail
branch
8 times, most recently
from
September 14, 2026 21:39
31b194b to
61db890
Compare
Wake history rows are now written when a wake actually starts and settled once when it ends, instead of being written when the timer or monitor fires. The scheduler mints a wake id at fire time and hands the coordinator a PendingWake; the coordinator calls back wakeStarted when the headless child spawns or the live session accepts the wake (channel handoff or codex push ack), and wakeFinished when it settles. The "agent is now running" notification and the schedule_fired event move to the same start moment. A wake the coordinator drops before it runs leaves no row, and an agent archived while its wake sat queued gets no row either. Outcomes: succeeded (headless child exited, or the warm turn's Stop hook fired via a new WakeTransport.onTurnEnded), failed with a reason (resume_fail / spawn_fail / api_error) and the classified failure category, or stopped (user Stop mid-run, or the live session went away before the turn ended). The failure category gains a network value, for connection failures and server errors. Claude Code's StopFailure hook, which fires instead of Stop when a turn ends in an API error, is now registered in the generated agent settings (so existing agents pick it up on their next launch) and handled by the status route: it does the same turn-ended bookkeeping as Stop and settles the outstanding wake as failed with the category mapped from the hook's error value (WakeTransport.onTurnFailed). For a headless run the hook lands before the child exits, so the coordinator holds the failure and an otherwise-clean exit settles failed rather than succeeded. A wake_finished telemetry event, replacing headless_run_finished, is emitted where the row settles, carrying the source, delivery path, outcome, duration, and failure detail for both paths. The feedback form's diagnostics block gains seven-day wake counts: started, failed, stopped, failed on an API error, and the most frequent failure category. Schema v7 adds outcome, finished_at, failure_reason and failure_category to wakes, all nullable; rows from earlier versions read NULL and render as before. Settling is a single guarded update on a running row, so a wake settles at most once, and any row still running at host start is marked stopped, since nothing in flight survives a restart. schedule.forAgent now returns the agent's schedules and monitors with retired rows included (Scheduler.listTriggers), so a history row can resolve its trigger after the trigger is gone; the Monitor tab filters enabled rows for its Active list itself. History rows expand to the fire time, the outcome (with the category as a hint for recognized failures), and the trigger's prompt or command. The row's leading icon reflects the state: a spinner while running, a red alert when failed, an orange alert when stopped. Tests cover the recorded outcomes on the headless, channel and push paths, StopFailure on warm and in-flight headless wakes, the drop-before-start case, the wakeFinished update, listTriggers, wakeStats, the StopFailure error mapping and network classifier patterns, the status route over HTTP, the diagnostics block, and the v7 migration.
Automage
force-pushed
the
feat/wake-history-detail
branch
from
September 14, 2026 21:49
61db890 to
c62b631
Compare
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.
What changed
History records runs, not ticks. A wake's history row is now written by the wake coordinator when the wake actually starts, and settled once when it ends. The scheduler mints the wake id at fire time and hands the coordinator a
PendingWake; the coordinator callswakeStartedwhen the headless child spawns or the live session accepts the wake (channel handoff, or codex push ack), andwakeFinishedwhen it settles. The "agent is now running" notification and theschedule_firedevent move to the same start moment. A wake the coordinator drops before it runs leaves no row, and an agent archived while its wake sat queued gets no row either.Outcomes.
succeeded(headless child exited, or the warm turn's Stop hook fired via a newWakeTransport.onTurnEnded),failedwith a reason (resume_fail/spawn_fail/api_error) plus the classified failure category, orstopped(user Stop mid-run, or the live session went away before the turn ended).StopFailure. Claude Code fires
StopFailureinstead ofStopwhen a turn ends in an API error. It is now registered in the generated agentsettings.json(which the claude harness rewrites before every spawn, so existing agents get it on their next launch) and handled by/hook/status: same turn-ended bookkeeping as Stop, thenWakeTransport.onTurnFailedsettles the outstanding wake asfailedwith the category mapped from the hook'serrorvalue (categoryForStopFailure:billing_error→ billing,rate_limit/overloaded→ rate_limit, the credential states → auth,server_error→ network, everything else → other). The stderr classifier for headless runs also gains anetworkcategory (transport codes, "fetch failed", connection wording, 5xx). For a headless run the hook lands before the child exits, so the coordinator holds the failure and an otherwise-clean exit settlesfailedrather thansucceeded; a fast resume failure takes the hook's category over the stderr guess.Schema v7 adds
outcome,finished_at,failure_reason,failure_categorytowakes, all nullable. Rows from earlier versions read NULL and render as before. Settling is one guardedUPDATE … WHERE outcome = 'running' RETURNING, so a wake settles at most once; any row stillrunningat host start is markedstopped(nothing in flight survives a restart).Monitor tab.
schedule.forAgentnow returns the agent's schedules/monitors with retired rows included (Scheduler.listTriggers), so a history row resolves its trigger after the trigger is gone; the panel filtersenabledfor its Active list itself. The MCP-facinglistCron/listMonitorsare unchanged. History rows keep their "Timer fired" / "Monitor fired" title and Background pill, and expand to the fire time, the outcome (category as a hint for recognized failures), and the trigger's prompt or command. The leading icon reflects state: spinner while running, red alert when failed, orange alert when stopped.Telemetry and feedback. A
wake_finishedevent is emitted where the row settles, with source, path, outcome, duration, and failure detail for both delivery paths. It replacesheadless_run_finished, which only saw a headless child's exit code and read "ok" for a late API-error turn;path = headlessis its successor series, and historical rows stay under the old name. The feedback diagnostics block gains seven-day wake counts: started, failed, stopped, failed on an API error, and the most frequent failure category.Tests
wakeStartedwritesrunningandwakeFinishedsettles the same row;listTriggersincludes retired rows whilelistCron/listMonitorshide them.errormapping and the new network patterns in the stderr classifier (including the duration false-positive guard).wakeStats, the diagnostics block with the new wake fields, the idempotent settle, and the boot sweep of orphanedrunningrows.Gate:
bun test app/src420 pass / 0 fail, typecheck clean, production build clean, biome clean on changed files (a pre-existinguseHookAtTopLevelfalse positive on ause-prefixed method inheadless-strategy.tsis cleared by renaming it).