hive-ag3nt: scrub stale #658/#419 attribution cookies (#716 batch 2)
This commit is contained in:
parent
84f3fe5f69
commit
017786564a
4 changed files with 22 additions and 22 deletions
|
|
@ -693,8 +693,8 @@ impl Bus {
|
||||||
/// - `"rate_limited"` writes `{state_dir}/hyperhive-rate-limited`
|
/// - `"rate_limited"` writes `{state_dir}/hyperhive-rate-limited`
|
||||||
/// (cleared by any other status).
|
/// (cleared by any other status).
|
||||||
/// - `"needs_login_idle"` writes `{state_dir}/hyperhive-needs-login`
|
/// - `"needs_login_idle"` writes `{state_dir}/hyperhive-needs-login`
|
||||||
/// so a 401-triggered re-auth flag persists across harness restart
|
/// so a 401-triggered re-auth flag persists across harness restart.
|
||||||
/// (#419). The web UI's `/login` POST handler clears it via
|
/// The web UI's `/login` POST handler clears it via
|
||||||
/// `clear_needs_login_sentinel` once the operator re-auths.
|
/// `clear_needs_login_sentinel` once the operator re-auths.
|
||||||
/// - `"online"` clears both sentinels — the agent is healthy again.
|
/// - `"online"` clears both sentinels — the agent is healthy again.
|
||||||
pub fn emit_status(&self, status: impl Into<String>) {
|
pub fn emit_status(&self, status: impl Into<String>) {
|
||||||
|
|
|
||||||
|
|
@ -11,10 +11,10 @@
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
/// Returns the Claude credentials directory for this agent. Delegates
|
/// Returns the Claude credentials directory for this agent. Delegates
|
||||||
/// to `paths::claude_dir`, which reads `$HOME/.claude` (post-#658 the
|
/// to `paths::claude_dir`, which reads `$HOME/.claude`. The service
|
||||||
/// service runs as a non-root unix user named after the agent, so
|
/// runs as a non-root unix user named after the agent so `$HOME`
|
||||||
/// `$HOME` resolves to `/home/<agent>` and the OAuth dir lives at
|
/// resolves to `/home/<agent>` and the OAuth dir lives at
|
||||||
/// `/home/<agent>/.claude`). Overridable via `HYPERHIVE_CLAUDE_DIR`.
|
/// `/home/<agent>/.claude`. Overridable via `HYPERHIVE_CLAUDE_DIR`.
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn default_dir() -> PathBuf {
|
pub fn default_dir() -> PathBuf {
|
||||||
crate::paths::claude_dir()
|
crate::paths::claude_dir()
|
||||||
|
|
|
||||||
|
|
@ -63,10 +63,10 @@ impl LoginSession {
|
||||||
.stdout(Stdio::piped())
|
.stdout(Stdio::piped())
|
||||||
.stderr(Stdio::piped())
|
.stderr(Stdio::piped())
|
||||||
// `claude` reads $HOME/.claude for the credentials dir. The
|
// `claude` reads $HOME/.claude for the credentials dir. The
|
||||||
// harness service env sets HOME to /home/<agent> (post-#658)
|
// harness service env sets HOME to /home/<agent> and the
|
||||||
// and the bind-mount lands the OAuth dir at the same path,
|
// bind-mount lands the OAuth dir at the same path, so the
|
||||||
// so the child inherits the right HOME without any further
|
// child inherits the right HOME without any further wiring
|
||||||
// wiring here.
|
// here.
|
||||||
.kill_on_drop(true)
|
.kill_on_drop(true)
|
||||||
.spawn()
|
.spawn()
|
||||||
.with_context(|| format!("spawn `{cmd}`"))?;
|
.with_context(|| format!("spawn `{cmd}`"))?;
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
//! Per-agent path resolution for state and credential directories.
|
//! Per-agent path resolution for state and credential directories.
|
||||||
//!
|
//!
|
||||||
//! All agents (including the manager "hm1nd") use `/agents/{label}/state`.
|
//! All agents (including the manager `hm1nd`) use `/agents/{label}/state`.
|
||||||
//! Claude credentials live at `$HOME/.claude` (post-#658:
|
//! Claude credentials live at `$HOME/.claude` (resolves to
|
||||||
//! `/home/<agent-name>/.claude` because the harness service now runs
|
//! `/home/<agent-name>/.claude` because the harness service runs as a
|
||||||
//! as a non-root unix user matching the agent label).
|
//! non-root unix user matching the agent label — see
|
||||||
|
//! `docs/persistence.md::First-boot agent-user migration`).
|
||||||
//!
|
//!
|
||||||
//! Both paths can be overridden via env vars (`HYPERHIVE_STATE_DIR`,
|
//! Both paths can be overridden via env vars (`HYPERHIVE_STATE_DIR`,
|
||||||
//! `HYPERHIVE_CLAUDE_DIR`) for dev / test scenarios.
|
//! `HYPERHIVE_CLAUDE_DIR`) for dev / test scenarios.
|
||||||
|
|
@ -25,12 +26,11 @@ pub fn state_dir() -> PathBuf {
|
||||||
|
|
||||||
/// Per-turn config dir for the regenerated claude-{mcp-config,settings,
|
/// Per-turn config dir for the regenerated claude-{mcp-config,settings,
|
||||||
/// system-prompt} files the harness drops before each turn. Set by
|
/// system-prompt} files the harness drops before each turn. Set by
|
||||||
/// systemd via `RuntimeDirectory = "hive-config"` (#658 fixup): a
|
/// systemd via `RuntimeDirectory = "hive-config"`: a per-service runtime
|
||||||
/// per-service runtime dir owned by the agent unix user, auto-cleared
|
/// dir owned by the agent unix user, auto-cleared on stop. Kept separate
|
||||||
/// on stop. Kept separate from `/run/hive` (the host-owned mcp.sock
|
/// from `/run/hive` (the host-owned mcp.sock bind) so the harness owns
|
||||||
/// bind) so the harness owns its own write surface and we don't have
|
/// its own write surface and we don't have to chown a bind-mounted dir.
|
||||||
/// to chown a bind-mounted dir. Overridable via `HYPERHIVE_CONFIG_DIR`
|
/// Overridable via `HYPERHIVE_CONFIG_DIR` for dev / test scenarios.
|
||||||
/// for dev / test scenarios.
|
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn config_dir() -> PathBuf {
|
pub fn config_dir() -> PathBuf {
|
||||||
if let Some(p) = std::env::var_os("HYPERHIVE_CONFIG_DIR") {
|
if let Some(p) = std::env::var_os("HYPERHIVE_CONFIG_DIR") {
|
||||||
|
|
@ -42,8 +42,8 @@ pub fn config_dir() -> PathBuf {
|
||||||
/// Claude credentials directory for the current agent. `$HOME/.claude`
|
/// Claude credentials directory for the current agent. `$HOME/.claude`
|
||||||
/// matches what the `claude` CLI reads at runtime — both binaries see
|
/// matches what the `claude` CLI reads at runtime — both binaries see
|
||||||
/// the same `$HOME` set by the per-service systemd `environment`
|
/// the same `$HOME` set by the per-service systemd `environment`
|
||||||
/// declaration (`/home/<agent>` post-#658). Falls back to `/root/.claude`
|
/// declaration (`/home/<agent>`). Falls back to `/root/.claude` for
|
||||||
/// for dev / test environments where `HOME` isn't set so the previous
|
/// dev / test environments where `HOME` isn't set so the previous
|
||||||
/// root-by-default shape keeps working without env wiring.
|
/// root-by-default shape keeps working without env wiring.
|
||||||
/// Overridable via `HYPERHIVE_CLAUDE_DIR` for dev / test scenarios.
|
/// Overridable via `HYPERHIVE_CLAUDE_DIR` for dev / test scenarios.
|
||||||
#[must_use]
|
#[must_use]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue