Skip to content

refactor(phase-timing): use one guard and one write path for phase spans - #18837

Open
chubes4 wants to merge 6 commits into
mainfrom
fix/issue-18822-homeboy
Open

chubes4 wants to merge 6 commits into
mainfrom
fix/issue-18822-homeboy

Conversation

@chubes4

@chubes4 chubes4 commented Nov 23, 2026

Copy link
Copy Markdown
Member

Summary

Phase spans had two recording APIs. The buffered PhaseTimer in homeboy-engine-primitives built a report, and a separate core thread-local API had its own PhaseGuard and timing functions that wrote to the ObservationStore. Now the primitives PhaseTimer/PhaseGuard is the only way to record a phase. When a run context is active, it writes each finished span through the core ObservationStore sink, so phase spans for Cook and bench runs still end up in observation output.

What changed

  • Single owner: homeboy_engine_primitives::phase_timing::PhaseTimer and its PhaseGuard. Deploy, lab offload and runner evidence already used it, and it is a dependency-light shared primitive. It now covers both buffered reports and run-bound recording.
  • Deleted duplicates: core observation::phase_timing::{PhaseGuard, guard, finish, time, time_with_outcome}, ObservationStore::{RunPhaseGuard, run_phase_guard, time_run_phase, time_run_phase_with_outcome, finish_run_phase_with_usage}, and the homeboy_core::phase_timing re-export.
  • The core run context lives on in observation::phase_context (for_run, enter, current, inherit). It installs the ObservationStore write path, and inherit still passes the run to worker threads.
  • Behavior change: a guard dropped while its thread is panicking now records failed instead of ok. Each run-bound span gets its own write identity, so repeated samples of the same phase are kept rather than merged.
  • The new core test goes through the public timer and context API. It checks repeated samples, inherited worker context, a panicking guard and the store contents.

Verification

  • 1-verify-466c2f308b48c7661d646fdd068fbecea974c665fe65dbf8ed508f224180ce0b.txt (git diff --check): passed on 9473e17. Base main@2f43cf2 unchanged. 21635 ms; retained gate metadata.
  • repro: none (no repro gate was declared, so these gates do not prove the issue).
  • CI: pending

Cook run
  • Gate 1: tree 23a1da5c45a1093cc45cc0c39ece1ca8eeb934d9

Evidence

Evidence is missing: no measurements, before/after observations or repro results were supplied.

AI disclosure

Tool: Homeboy Cook. Agent: Homeboy (roadie). Model: roadie · route cook-heavy · served gpt-6.1-sol, claude-opus-5-5. Cook time: 25m19s.

The AI migrated every phase-timing caller to the primitives timer, removed the duplicate guard and write paths, and ran focused compile checks and tests, under the direction of the Cook requester. Gates were run by Homeboy. A human reviews before merge.

Closes #18822

This branch has not been deployed

No deployments
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.

Phase timing: one guard and one write path for phase spans

1 participant