Skip to content

feat(target): a beat states the machine's terminal, so a live link stays visible - #19

Merged
zeekay merged 1 commit into
mainfrom
feat/machine-terminal
Nov 27, 2026
Merged

zeekay merged 1 commit into
mainfrom
feat/machine-terminal

Conversation

@jamessburnss1313-dev

Copy link
Copy Markdown
Contributor

Why

A laptop running hanzo link vanished from Hanzo Tabs about an hour after the link started, while its shell was live. The link publishes its terminal on an agent session, and cloud's reaper rightly stops a session with no activity for an hour. The terminal is a fact about the machine, which already beats. hanzo-inc/cloud#1047 adds an optional terminal to the machine row.

What

  • Register.terminal: Option<String>, sent only when set.
  • Beat::terminal(Some(url) | None): every beat states the URL while it is set. Clearing sends "" once, and again on the next beat if that send was lost. A beat that never had one sends no key, so hanzo dev and hanzo shell, which beat the same row, never wipe a link's terminal.
  • A change wakes the beat at once instead of waiting for the next period.
  • Beat::withdraw() clears the terminal and waits up to 5 s for cloud to hear it, because a link ends by dropping its beat.
  • target::sync now takes the Register body, because clippy's argument limit was hit. src/runner/mod.rs and the CLI's link/folders.rs are updated to match.

Rollout

Cloud ignores an unknown field, so this can ship before hanzo-inc/cloud#1047. hanzoai/cli feat/machine-terminal uses it and pins this branch's head until this merges.

Testing

  • cargo test: 387 lib tests plus the integration targets pass. cargo clippy --all-targets -- -D warnings is clean. Both ran in an isolated build folder, with Compiling hanzo-gen seen after the last edit.
  • New tests:
    • a_beat_states_the_terminal_it_was_given and clearing_the_terminal_says_so_once failed with beats forced to state nothing.
    • a_beat_with_no_terminal_sends_no_key passes either way, by design.
    • The withdraw test was written with the code, so it was not seen failing first.
  • Not run against a live cloud.

Known gap

If a link ends within one request round trip of starting, the clear can be missed. The URL then expires with cloud's 90 s liveness window.

How to revert

Revert the two commits.

@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-27T03:36:53.316953Z
We couldn’t complete this review. Comment @codex review to try again.
cb406b1 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@zeekay

zeekay commented Nov 27, 2026

Copy link
Copy Markdown
Member

Rebased onto main (ee07ce5, combining cleanly with #14) at 4c132aff:

  • cargo test --locked: 403 lib + 1 filesize + 3 signals = 407 tests passed (0 failed).
  • cargo clippy --all-targets -- -D warnings: 0 warnings.

@zeekay
zeekay force-pushed the feat/machine-terminal branch from cb406b1 to 4c132af Compare November 27, 2026 03:57
@zeekay
zeekay merged commit c453984 into main Nov 27, 2026
1 check passed
@zeekay
zeekay deleted the feat/machine-terminal branch November 27, 2026 03:57
zeekay pushed a commit to hanzoai/cli that referenced this pull request Nov 27, 2026
The link's machine terminal needs Beat::terminal and Beat::withdraw from
hanzoai/gen#19. Pinned to that PR's head so this builds now; re-pin to the
merged commit when #19 lands.

Testing: cargo test --bin hanzo link:: built against the pinned gen
(Compiling hanzo-gen ...#cb406b1d), 44 passed; cargo clippy --all-targets
-- -D warnings clean.
Risk: low; the pin moves gen forward two commits, both in target.rs.
How to revert: git revert this commit (and the link commit with it).
zeekay added a commit to hanzoai/cli that referenced this pull request Nov 27, 2026
…108)

* feat(link): publish the shell on the machine, not only on a session

Cloud stops a session an hour after its last activity, so a linked
machine vanished from Tabs while its shell was live. The link now states
its url on the machine's own run-target through the heartbeat it already
keeps, and withdraws it, waiting to be heard, when the link ends. The
session row still carries the url for Tabs that predate the machine field.

Depends on hanzo-gen cb406b1 (feat/machine-terminal): Cargo.toml still pins
the old rev, so this commit does not compile in CI until the pin is bumped
to the merged gen commit. `target::sync` now takes a `Register`.

Testing: cargo test --bin hanzo link:: (44 pass) and cargo clippy --all-targets -- -D warnings, both with a local path override of hanzo-gen that is not committed.
Risk: none until the gen pin moves; a cloud without the machine field ignores `terminal`.
How to revert: git revert this commit.

* chore(deps): pin hanzo-gen to the machine-terminal beat (cb406b1)

The link's machine terminal needs Beat::terminal and Beat::withdraw from
hanzoai/gen#19. Pinned to that PR's head so this builds now; re-pin to the
merged commit when #19 lands.

Testing: cargo test --bin hanzo link:: built against the pinned gen
(Compiling hanzo-gen ...#cb406b1d), 44 passed; cargo clippy --all-targets
-- -D warnings clean.
Risk: low; the pin moves gen forward two commits, both in target.rs.
How to revert: git revert this commit (and the link commit with it).

* chore(deps): pin hanzo-gen c453984e and split link modules under 1k LOC

---------

Co-authored-by: Zach Kelling <z@zeekay.io>
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