Skip to content

pm-console: edge says when a machine runs other code than Cloudflare, and for how long (#13833) - #16804

Merged
developing-today-fleet[bot] merged 1 commit into
mainfrom
felix/13833-divergence-warning
Nov 29, 2026
Merged

developing-today-fleet[bot] merged 1 commit into
mainfrom
felix/13833-divergence-warning

Conversation

@developing-today-fleet

@developing-today-fleet developing-today-fleet Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

The remaining slice of #13833's criterion 3: PR #15960 landed the reporting half (each machine's release tree reaches the edge and shows in Machines rows); this lands the comparison half the proto comment named as the follow-on.

What the edge knows now

  • release.mjs stamps the released commit's tree beside VERSION (a TREE var, in both the upload and the full-deploy paths). The tree is read from the release checkout; tests pin it via PM_RELEASE_TREE, mirroring PM_RELEASE_DEPLOYED_AT. A checkout that cannot say (an invented sha, no git) stamps nothing.
  • The Worker hands env.TREE to the edge as ownTree (validated as a full tree OID, like a reported tree).

The comparison

  • On every machine report, the edge compares the reported tree with its own and keeps when the difference began — in the host record for the first machine, in the mhost:<kid> record for enrolled machines — read back on restart, so the saying survives the edge's own restarts. A change to another differing tree does not restart the clock; a report of the Worker's own tree clears it.
  • The Machines answer carries treeDivergedFor (ms) only once the difference has lasted five minutes (TREE_DIVERGED_MS — long enough that a machine mid-update, which follows within a minute or two, is never named). The Machines screen adds the sentence "It has run other code than Cloudflare for N min." beside the existing commit saying, and the screen's redraw mark tracks the duration by the minute.
  • While either tree is unknown — an unstamped deploy, an older host — nothing is compared and nothing is said: exactly today's behavior.

Tests (oracle: #13833, "the Machines screen says when a machine has run other code than Cloudflare for longer than a few minutes")

  • edge.test.ts: a diverged machine is unsaid at 0 and 4 minutes, said at 6 with the full duration, kept across an edge restart, and cleared when the machine comes onto the Worker's tree; a matched tree and an unstamped Worker are never said to diverge.
  • machines-multi.test.ts: the saying is per machine — an enrolled machine is named with its duration; the first machine (no tree reported) is not.
  • app.test.ts: the screen's sentences, alone and joined with the commit saying.
  • release.test.ts: a pinned tree is stamped in the upload vars; unpinned runs stamp nothing (all existing argv expectations unchanged).

Verification: remote fleet-command run at the PR head (bun test for the console suite) — link in the progress note on #13833. No feature flag: the saying is additive and silent until a deploy stamps TREE and a machine actually diverges.

Refs #13833 (criterion 3's comparison half; the issue stays open for its live half — the laptop's console following main in service, which is in service already per the 2026-11-24 record — and the criterion-2 loud-skip remainder tracked by #14080).

{
  "direct_parent": null,
  "links": [],
  "lineage": {
    "design": null,
    "roadmap_item": null,
    "priority": null
  },
  "pm_meta": 1,
  "provenance": {
    "queue_id": null,
    "scheduled_start": null,
    "picked_up_at": null,
    "work_started_at": null,
    "created_at": "2026-11-29T13:39:48Z",
    "session_id": null,
    "lane": null,
    "host": "htch-runtime",
    "worktree": "/home/hatch",
    "model": null,
    "lane_start_issues": [],
    "workspace_ref": {
      "kind": "worktree",
      "id": "/home/hatch",
      "repo": "developing-today/code",
      "branch": "main",
      "sha": "ac3f377b7f752f50918f491d7443b79e95b5dc34"
    },
    "auth_subject": "felix",
    "stamped_by": "fleet 0.1.0 (native)"
  }
}

Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…flare, and for how long (#13833)

The edge now knows its own console tree: release.mjs stamps the
released commit's tree beside VERSION (TREE var, pinned in tests via
PM_RELEASE_TREE, read from the checkout otherwise, unstamped when a
checkout cannot say). The Worker hands it to the edge as ownTree.

On each machine report the edge compares the reported tree with its
own and keeps when the difference began (host record for the first
machine, mhost record for enrolled ones, read back on restart). The
Machines answer carries treeDivergedFor once the difference has
lasted five minutes (TREE_DIVERGED_MS); the Machines screen says
'It has run other code than Cloudflare for N min.' beside the
existing commit saying, and redraws by the minute while it lasts.

Nothing is said while either tree is unknown — an unstamped deploy
or an older host behaves exactly as before.

Tests (oracle: #13833's 'the Machines screen says when a machine
has run other code than Cloudflare for longer than a few minutes'):
edge.test.ts — diverged machine unsaid at 0 and 4 minutes, said at
6, kept across restarts, cleared when the machine comes onto the
Worker's tree; matched tree and unstamped Worker never said.
machines-multi.test.ts — the saying is per machine for an enrolled
machine. app.test.ts — the screen's sentences. release.test.ts —
a pinned tree is stamped in the upload vars.
@coderabbitai

coderabbitai Bot commented Nov 29, 2026

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c7490978-b0ab-4cc9-b74b-6436798171a3

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@developing-today-fleet
developing-today-fleet Bot merged commit 0fc743b into main Nov 29, 2026
2 checks passed
@developing-today-fleet
developing-today-fleet Bot deleted the felix/13833-divergence-warning branch November 29, 2026 13:47
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.

0 participants