← Back to Pull requests

(feat) daemon: stamp the running build's identity into the event log at startup (issue #1486) #1493

Closed
unknown closed this pull request without merging on Sep 05, 2026 17:36 UTC
View on GitHub
unknown unknown commented on Sep 05, 2026 17:13 UTC
Author

What this is

The daemon recorded nothing about itself, so establishing which binary produced a stretch of log
needed out-of-band proofs — two of the three required the process to still be alive. A daemon start
now emits one line, readable from the log alone after the process is gone:

ts=... event=daemon_build version=... exe=... exe_size=... exe_mtime=...

Closes #1486. rides in the commit body (this repo's [override] convention keeps the issue link in
the commit subject; squash_merge_commit_message is COMMIT_MESSAGES, so the commit body is what
reaches main — the PR body does not).

Where to look

| Locus | What is there |
|---|---|
| src/observability.rs — Event::DaemonBuild variant + to_log_line render arm | The event, its four render shapes, and path_value encoding for the exe field |
| src/cli.rs — daemon startup, between EventLog::open and the control-socket bind | The single production call site. Placement is deliberate: before the bind, because "which build failed to bind the socket?" is one of the questions this exists to answer |
| src/daemon/run_loop.rs — emit_best_effort | The third file, and the one to read first. See below |

The third file — read this before the rest

emit_best_effort reported through eprintln!, which panics when stderr is unwritable. The
launchd plist routes stderr to the same volume as the log, so the one failure the fail-open path
exists to survive could have taken the daemon down before the socket bound. It now writes through a
discarded writeln!.

Two things a reviewer should weigh rather than take on trust:

1. That fix has no independent grader. It was both proposed and applied by the same polish pass.
2. emit_best_effort has other call sites across the crate, all of which now get the non-panicking report. The
diff is src/ only, but it is wider than the feature.

Deliberately not done

No build.rs baking a git SHA. The operator builds from a working checkout, so a build.rs
stamps the last commit regardless of uncommitted changes — and "was this the build with my fix in
it?" is exactly the question a bare SHA answers confidently and wrongly. A confident false
attribution is worse than none. Path + size + mtime reproduce the lsof-plus-strings proof from
the log instead. A SHA stays additive to this same event later, and must carry a dirty-tree marker
beside it. (Design docs/design/daemon-diagnostic-integrity-solution-design.md § 4 D-1.)

Recorded residuals — in-band, not papered over

  • AC-5's current_exe() arm is unprovable black-box on macOS: _NSGetExecutablePath never fails, so

  • only metadata() ever does. The rendering is verified; the conjunction is not.
  • AC-4's "every start" is every start that acquires the single-instance lock. A stood-down

  • --managed launch emits nothing — correct by the product's own wording, but it narrows what
    counting these lines measures.
  • exe is not canonicalized. Bounded: the shipped plist path comes from current_binary(), which

  • does canonicalize.
  • One un-timeboxed filesystem call now precedes the socket bind, so an unresponsive volume can wedge

  • the process alive with nothing bound. AC-5 enumerates these calls failing, never hanging.

    Routed to the spec owner — no edit in this PR closes these

  • *PRD R-1 asks for a version and a commit; design D-1 deliberately refuses one. The PRD and the

  • design disagree in the tree as merged. This change is faithful to D-1 and unfaithful to R-1 as
    written.
  • Adopting a %-prefixed unavailability marker (collision-proof by construction) would change the

  • line the design pins.
  • Bounding the pre-bind metadata() call with a timeout — its own design decision, with its own

  • failure mode (a degraded line for a healthy binary).

    Sibling issue

    A flaky usage_store test surfaced during verification and is filed as #1492. It is untouched here:
    usage_store has no lines in this diff.

    CI this diff owes

    src/ only → test, msrv, deny, plus the unfiltered doc-gates, gate-change-ack,
    ci-ok-needs-complete. No apps/menubar/, build/fixtures/ or Formula/
    *, so swift,
    panel-goldens and formula path-skip. No commit trailer is owed.

    ---
    🤖 Generated with Claude Code

    Diff: 544 lines (+408 / -136) across 6 files Reviewer: alexey-pelykh Review duration: 23m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.48) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.48 · 544 lines diff across 6 files
    0.48
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.377
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #1493"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 48% (MEDIUM) · Higher = larger blast radius
    48%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 19.0% · Safe to merge
    19.0%