Skip to content

Spec: record host Suspended time, and keep it out of stage health and Usual ranges #2026

Closed
4 of 4 issues completed

Description

@JacobStephens2

This was generated by AI during triage.

Settled in a grill-with-docs session: docs/grill-with-docs/2026-host-suspension.md (Q1.1–Q2.5).

Problem Statement

A Command whose host goes to sleep keeps its stage clock running. A laptop's clamshell sleep, or a Lima VM paused while its Mac sleeps, shows up as hours of stage time when nothing ran at all.

#1975's implement stage reads about 10 hours, but its Session worked for 29 minutes. The rest was the laptop asleep. That time inflates:

  • the stage time in thirdshift show, the Console's run page, the Stages page and Run metrics;
  • the samples that make up the stage's Usual range;
  • the Slow and Silent checks on a live run once the host wakes.

Nothing records that the host was suspended. Explaining the 10 hours took the macOS power log and a stage-by-stage reading of the Session trace.

Solution

Every Command measures its own Suspended time: time when its host was not running at all. It measures this as wall-clock time running ahead of monotonic time by at least one minute. The Command record keeps the Suspended time per stage, updated while the stage is live, and the Command log gets one line per suspension.

A stage's time stays wall-clock time and is shown with its Suspended time beside it, e.g. "10 h 6 m · 9 h 40 m suspended". A stage with Suspended time is not a sample for its Usual range. Slow and Silent don't count Suspended time. An Experiment or Process eval marks a Trial with Suspended time and leaves its time out of time comparisons.

User Stories

  1. As the Day shift, I want a stage's Suspended time shown next to its time in thirdshift show, so that a 10-hour stage on a laptop explains itself.
  2. As the Day shift, I want the same shown on the Console's run page, so that I don't need the host's power log to understand a long run.
  3. As the Day shift, I want the Stages page to show Suspended time beside a stage time, so that an outlier there explains itself.
  4. As the Day shift, I want one Command log line per suspension, such as "host was suspended 1 h 38 m", so that reading the log tells me the host slept and for how long.
  5. As the Day shift, I want a run that just woke from a suspension not to read Slow because of the hours it was suspended, so that Needs you shows only runs that really are taking longer than usual.
  6. As the Day shift, I want a run that just woke from a suspension not to read Silent because its logs couldn't grow while nothing ran, so that a sleeping host doesn't look like a stuck Session.
  7. As the Day shift, I want a Console read from another host while this one is still suspended not to show a long Silent stretch caused by the suspension once the record has it, so that my fleet view stays calm overnight.
  8. As the Day shift, I want a stage that had Suspended time left out of its repository's Usual range, so that sleepy nights on a laptop don't widen the range used for Slow.
  9. As the Day shift, I want stage times to stay wall-clock times, so that a CI watch the host slept through still shows how long it really waited.
  10. As the Day shift, I want small clock corrections such as NTP steps not recorded as Suspended time, so that only real suspensions appear.
  11. As the Day shift, I want a suspension never to make a Needs you row or Inbox note of its own, so that the Inbox stays a list of things I have to act on.
  12. As the Day shift, I want Passes, Spec runs, Security runs and Ticket runs all to measure Suspended time, so that every Command record tells the same truth.
  13. As an Experiment author, I want a Trial with Suspended time marked, so that I know its time isn't comparable.
  14. As an Experiment author, I want such a Trial's time left out of time comparisons while its outcome and cost still count, so that one laptop nap doesn't skew an arm's timing or cost me a rerun.
  15. As a Process eval author, I want the same rule for Process eval Trials, so that timing comparisons across Processes stay fair.
  16. As the Day shift, I want Command records written before this change read as having no Suspended time, so that old history keeps working unchanged.
  17. As the Day shift on a host that never sleeps, I want nothing to change, so that always-on hosts see no new noise.
  18. As a reader of a Ticket run's dispatched Command, I want each Command to carry its own Suspended time, so that the Pickup run that dispatched it and the dispatched run each say what happened to them.
  19. As a maintainer, I want only the running Command to measure Suspended time, and the Console never to infer it, so that a stalled run is never mistaken for a sleeping host.

