Skip to content

fix(target): say when no folder is granted - #14

Merged
zeekay merged 2 commits into
mainfrom
job/folder-notice
Nov 27, 2026
Merged

zeekay merged 2 commits into
mainfrom
job/folder-notice

Conversation

@jamessburnss1313-dev

Copy link
Copy Markdown
Contributor

What a customer saw

A machine was linked and announced itself ready ("present and serving in the fleet … ready for routed runs"; in the CLI, "live runner active … ready for Dev runs"). No folder had been granted, so no run from the web or from a cloud agent could work in the owner's files. Nothing said so; finding hanzo link grant took a day. Root cause (b) of the Carbon District problem log (25 Nov 2026), item 3.2.

Root cause

The beat keeps each answer's granted folders in the Grants watch but never looks at whether there are any.

Fix

The serving beat warns once, from its first answer, when that answer has no folders:

warning: no folder on this machine (<id>) is granted to the web: `hanzo link grant <folder>` grants one

Same sentence as hanzo link folders. One latch local to the beat loop; a first answer with folders, or a later revoke, prints nothing; a beat nobody serves on (hanzo dev) stays silent. No extra requests: target::sync now returns the whole Answer so the id can be named. Run admission is untouched. warn() no longer panics on a closed stderr, so a warning from the beat task cannot end the beat.

A first attempt in the CLI (re-reading the target file and asking the cloud again) was rejected in review: it raced the first heartbeat, delayed the terminal and made a second source for the grants. This uses the list the runner already holds.

Testing

  • cargo test --locked --lib: 380 passed. Three new tests pin: the sentence only when nothing is granted; two empty answers give one notice; a first answer with a folder gives none, also after a revoke.
  • cargo clippy --locked --all-targets -- -D warnings: clean. File-size test passes.

Not tested / known limits

  • Not seen on a real machine: the CLI pins gen at 8807647, so it appears only after the rev bump.
  • The CLI still compiles against the changed target::sync (its one caller, link/folders.rs:106, discards the value), checked by reading, not by building.
  • Under hanzo link with tmux the line can scroll away when tmux takes the terminal. The shell daemon sends stderr to /dev/null, so it never shows there.
  • Merges cleanly with fix(runner): show git's reason on a failed clone or push; no false folder_not_granted after a grant #13 (git merge-tree).

Built by one agent, reviewed by a second. Nothing merged; production is Zach's call.
Risk: low. How to revert: git revert the commit.

@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-25T22:55:58.070167Z
We couldn’t complete this review. Comment @codex review to try again.
3e14832 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 commented Nov 27, 2026

Copy link
Copy Markdown
Member

Useful fix; CI/CD run 45717321221 executed the Rust test gate successfully, but live main 103ffaf is five commits ahead of the branch's merge base 8807647. Please rebase onto current main and rerun the full gate, including grant/revoke propagation and stderr-closed behavior. Automated review also failed due to quota; get a current-head review receipt or equivalent maintainer review. Holding merge under PR_CONVERGENCE.md.

jamessburnss1313-dev and others added 2 commits November 26, 2026 19:27
Symptom: a linked machine printed "ready for routed runs" with no folder
granted, so no run from the web could work in the owner's files, and nothing
said so.

Cause: the beat kept each answer's granted folders in the Grants watch but
never looked at whether there were any.

Fix: the serving beat says so once, from its first answer, as a warning:
no folder on this machine (<id>) is granted to the web: `hanzo link grant
<folder>` grants one. A latch local to the beat loop keeps it to one per
beat loop; a first answer with folders, or a later revoke, prints nothing.
A beat nobody serves on (hanzo dev sessions) stays silent. target::sync now
answers the whole Answer (id and folders) so the id is named. No extra
requests; run admission is untouched.

Testing: new unit tests (pure sentence; two empty answers give one notice;
a first answer with a folder gives none, also after a revoke); lib 380 pass,
clippy -D warnings clean, filesize ok.
Risk: low. Warning goes to stderr; it may be hidden if the terminal is
cleared afterwards (tmux attach).
How to revert: git revert this commit.

warn() no longer panics when stderr is closed, so a warning from the beat
task cannot end the beat (found in review).
@zeekay

zeekay commented Nov 27, 2026

Copy link
Copy Markdown
Member

Rebased onto main (afe1483) at aa754b40:

  • Verified grant/revoke propagation (a_beat_keeps_the_granted_folders), single-notice latch (two_empty_answers_give_one_notice, a_first_answer_with_a_folder_gives_none_now_or_after_a_revoke), and non-panicking closed-stderr warning (warn_does_not_panic_on_a_closed_stream).
  • Isolated bare-repo core.hooksPath in push tests so global git hook configuration cannot shadow test hooks.
  • cargo test --locked: 392 lib + 1 filesize + 3 signals passed (0 failed).
  • cargo clippy --all-targets -- -D warnings: 0 warnings.

@zeekay
zeekay merged commit 7ee41fc into main Nov 27, 2026
1 check passed
@zeekay
zeekay deleted the job/folder-notice branch November 27, 2026 03:31
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