Watch
0
0
Fork
You've already forked hyperhive
0

hive-agent: stop writing active_model to the harness state file, nothing reads it

This commit is contained in:
damocles 2026-11-15 14:10:50 +01:00 • committed by mara
commit 05c193859f

View file

@ -393,15 +393,10 @@ impl Bus {
let (tx, _) = broadcast::channel(CHANNEL_CAPACITY);
let (initial_model, model_source) = local_model(configured_model());
let (initial_effort, effort_source) = local_effort(configured_effort());
// Restore rate_limited (and needs_login) from the consolidated
// harness state file so the dashboard shows the correct status
// on cold load if the harness crashed while parked.
let (was_rate_limited, was_needs_login, _) = read_harness_state();
// Write the resolved active model to hyperhive-harness.json on
// startup so hive-c0re can surface the model badge without reading
// hyperhive-model directly. Written once here; updated on every
// apply_model() call and emit_status() call.
write_harness_state(was_rate_limited, was_needs_login, Some(&initial_model));
// Restore rate_limited from the consolidated harness state file so
// the dashboard shows the correct status on cold load if the harness
// crashed while parked.
let (was_rate_limited, _) = read_harness_state();
Self {
tx: Arc::new(tx),
event_seq: Arc::new(AtomicU64::new(0)),
@ -575,11 +570,6 @@ impl Bus {
pub fn apply_model(&self, value: String, source: Source) {
self.model.lock().unwrap().clone_from(&value);
*self.model_source.lock().unwrap() = source;
// Mirror the resolved model into hyperhive-harness.json so
// hive-c0re can surface it on the dashboard badge without reading
// the hyperhive-model override file directly.
let (rate_limited, needs_login, _) = read_harness_state();
write_harness_state(rate_limited, needs_login, Some(&value));
self.emit(LiveEvent::ModelChanged { model: value });
}
@ -905,7 +895,7 @@ impl Bus {
// turns, so the two callers never overlap. Documented rather than
// locked because adding a Mutex here would be overkill for the
// actual call pattern.
let (_, current_needs_login, _) = read_harness_state();
let (_, current_needs_login) = read_harness_state();
let new_needs_login = if status == "needs_login_idle" {
true
} else if status == "online" {
@ -913,8 +903,7 @@ impl Bus {
} else {
current_needs_login
};
let current_model = self.model.lock().unwrap().clone();
write_harness_state(new_rate_limited, new_needs_login, Some(&current_model));
write_harness_state(new_rate_limited, new_needs_login);
self.emit(LiveEvent::StatusChanged { status });
}