Implementation Decisions

  • Measurement. The running Command compares the wall clock with a monotonic clock that stops while the host is suspended. When wall-clock elapsed time has run at least one minute ahead of monotonic elapsed time since the previous reading, the difference is a suspension. Smaller gaps are ignored. The one-minute threshold is fixed, not configurable.
    • Lima vz guest: the monotonic clock stops while the VM is paused, CLOCK_BOOTTIME doesn't count the pause either, and the wall clock is stepped on wake. Confirmed.
    • macOS: Rust's Instant uses a clock that stops in sleep. Expected from the Rust docs; not yet tested on the Mac.
  • Clock seam. The logs module's effects interface (Outside) already supplies the wall clock to the recorder. It gains a monotonic reading next to it, so that recorder tests can script a suspension without sleeping. The real implementation uses Instant.
  • Live sampling. A long Session may not touch the Command record for hours. The Command checks for a suspension at least every 30 seconds while it is live, and the Suspended time reaches the record within about a minute of wake. It is not held back until the next stage transition. The implementer chooses the mechanism; the requirement is that a live stage's record carries its Suspended time soon after wake.
  • Command record schema. Each stage gains an optional Suspended time in seconds. An absent field means zero, so older records parse unchanged. A stage's own time is still the wall-clock gap between its start and the next stage's start, or the Command's end.
  • Command log. One line per suspension, such as "host was suspended 1 h 38 m", written when the suspension is detected.
  • Display. thirdshift show, thirdshift status's stage text where it shows a stage time, the Console's run page and the Stages page show " · suspended" when it is non-zero, and nothing extra otherwise.
  • Usual range. A stage with any recorded Suspended time is not a sample.
  • Slow. A stage is Slow when its age minus its Suspended time passes the top of its Usual range. The step 2 multiple uses the same age. On CI watch this fires late after a suspension, which was accepted (Q2.1).
  • Silent. The quiet time leaves out Suspended time recorded since the logs last grew.
  • Inbox. Suspended time never makes a Needs you row, an Inbox note or a Dismissal target of its own.
  • Experiments and Process evals. A Trial whose Command recorded Suspended time is marked, and its time is left out of time comparisons and summaries. Its outcome, cost and other results still count. Reports say how many Trials were excluded from timing.
  • Scope of measurement. Every Command: Passes, Ticket runs, Spec runs, Fix runs, Security runs, Triage runs, Experiments and Process evals.

