refactor(#2416): remove the non-pr config-change flow (request_apply_commit / applycommit)

This commit is contained in:
damocles 2026-07-15 20:45:29 +02:00 committed by mara
commit c2bd7db998
34 changed files with 293 additions and 1635 deletions

View file

@ -58,12 +58,10 @@ pub struct Approval {
/// Kind-specific payload (git sha / inputs array / schedule
/// payload / empty). See the Approval struct doc.
pub commit_ref: String,
/// The canonical hive-c0re-vouched sha. For `ApplyCommit`: the sha
/// after the proposal fetch, tagged `proposal/<id>` (stable for the
/// approval's lifetime — manager amends in proposed don't change
/// what gets built). For `MergeConfigPr`: the reviewed PR head
/// pinned at submit; if the PR head drifts off it before merge,
/// hive-c0re refreshes this + re-renders the card for re-review.
/// The canonical hive-c0re-vouched sha. For `MergeConfigPr`: the
/// reviewed PR head pinned at submit; if the PR head drifts off it
/// before merge, hive-c0re cancels the stale approval and re-queues a
/// fresh one for re-review.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub fetched_sha: Option<String>,
pub requested_at: DateTime<Utc>,
@ -84,9 +82,6 @@ pub struct Approval {
#[derive(Debug, Clone, Copy, Default, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "snake_case")]
pub enum ApprovalKind {
/// Apply a manager-proposed config commit.
#[default]
ApplyCommit,
/// Create + start a new sub-agent container with the given name
/// (under the default `agent.nix` template).
Spawn,
@ -100,9 +95,12 @@ pub enum ApprovalKind {
SchedulePrompt,
/// Merge an operator-reviewed config PR: hive-c0re verifies the
/// reviewed PR head, fast-forwards the forge config repo's `main`
/// to it, marks the PR merged, then runs the same deploy tail as
/// `ApplyCommit`. `commit_ref` = PR number; `fetched_sha` = the
/// reviewed PR head pinned at submit. See `docs/approvals.md`.
/// to it, marks the PR merged, then runs the deploy tail. This is the
/// sole config-change flow — a manager opens a PR on its
/// `agent-configs/<agent>` repo and the operator reviews + approves it.
/// `commit_ref` = PR number; `fetched_sha` = the reviewed PR head
/// pinned at submit. See `docs/approvals.md`.
#[default]
MergeConfigPr,
}
@ -114,7 +112,6 @@ impl ApprovalKind {
#[must_use]
pub fn as_str(self) -> &'static str {
match self {
ApprovalKind::ApplyCommit => "apply_commit",
ApprovalKind::Spawn => "spawn",
ApprovalKind::InitConfig => "init_config",
ApprovalKind::UpdateMetaInputs => "update_meta_inputs",
@ -544,13 +541,6 @@ pub enum Request {
/// *(privileged)* Rebuild a sub-agent against the current hyperhive
/// flake + agent.nix. No approval required.
Update { name: String },
/// *(privileged)* Submit a config commit for the operator to approve.
RequestApplyCommit {
agent: String,
commit_ref: String,
#[serde(default, skip_serializing_if = "Option::is_none")]
description: Option<String>,
},
/// *(privileged)* Fetch recent journal lines for a sub-agent container.
GetLogs {
agent: String,
@ -923,8 +913,7 @@ pub enum ToolGroup {
Inbox,
/// `kill`, `start`, `restart`, `update` - *(privileged)*
Lifecycle,
/// `request_init_config`, `request_apply_commit`,
/// `request_update_meta_inputs` - *(privileged)*
/// `request_init_config`, `request_update_meta_inputs` - *(privileged)*
Approvals,
/// `request_schedule_prompt`, `fire_schedule_now`, `cancel_schedule`,
/// `edit_schedule`, `list_schedules` - *(privileged)*
@ -961,11 +950,7 @@ impl ToolGroup {
"request_next_turn",
],
Self::Lifecycle => &["kill", "start", "restart", "update", "list_containers"],
Self::Approvals => &[
"request_init_config",
"request_apply_commit",
"request_update_meta_inputs",
],
Self::Approvals => &["request_init_config", "request_update_meta_inputs"],
Self::Scheduling => &[
"request_schedule_prompt",
"fire_schedule_now",
@ -1066,7 +1051,7 @@ impl ToolGroup {
"kill, start, restart, update, list_containers — container lifecycle (privileged)"
}
Self::Approvals => {
"request_init_config, request_apply_commit, request_update_meta_inputs — config change flow (privileged)"
"request_init_config, request_update_meta_inputs — config change flow (privileged)"
}
Self::Scheduling => {
"request_schedule_prompt and related — operator-visible scheduled prompts (privileged)"