Skip to content

feat(connect,status): cold-start phase telemetry (Windows UX) - #549

Merged
joelteply merged 1 commit into
canaryfrom
feat/cold-start-ux-progress
May 7, 2026
Merged

joelteply merged 1 commit into
canaryfrom
feat/cold-start-ux-progress

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Summary

Codex-spec'd UX follow-up to #545/#546. Without this, Windows Monitor cold-starts produced 30-60s of total silence followed by a flood of host-setup output — indistinguishable from a hang.

Pure observability addition. No control-plane behavior changes. Single-source PATH invariant from #545 preserved.

Helper: _join_phase (in cmd_connect.sh)

  • t0 anchored via $AIRC_WRITE_DIR/.cold_start_t0; survives _reexec_into host (same scope, no env passing required)
  • Output goes to BOTH stdout (Monitor surfaces it as user-facing event) AND $AIRC_WRITE_DIR/airc-transport.log (post-mortem traces show where the time went)
  • _join_phase_done clears the marker once the monitor stream attaches — next airc join against an already-warm scope starts from t0=0 again
  • Stale-marker self-cleanup at top of cmd_connect for crashed-prior-join anchors >10min old

Phase markers added at slow points

Phase Source op
querying gh for mesh on this account (#X) _mesh_find_any (gh gist list)
resolving room gist contents (id) gh api gists/<id>
taking over stale host re-exec to host mode
hosting as NAME — bootstrapping room gist host mode entry
publishing host lease to existing room gist gh gist edit
creating new room gist gh gist create (alt path)
subscribing to #general (sidecar) spawn_general_sidecar_if_wanted
monitor stream attached — cold start complete terminal

cmd_status — distinguish "starting" from "not running"

Pre-fix airc status reported airc process: not running whether airc was genuinely absent OR mid-cold-start. Post-fix:

  • If .cold_start_t0 exists AND age ≤ 600s → starting (airc join cold-start in progress, t+Ns)
  • Stale-marker guard: anchors >10min old treated as orphaned, falls back to not running so user gets the actionable message

Live verification

Smoke run on Windows WSL2 (isolated AIRC_HOME, fresh discovery, stale prior host triggering takeover):

→ [t+0s]  querying gh for mesh on this account (#general)
→ [t+15s] resolving room gist contents (c68640ec...)
→ [t+17s] taking over stale host (re-exec into host mode)
→ [t+21s] hosting as 'win-continuum-8e97' — bootstrapping room gist
→ [t+25s] publishing host lease to existing room gist
→ [t+25s] subscribing to #general (host-mode sidecar)
→ [t+26s] monitor stream attached — cold start complete

airc-transport.log (post-mortem):

2026-05-07T02:56:44Z [t+0s phase] querying gh for mesh on this account (#general)
2026-05-07T02:56:59Z [t+15s phase] resolving room gist contents (c68640ec...)
2026-05-07T02:57:01Z [t+17s phase] taking over stale host (re-exec into host mode)
2026-05-07T02:57:05Z [t+21s phase] hosting as 'win-continuum-8e97' ...
2026-05-07T02:57:09Z [t+25s phase] publishing host lease to existing room gist
2026-05-07T02:57:09Z [t+25s phase] subscribing to #general (host-mode sidecar)
2026-05-07T02:57:10Z [t+26s phase] monitor stream attached — cold start complete

airc status mid-cold-start (prior to the done marker clearing):

airc process: starting (airc join cold-start in progress, t+34s)

Related — Windows Monitor cold-start surface trail

PR Concern
#533 SIGHUP cascade
#538 monitor 404-gone gist
#541 airc.pid+messages.jsonl early-write
#542 airc.cmd direct cmd→bash
#543 dual-clone single-source
#544 airc.cmd args-forwarding
#545 polyglot shim
#546 supervisor self-protect (3-layer)
THIS UX/observability for residual cold-start latency

🤖 Generated with Claude Code

Codex-spec'd UX follow-up to #545/#546: emit "→ [t+Ns] phase…"
lines at the top of slow operations so a user staring at a Monitor
task can tell "still working" from "hung." Without this, Windows
Monitor cold-starts produced 30-60s of total silence followed by
a flood of host-setup output — indistinguishable from a hang.

Helper: `_join_phase` (in cmd_connect.sh)

  - t0 anchored via $AIRC_WRITE_DIR/.cold_start_t0; survives across
    `_reexec_into host` (same scope, no env passing required).
  - Output goes to BOTH stdout (so Monitor surfaces it as a user-
    facing event) AND $AIRC_WRITE_DIR/airc-transport.log (so
    post-mortem traces show where the time went).
  - `_join_phase_done` clears the marker once the monitor stream
    attaches — the next `airc join` against an already-warm scope
    starts from t0=0 again, not "minutes since last boot."

Phase markers added at the slow points:

  - querying gh for mesh on this account (#X)
  - resolving room gist contents (<id>)
  - taking over stale host (re-exec into host mode)
  - hosting as 'NAME' — bootstrapping room gist
  - publishing host lease to existing room gist  /
    creating new room gist on this gh account
  - subscribing to #general (sidecar)
  - monitor stream attached — cold start complete

cmd_status: distinguish "starting" from "not running"

Pre-fix `airc status` reported `airc process: not running` whether
airc was genuinely absent OR mid-cold-start. Post-fix:

  - If `.cold_start_t0` exists AND age <= 600s, status reports
    `starting (airc join cold-start in progress, t+Ns)`.
  - Stale-marker guard: anchors >10min old are treated as orphaned
    (a join crashed without cleanup) and ignored, so the user gets
    the actionable "not running" message instead of a perpetually-
    rising "starting (t+86400s)".
  - cmd_connect entry-point also self-cleans stale anchors so a
    fresh join starts from a clean clock.

Verified locally on Windows WSL2 with isolated AIRC_HOME:

  $ bash test/smoke-coldstart
  → [t+0s]  querying gh for mesh on this account (#general)
  → [t+15s] resolving room gist contents (c68640ec...)
  → [t+17s] taking over stale host (re-exec into host mode)
  → [t+21s] hosting as 'win-continuum-8e97' — bootstrapping room gist
  → [t+25s] publishing host lease to existing room gist
  → [t+25s] subscribing to #general (host-mode sidecar)
  → [t+26s] monitor stream attached — cold start complete

  $ airc status
  airc process: starting (airc join cold-start in progress, t+34s)

  airc-transport.log includes per-phase timing entries for
  post-mortem of slow cold-starts.

Doesn't change any control-plane behavior — pure observability
addition. Single-source PATH invariant from #545 preserved.

Related — Windows Monitor cold-start surface trail:
  #533/#538/#541/#542/#543/#544/#545/#546 — correctness fixes
  THIS — UX/observability for the cold-start latency that remains
         after correctness is solid.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings May 7, 2026 02:59

Copilot AI 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.

Pull request overview

Adds cold-start phase telemetry to airc join/connect and improves airc status messaging so Windows/Monitor users can distinguish “still starting” from “hung/not running” during slow cold-start discovery/handshake periods.

Changes:

  • Introduces _join_phase / _join_phase_done to emit time-anchored phase markers to stdout and to a scope log, including stale-anchor cleanup.
  • Adds phase markers at several known slow points in cmd_connect.
  • Updates cmd_status to report starting (…t+Ns) when a cold-start marker exists and is fresh (≤ 10 minutes).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
lib/airc_bash/cmd_connect.sh Adds cold-start phase telemetry helpers, stale marker cleanup, and phase emissions around slow operations.
lib/airc_bash/cmd_status.sh Adds “starting” status based on the cold-start anchor age when no pidfile exists yet.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +58 to +63
printf ' → [t+%ds] %s\n' "$_elapsed" "$*"
if [ -n "${AIRC_WRITE_DIR:-}" ] && [ -d "$AIRC_WRITE_DIR" ]; then
printf '%s [t+%ds phase] %s\n' \
"$(date -u +%FT%TZ 2>/dev/null || echo "?")" \
"$_elapsed" "$*" \
>> "$AIRC_WRITE_DIR/airc-transport.log" 2>/dev/null || true
@joelteply
joelteply merged commit f2acb4a into canary May 7, 2026
10 checks passed
@joelteply
joelteply deleted the feat/cold-start-ux-progress branch May 7, 2026 03:58
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