Skip to content

feat(register): warn when a run/build appears in flight during defaul…#229

Open
TrevorBasinger wants to merge 3 commits into
mainfrom
tb/register-inflight-warning
Open

feat(register): warn when a run/build appears in flight during defaul…#229
TrevorBasinger wants to merge 3 commits into
mainfrom
tb/register-inflight-warning

Conversation

@TrevorBasinger

Copy link
Copy Markdown
Member

Summary

Bare roar register (no target) defaults to publishing the whole active
session. Job rows are only written to the DB when a job completes
(ExecutionJobRecorder.record()record_job() fires once, after
duration_seconds/exit_code are known), and sessions has no
heartbeat/last-activity column — only created_at. So if terminal A is mid-roar run and terminal B runs a bare roar register in the same repo, the new
defaulted-active-session confirmation prompt (#224) has nothing to look at:
it can only describe the scope of what's about to publish, not whether that
scope is still changing. Terminal B silently publishes a session that
terminal A is still adding to, with zero warning.

There was also no existing signal to repurpose for this: Job.status's
"running" enum value is defined in the schema but never set anywhere in
application code (dead), and no lock/PID/heartbeat file exists for
roar run/roar build — the only PID-liveness pattern in the codebase
(.roar/proxy.json + os.kill(pid, 0)) tracks the S3 proxy daemon, not job
execution.

  • Add .roar/active_runs/<pid>.json markers, written for the exact lifetime
    of RunCoordinator.execute() (active_run_marker() context manager,
    cleaned up on success, tracer error, exception, or signal-abort) and
    self-healed on read via os.kill(pid, 0) — same shape as the existing
    proxy-daemon liveness check, just scoped to run/build processes instead of
    the proxy.
  • confirm_defaulted_active_session_publish() now checks for other live
    markers and prints a line like:
    Warning: a roar run (pid 48213, started 2m14s ago: python train.py) appears to still be in progress — the active session may be incomplete.
    before the existing "Publish the whole active session?" prompt. Best-effort
    and non-blocking — consistent with the rest of this prompt's warn-don't-block
    style.

roar put wasn't touched — it always requires an explicit target, so it
never hits the defaulted-active-session ambiguity this fixes.

…ted publish

Bare `roar register` (no target) defaults to publishing the whole active
session, but job rows are only written when a job completes and Session has
no heartbeat/last-activity field — so the defaulted-active-session prompt had
no way to tell a concurrent `roar run`/`roar build` in another terminal was
still adding to that same session before it published.

Add active-run markers (`.roar/active_runs/<pid>.json`, written for the
lifetime of RunCoordinator.execute() and self-healed via os.kill(pid, 0) on
read) mirroring the existing S3 proxy daemon liveness pattern, and surface a
non-blocking warning line in confirm_defaulted_active_session_publish when
another live run is found. Warn, never block, consistent with the rest of
this prompt.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@TrevorBasinger TrevorBasinger marked this pull request as ready for review July 10, 2026 17:07
TrevorBasinger and others added 2 commits July 10, 2026 17:08
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
`roar status` has the same blind spot register's defaulted-active-session
prompt did: job rows only land in the DB when a job completes, so a
concurrent `roar run`/`roar build` in another terminal is invisible to the
session summary until it finishes.

Move the marker-lookup + warning-formatting helpers from publish_intent.py
into execution/runtime/active_runs.py (in_flight_run_warnings, format_elapsed)
so both `register` and `status` share one implementation instead of
duplicating it, and wire the warning into `roar status` (stderr, unconditional
— a data-freshness risk, not a UX hint).

Co-Authored-By: Claude Sonnet 5 <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.

1 participant