Skip to content

feat(init,doctor): default a unique machine-name on init; doctor reports when it is unset - #886

Merged
getappz merged 2 commits into
masterfrom
task/350-phase-0-of-347-doctor-warns-when-machine
Oct 6, 2026
Merged

getappz merged 2 commits into
masterfrom
task/350-phase-0-of-347-doctor-warns-when-machine

Conversation

@getappz

@getappz getappz commented Oct 6, 2026 •

Copy link
Copy Markdown
Owner

Phase 0 of the cross-instance PR identity design (item #350, part of #347).

[bridge] machine_name names a workstation in beacon:<name> PR labels and footers, but nothing prompted for it, so labels showed raw flared:<hash> ids that humans cannot tell apart.

  • agentflare init: when machine_name is unset, writes <hostname>-<first 6 chars of the instance id> (e.g. host-51bb8d) and says so. Never overwrites an existing name; a second run is a no-op. Not the bare hostname: hostnames collide across machines (this one is literally host), which would give two workstations the same label.
  • agentflare doctor: prints machine-name: <name> or a hint when unset; JSON gains machine_name. Advisory only: it is not part of healthy, so an unset name cannot make doctor exit non-zero.
  • Hostname is lowercased and reduced to [a-z0-9._-] (falls back to machine), so the result always passes the instance-id character check.

Tests: default format (incl. two machines sharing a hostname get different names, sanitisation, result passes validation), ensure-once/never-overwrite. clippy with CI's exact flags is clean; init (37), doctor (4), sessions (11) test modules pass.

Not covered: the other workstation only gets a name when someone runs agentflare init there after updating. The beacon: label is write-only today, so this is readability, not enforcement.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • A machine name is now assigned during initialization when one hasn’t been configured. The name is based on the device hostname and can be changed in configuration.
    • The doctor command now displays the configured machine name, or explains when one is unset and how to configure it. The name is informational and does not affect health results or exit status.

…rts when it is unset (#350)

Agentflare-Agent: claude-code
Agentflare-Branch: task/350-phase-0-of-347-doctor-warns-when-machine
Agentflare-Item: 350
Agentflare-Session: 0b6a7478-1b0c-4629-9b30-7cba0dd0ea41
@coderabbitai

coderabbitai Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⚙️ Run configuration
  • Configuration used: Repository: getappz/agentflare/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: ffd189dc-0de6-4eb4-84ac-1af9494b68bd
📥 Commits

Reviewing files that changed from the base of the PR and between 9e9bef9 and a7e1bb4.

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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: getappz/agentflare/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: dc01f505-f74c-4e07-9b4d-ac07c7104f64
📥 Commits

Reviewing files that changed from the base of the PR and between caec1c4 and 9e9bef9.

📒 Files selected for processing (4)
  • src/doctor.rs
  • src/github/bridge/config.rs
  • src/init.rs
  • src/sessions.rs

Included review availability: This review used your included allowance. 3 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.


📝 Walkthrough

Walkthrough

The code generates and stores a default machine name when none is configured. Initialization reports the assigned name, and doctor output includes the configured name as advisory information.

Changes

Machine Name Setup and Reporting

Layer / File(s) Summary
Generate and persist a default name
src/sessions.rs, src/github/bridge/config.rs
The code uses the OS hostname and stable instance ID to generate a sanitized name. It stores the name only when none is configured, and tests cover generation and preservation of explicit names.
Report the name during initialization
src/init.rs
After component setup, initialization reports the name and configuration command when a name is returned.
Include the name in doctor output
src/doctor.rs
JSON output includes an optional machine name. Text output shows the configured name or explains that it is unset and how to configure it. The name does not affect the health result or exit status.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant Init as init::run
  participant Ensure as ensure_machine_name
  participant Config as Configuration
  participant Hostname as os_hostname
  participant Instance as Stable instance ID
  Init->>Ensure: Request machine name
  Ensure->>Config: Check configured machine name
  Ensure->>Hostname: Read OS hostname
  Ensure->>Instance: Read stable instance ID
  Ensure->>Config: Persist generated name
  Ensure-->>Init: Return name if persistence succeeds
Loading

Merge Risk: 🔵 Low · up to 9e9be

A rare malformed stored ID can make same-host machines share a displayed name, which may confuse attribution; the change remains mergeable with this bounded caveat.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main changes: init assigns a default machine name, and doctor reports whether one is set.
Description check ✅ Passed The description explains the change, its purpose, reported tests, and relevant limitations. It does not use all template headings or report cargo fmt --check, but it is mostly complete.
Docstring Coverage ✅ Passed Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 4 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@getappz

getappz commented Oct 6, 2026

Copy link
Copy Markdown
Owner Author

Tracking this PR for automated review (flared:c997d745ae66).

@getappz
getappz merged commit 1038520 into master Oct 6, 2026
17 checks passed
@getappz
getappz deleted the task/350-phase-0-of-347-doctor-warns-when-machine branch October 6, 2026 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant