Repository navigation
π agent(bob): preflight probes the per-agent ~/.bob that bob actually writes to - #17097
Conversation
β¦ writes to Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of No conflicting open PRs or same-file overlaps were found. |
|
Hive status β updated in place; edits do not notify. Full history is in the Activity Monitor. hive/awaiting-ci: pushed f281a2a moving bobStateHome into bob_settings.go so manager.go stays at its crux-file-size-ratchet baseline. The remaining red check (relative links and anchors resolve: CHANGELOG.md π Hive Agent: β hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 Review findings from Correctness β delta re-review at f281a2a (delta: Prior finding still present: Fix: when Style finding (manager.go file-size ratchet): fixed by the move. Review findings from Security perspective β approve (advisory only) Read at head 18b3d87. The probe stays read-only (stat + mode/uid logging, no writes, no new privileges), One low, non-blocking note: the remedy strings now attached to per-agent paths are still the shared-home ones β Review findings from Correctness review @ 18b3d87 New first-launch false positive (in-scope). Suggested fix: in Minor (advisory): the remedies at bob_settings.go:181 / 207 still say Hive filed review findings that do not block this PR as backlog items:
Cap: 10 backlog item(s) per PR per day. Evidence bundle `#17097d1d5782` sha256:e2ab9ce401c33d8f1c34adf2dcfb443365d3c8ff66c86d1c14216d50d8d9352c β download from the dashboard or `hivectl review evidence #17097`. |
There was a problem hiding this comment.
The logic is correct; the red crux-file-size-ratchet check is this PR's own doing and has a one-move fix.
Correctness β looks right to me. bobStateHome resolves via AgentHome (src/crux/agent/authprobe.go:31-44), which is exactly what the launch path exports as HOME, and .bob is a real per-agent directory with only settings.json / settings/ bridged back to /data/home/.bob (src/crux/agent/interactive_home.go:58-73, :121). So the probe at manager.go:1657 now stats the directory bob actually mkdirs installation_id and tmp/ into, rather than the shared one. The v2 settings/ probe follows the bridge symlink to the shared copy, which is also where bob writes it β fine. ensureBobAuthSettings correctly stays on bobSharedHome. The new test pins both the resolution and the unwritable-report path.
Finding β crux-file-size-ratchet fails (medium, blocks merge). src/crux/agent/manager.go on v5 is 1658 lines, which is exactly its baseline in crux's .github/go-file-size-ratchet.txt:18 (pinned at 13372ca7 by .github/workflows/crux-file-size-ratchet.yml:37). This PR adds the 7-line bobStateHome helper (manager.go:1659-1665), so the gate reports agent/manager.go has 1665 lines, over its ratchet baseline of 1658 β I reproduced that locally with the pinned script.
Fix: move bobStateHome into src/crux/agent/bob_settings.go (441 lines, no ratchet entry, limit 800) next to verifyBobStateDirsWritable, or just call AgentHome(agent.Name, agent.UID, backend) directly at manager.go:1657. Either keeps manager.go at 1658 and the check goes green.
The other red check, relative links and anchors resolve, is the v5 baseline failure that #17096 fixes (CHANGELOG.md literal [open](url)), not this PR.
β hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
Move bobStateHome into bob_settings.go beside the other bob helpers so crux-file-size-ratchet stays green. Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Conclusion: switching the probe to the per-agent home is the right direction, but as written it will log a false bob state dir is not writable by the agent UID ERROR on every healthy per-agent bob home, and the diff itself trips crux-file-size-ratchet. Flagging for the fixer; nothing here is blocking a launch.
1. verifyBobStateDirsWritable checks group bits, but the per-agent ~/.bob is 0700 owned by the agent UID (medium)
src/crux/agent/interactive_home.go:419creates$HOME/.bobwithinteractiveHomeDirMode(=0o700, line 226) andownAgentDir(interactive_home.go:582-596)Chowns it to the agent UID and re-applies0700. The per-agent HOME itself is provisioned the same way (interactive_home.go:268,:704-719).src/crux/agent/bob_settings.go:200decides writability withmode&bobStateGroupWriteBit == 0 || mode&bobKeyGroupExecBit == 0β the comment at:196-198says why: the probe was written for dev-owned dirs reached via groupnode. It never looks at the owner.- So with this PR, on any hive where chown succeeds (the isolated layout the comment at
interactive_home.go:221-224calls "the point"),bobStateHome(...)/.bobisdrwx------ <agent-uid>β the probe logs the ERROR atbob_settings.go:201with remedychmod 770 β¦ group-owned by node, which is wrong advice for an agent-owned dir. If the preflight runs before the home is provisioned, the parent branch atbob_settings.go:170-181hits the same false positive against the 0700 per-agent HOME. Only the unprivileged fallback (0o777,interactive_home.go:227) passes. - Consequence: the diagnostic #17062 wants to make accurate becomes a permanent red herring in
kubectl logsfor every bob agent.
Suggested fix: in verifyBobStateDirsWritable, treat a dir whose Stat_t.Uid == uid as writable when the owner w+x bits are set, and keep the group check for dev-owned dirs. The new test (bob_settings_test.go:677-713) would not catch this β it uses 0555, which is unwritable for everyone; a case with 0700 owned by the test's own uid and uid = os.Getuid() expecting no finding is the one that fails today.
2. crux-file-size-ratchet is red because of this diff
src/crux/agent/manager.go goes 1658 β 1665 lines, over its pinned baseline (run 42410538470: "agent/manager.go has 1665 lines, over its ratchet baseline of 1658"). Moving bobStateHome into bob_settings.go next to verifyBobStateDirsWritable clears it.
The other red check, relative links and anchors resolve, is the v5 baseline failure (CHANGELOG.md:224 [open](url) inside inline code) that #17096 fixes; not this PR's fault.
The ensureBobAuthSettings(agent.Name, bobSharedHome) call left on the shared home is correct β the per-agent .bob/settings.json and .bob/settings are symlink bridges into /data/home/.bob (interactive_home.go:138-139).
β hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1
|
Shared CI incident β not this PR's diff. The red π Hive Agent: β hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
|
βΈοΈ CI is red on the base branch (relative links and anchors resolve); holding until it recovers β this is not a failure in this PR, so no fix attempt is counted and no one needs to act here. Tracked on the shared-CI incident #17098. |
|
The hive's GitHub App lacks |
|
Needs a decision, not a merge: Clear the cause and the hive re-evaluates on its next pass; the stage moves to |
β¦ probe The per-agent ~/.bob is created by bob itself as the agent UID (mkdirSync 0755/0700) and no permissions-watcher root widens it, so testing it for group w+x flagged it as unwritable on every launch after first run. When the stat Uid matches the agent uid, consult the owner bits instead; otherwise keep the group test for dev-owned dirs. Applies to both the existing-dir and nearest-existing-parent branches. Hive-Fix-Attempt: 1/6 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Read src/crux/agent/bob_settings.go and manager.go at 18b3d87 against the tree. The probe now stats the directory bob actually writes: bobPreflightUnlocked (manager.go:1657) passes bobStateHome(name, uid, backend), which is AgentHome(...) β the same resolver manager_env.go:486 uses to set the agent's HOME, so the probed $HOME/.bob is the one bob's mkdirSync creates. ensureBobAuthSettings still receives bobSharedHome (manager.go:1655), as the body says.
bobStateDirWritableBy (bob_settings.go:229-235) is the right discriminator for the ownership shapes involved: when Stat_t.Uid == uid the owner w+x bits decide, otherwise group w+x as before. The uid <= 0 early return at the top of verifyBobStateDirsWritable means the owner branch is never reached with a sentinel uid. syscall.Stat_t is already used unconditionally elsewhere in this package (manager_homes.go, permissions_entry.go), so no new platform assumption.
Both probe sites (existing dir at :206, missing-dir parent at :180) switched to the helper; tests added for the per-agent resolution and the agent-owned 0700 case. Package builds on this head. Looks correct to me.
β hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
bobPreflightUnlocked runs before launchInTmux, and the per-agent home is only created by setupInteractiveHome inside the launch, so on a new per-UID bob agent's first launch the home does not exist. The ancestor walk then landed on /data/home/agents (deliberately 0755 dev-owned) and logged two bogus 'chmod 2775 /data/home/agents' errors. Skip the two $HOME/.bob probes when the home is absent; the workspace dir is still probed. Also make the logged remedy ownership-aware: an agent-owned ~/.bob that fails the owner-bit check now gets 'chmod u+rwx <dir>' instead of advice to widen group access, which would undo per-agent isolation. Hive-Fix-Attempt: 2/6 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
d1d5782
βΉοΈ Sentinel notice β informational; author is trusted (hive agent), merge is not blockedHive flagged this PR (author @hivecommons-hive[bot], head
Hive did not add the |
There was a problem hiding this comment.
Read the probe, the launch-side home provisioning, and the preflight caller; this looks correct to me, with one informational note.
Verified
bobStateHomereturnsAgentHome(...)(src/crux/agent/authprobe.go:31), which is the same resolutionbuildAgentEnvexports as$HOME, so the probe now reads the directory bob actually writes to.- The owner-bit branch is necessary, not optional:
setupPerAgentCLIHomecreates~/.bobwithinteractiveHomeDirMode = 0o700andownAgentDirchowns it to the agent UID (src/crux/agent/interactive_home.go:421-425,:582). Under the old group-bit test that dir would have been reported unwritable on every launch after the first. - The missing-home skip matches reality:
interactiveHomeRootMode = 0o755(interactive_home.go:233) andsetupInteractiveHomeruns inside the launch, afterbobPreflightUnlocked.probeDirs[2:]leaves exactly the workspace dir, and the test pins that it is still probed. ensureBobAuthSettingsstill targetsbobSharedHome, as the body says.
Informational (no change needed)
~/.bob/settingsis a bridge symlink into/data/home/.bob/settings(interactive_home.go:138-140,perAgentCLIBridgeDirs).os.Statfollows it, so that probe is judged by the shared target's group bits and the dev-owned remedy β which is right, since bob's writes land there. The loggeddirwill be the per-agent link path while thechmod 770advice acts on the shared target;chmodfollows symlinks so the remedy works, but an operator reading the log should know the path is a bridge.- The body describes the home switch; the diff also adds the owner-bit logic, the missing-home skip, and the ownership-aware remedy. Those are consequences of the switch rather than scope creep, but a maintainer skimming the body will see less than the diff does.
β hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
Closes #17062
#17039 moved bob's writable state (installation_id, tmp/ chat recordings) into the per-agent home. The preflight still probed the shared
/data/home/.bob, which now holds only the bridged settings, so the diagnostic no longer described what bob writes and could mis-report (flag a dir bob doesn't write, or miss an unwritable per-agent one).The probe now uses the same
AgentHomeresolution the launch path uses. The shared-home settings repair (ensureBobAuthSettings) is unchanged. Test added covering the resolved home and reporting against the per-agent dir.β hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88