Testing Decisions

  • Test external behavior: what the Command record, Command log, show/status text, Console pages and Experiment reports say. Don't test how sampling is scheduled.

  • Recording: script a suspension through the logs effects seam (wall clock jumps, monotonic doesn't). Assert:

    • the stage's Suspended time in the record and the one Command log line;
    • a 30-second NTP-style step is not recorded;
    • a live stage's record gets the Suspended time without a stage transition.

    Prior art: the recorder tests in the logs recording module, which already drive a fake Outside.

  • Reading and health: use fixture Command records carrying Suspended time. Assert that Slow and Silent ignore it, that the Usual range leaves those stages out, and that a record without the field reads as zero. Prior art: the logs reading inventory and metrics tests, and tests/console/watching.rs and tests/console/metrics.rs for the Console.

  • Display: assert the "· N suspended" text in show and on the Console run and Stages pages. Prior art: tests/console.rs and tests/command_logs.rs.

  • Experiments: a fixture Trial with Suspended time is marked and excluded from time comparisons, while its outcome and cost are kept. Prior art: tests/experiments.rs.

  • No test should sleep for real to produce a suspension.

Out of Scope

  • Keeping a host awake: caffeinate, pmset, or Lima settings. That is Day shift host setup.
  • Scheduling around host sleep, such as catching up missed Passes after wake.
  • Making the threshold configurable (Q2.3).
  • Subtracting Suspended time from stage times (Q1.2).
  • Rewriting existing Command records.
  • Session-level timings inside a Harness's own trace.

Further Notes

Sub-issues

Sub-issues

4 of 4 Issues completed
Loading 4 sub-issues

Activity

  1. added
    enhancement
    needs-triage
    in-progress
    and removed
    needs-triage
    on Nov 11, 2026
  2. JacobStephens2 commented on Nov 11, 2026

    @JacobStephens2
    OwnerAuthor

    This was generated by AI during triage.

    Investigation summary

    Confirmed the accounting mechanism on Base branch main at 895f4b7. The supplied issue says design questions are still being settled and a Spec will follow; implementation should wait for those decisions.

    Evidence:

    • src/logs/recording.rs:477 records stage transitions using wall-clock time. Stage currently retains no elapsed-clock or suspension measurement.
    • src/logs/command_record.rs:192 and :328 calculate stage seconds from timestamp differences. Consumers include Run metrics (src/logs/run_metrics.rs:122), Usual ranges (src/logs/usual_range.rs:82), and the Stages/Lanes views (src/logs/status/time.rs:125). Total Run minutes also use wall-clock differences.
    • src/logs/reading.rs:424 computes live stage age from wall time. src/logs/reading/captured_activity.rs computes quiet age from wall time and log modification times. src/logs/reading/health.rs uses these ages for Slow and Silent.

    Confirmation:

    • cargo test --test run_health -- --test-threads=3 passed: 5 passed, 1 fixture entry point ignored. These tests exercise timestamp-based stage ages, quiet ages, health escalation and repository history.
    • A scratch reproduction created three completed version-1 records, each containing one implement stage spanning 10h 6m. Running show widgets#2026 --json returned stage seconds 36360, total minutes 606, and Usual range bounds both 36360. Reproducer: .affected-tests/triage-2026/reproduce.py. This confirms timestamp accounting, not physical suspension.

    The reported Lima pause, maintenance wakes and Session trace were not independently reproduced: their underlying artifacts are unavailable in this worktree. The code supports the reported symptoms, but does not establish their physical cause or validate wall-clock-minus-monotonic as an exact suspension measurement.

    Next step: finish the design round, record the decisions in a Spec, and shape its Tickets through the questionnaire below. No separate matching open issue was found.

    Questionnaire

    For the Day shift shaping #2026: repository investigation confirms wall-clock accounting across stage times, Run metrics, Usual ranges and health. The existing issue says a design round is underway; please reuse its settled answers or link the agreed Spec.

    1. Should stage durations and total Run minutes show elapsed time excluding suspension, wall-clock elapsed time, or both? Specify how Stages/Lanes and Trace timestamps should relate to those durations so their displays remain consistent.
    2. Which environments must suspension detection cover, and what clock-divergence threshold and treatment of forward/backward clock adjustments should apply? Should a detected gap be described as estimated suspension? This determines what the measurements may claim.
    3. After wake, should Slow and Silent exclude only suspension while retaining time already accumulated before sleep, or receive a fresh grace period? Define the expected result for work that was already Slow or Silent before suspension.
    4. How should older Command records without suspension measurements contribute to displayed durations, retained Run metrics and Usual ranges? Choose whether to preserve their wall-clock fallback, identify it as unmeasured, or exclude those samples from the new ranges.
    5. Approve or revise this proposed split: Ticket A records elapsed-clock measurements and detected gaps with deterministic clock tests; Ticket B applies the agreed duration, health and legacy-record policies; Ticket C exposes the suspension explanation consistently in CLI/Console views and updates documentation and consumer tests. B depends on A; C follows the agreed accounting contract. This keeps Spec: record host Suspended time, and keep it out of stage health and Usual ranges #2026 waiting for shaping until the Spec and its blocking links are complete.
  3. added
    ready-for-human
    agent-failed
    and removed
    in-progress
    on Nov 11, 2026
  4. changed the title [-]Stage times and health count time the host was suspended[/-] [+]Spec: record host Suspended time, and keep it out of stage health and Usual ranges[/+] on Nov 11, 2026
  5. JacobStephens2 commented on Nov 11, 2026

    @JacobStephens2
    OwnerAuthor

    This was generated by AI during triage.

    The Triage run's questionnaire is answered by the Spec now in this issue's body, settled in docs/grill-with-docs/2026-host-suspension.md:

    1. Stage times stay wall-clock times, with the Suspended time shown beside them. Nothing subtracts it. (Q1.2)
    2. Every Command measures it, with a fixed threshold of one minute of wall-clock time ahead of monotonic time. A smaller step is not recorded. (Q1.4, Q2.3)
    3. Slow and Silent leave out only the Suspended time; time worked before the suspension still counts. There is no fresh grace period. (Q2.1, Q2.2)
    4. A record without the field reads as having no Suspended time, and stays a normal sample. (Settled by Q1.3)
    5. The split is in Further Notes: measure and record; then the read side, and Experiments/Process evals, each blocked by the first.

    I've taken agent-failed off: the Day shift has taken this over. It stays ready-for-human until its Tickets are published with to-tickets, so that neither Pickup nor a Triage Pass takes it in the meantime.

  6. added
    needs-triage
    and removed
    agent-failed
    ready-for-human
    on Nov 11, 2026
  7. 16 remaining items

  8. added
    ready-for-agent
    and removed
    agent-failed
    on Nov 12, 2026
  9. JacobStephens2 commented on Nov 12, 2026

    @JacobStephens2
    OwnerAuthor

    This was generated by AI during triage.

    Handing back. All four Tickets merged (#2032–#2035). The Spec run then failed when a Fix run on PR #2053 hit a full disk on its host (No space left on device, since cleared). PR #2053 is still a draft and now has conflicts with main. The next Pickup continues it.

  10. added
    in-progress
    agent-failed
    and removed
    ready-for-agent
    in-progress
    on Nov 12, 2026
  11. JacobStephens2 commented on Nov 12, 2026

    @JacobStephens2
    OwnerAuthor

    This comment was generated by AI.

    thirdshift's Run on this issue failed, so it waits for the Day shift.

    • Cause: git worktree add issue-2026 failed: fatal: '' already exists Preparing worktree (checking out 'issue-2026') retaining checkout (expected issue-2026 at c3fbcb0): on refs/heads/issue-2026 at c3fbcb0: path or registration existed before this add: git worktree add issue-2026 failed: fatal: '' already exists Preparing worktree (checking out 'issue-2026') Occupied checkout on refs/heads/issue-2026. Before renaming or deleting its branch, leave or inspect this checkout. Inspect and preserve its work first: git -C -C status --short To free the checkout for a retry, remove it only after preserving its work, then rerun the original thirdshift command from the Launch directory on the Base branch. If the selected Issue branch is on origin, the retry uses the normal Continuation path. Commands use git -C and can run from any directory: git -C worktree remove -- Removal is optional and may refuse while work remains or the Worktree is locked; inspect and preserve it first. No force flags are used.: git worktree add issue-2026 failed: fatal: '' already exists Preparing worktree (checking out 'issue-2026') retaining checkout (expected issue-2026 at c3fbcb0): on refs/heads/issue-2026 at c3fbcb0: path or registration existed before this add: git worktree add issue-2026 failed: fatal: '' already exists Preparing worktree (checking out 'issue-2026')
    • Stopped at: Start, before any work began
    • Preserved: Issue branch issue-2026, if it reached origin
    • Machine: thirdshift

    Put ready-for-agent back to retry.

  12. added
    ready-for-agent
    and removed
    agent-failed
    on Nov 12, 2026
  13. JacobStephens2 commented on Nov 12, 2026

    @JacobStephens2
    OwnerAuthor

    This was generated by AI during triage.

    Handing back again. The last retry on thirdshift.app failed because an old checkout of issue-2026 was still there, stuck mid-merge after the disk-full failure. That merge's conflict resolution is saved on the host, and the checkout has been removed. The next Pickup continues PR #2053 from origin's issue-2026.

  14. added
    in-progress
    and removed
    ready-for-agent
    on Nov 12, 2026
  15. removed
    in-progress
    on Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions