refactor(#2416): remove the non-pr config-change flow (request_apply_commit / applycommit)
This commit is contained in:
parent
fbbd5d921c
commit
c2bd7db998
34 changed files with 293 additions and 1635 deletions
|
|
@ -88,9 +88,9 @@ pub struct RequestInitConfigArgs {
|
|||
/// New sub-agent name (≤9 chars). Queues an `InitConfig` approval; on
|
||||
/// approval hive-c0re seeds the proposed config repo at
|
||||
/// `/agents/<name>/config/agent.nix` with the default template. After
|
||||
/// the approval the manager edits + commits the config and calls
|
||||
/// `request_apply_commit` to pin the customised sha for the container's
|
||||
/// first build.
|
||||
/// the approval the manager edits + commits the config, then the operator
|
||||
/// spawns the agent; later config changes go through a PR on the child's
|
||||
/// `agent-configs/<name>` repo.
|
||||
pub name: String,
|
||||
/// Optional description shown on the dashboard approval card.
|
||||
#[serde(default)]
|
||||
|
|
@ -208,20 +208,6 @@ pub struct AgentGetLooseEndsArgs {
|
|||
pub agent: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, serde::Deserialize, schemars::JsonSchema)]
|
||||
pub struct RequestApplyCommitArgs {
|
||||
/// Logical agent name whose config repo the commit lives in.
|
||||
pub agent: String,
|
||||
/// Commit sha (full or short, 7-40 hex chars) in that agent's
|
||||
/// proposed config repo. Must be a sha — a branch or tag name
|
||||
/// (e.g. `main`) is rejected; the approval pins the exact commit.
|
||||
pub commit_ref: String,
|
||||
/// Optional description shown on the dashboard approval card so the
|
||||
/// operator knows what the change does without opening the diff.
|
||||
#[serde(default)]
|
||||
pub description: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, serde::Deserialize, schemars::JsonSchema)]
|
||||
pub struct UpdateMetaInputsArgs {
|
||||
/// Flake input names to update (e.g. `["bitburner-agent", "nixpkgs"]`).
|
||||
|
|
|
|||
|
|
@ -28,9 +28,9 @@ mod render;
|
|||
pub use args::{
|
||||
AckUntilArgs, AgentGetLooseEndsArgs, AnswerArgs, AskArgs, CancelLooseEndArgs,
|
||||
CancelScheduleArgs, CreateRepoArgs, EditScheduleArgs, FireScheduleNowArgs, GetAgentMetaArgs,
|
||||
GetHostJournalArgs, GetLogsArgs, KillArgs, RecvArgs, RemindArgs, RequestApplyCommitArgs,
|
||||
RequestInitConfigArgs, RequestSchedulePromptArgs, RestartArgs, SendArgs, SetStatusArgs,
|
||||
StartArgs, UpdateArgs, UpdateMetaInputsArgs,
|
||||
GetHostJournalArgs, GetLogsArgs, KillArgs, RecvArgs, RemindArgs, RequestInitConfigArgs,
|
||||
RequestSchedulePromptArgs, RestartArgs, SendArgs, SetStatusArgs, StartArgs, UpdateArgs,
|
||||
UpdateMetaInputsArgs,
|
||||
};
|
||||
pub use render::{annotate_retries, format_ack, format_agent_meta, format_recv};
|
||||
|
||||
|
|
@ -686,10 +686,10 @@ impl AgentServer {
|
|||
description = "Initialise a brand-new direct child agent's proposed config repo and \
|
||||
queue an `InitConfig` approval for the operator to review. Requires the `approvals` \
|
||||
tool group. `name` must be a direct child of this agent in the topology tree. \
|
||||
Fails if a config repo for that child already exists — use `request_apply_commit` \
|
||||
to update an existing agent's config. On approval hive-c0re seeds \
|
||||
`/agents/<name>/config/agent.nix` with the default template so you can \
|
||||
customise it and then call `request_apply_commit` with the commit sha."
|
||||
Fails if a config repo for that child already exists. On approval hive-c0re seeds \
|
||||
`/agents/<name>/config/agent.nix` with the default template; customise + commit it, \
|
||||
then the operator spawns the agent. Later config changes go through a PR on the \
|
||||
child's `agent-configs/<name>` repo, reviewed + approved by the operator."
|
||||
)]
|
||||
async fn request_init_config(
|
||||
&self,
|
||||
|
|
@ -716,45 +716,6 @@ impl AgentServer {
|
|||
.await
|
||||
}
|
||||
|
||||
// IMPORTANT: this tool is only available when the `approvals` tool group
|
||||
// is configured for the agent (`HIVE_TOOL_GROUPS` contains `approvals`).
|
||||
// hive-c0re performs a topology check server-side: only direct children
|
||||
// of the calling agent are accepted; all other names are rejected.
|
||||
#[tool(
|
||||
description = "Submit a config change for a direct child agent, queued for operator \
|
||||
approval. Requires the `approvals` tool group. `agent` must be a direct child \
|
||||
of this agent in the topology tree. Pass a commit sha (7-40 hex chars, full or \
|
||||
short) from that agent's proposed config repo — branch/tag names like `main` are \
|
||||
rejected, the approval pins the exact commit. On approval hive-c0re rebuilds \
|
||||
the container with the new config."
|
||||
)]
|
||||
async fn request_apply_commit(
|
||||
&self,
|
||||
Parameters(args): Parameters<RequestApplyCommitArgs>,
|
||||
) -> String {
|
||||
let log = format!("{args:?}");
|
||||
let agent = args.agent.clone();
|
||||
let commit_ref = args.commit_ref.clone();
|
||||
run_tool_envelope("request_apply_commit", log, async move {
|
||||
let (resp, retries) = self
|
||||
.dispatch(hive_sh4re::Request::RequestApplyCommit {
|
||||
agent: args.agent,
|
||||
commit_ref: args.commit_ref,
|
||||
description: args.description,
|
||||
})
|
||||
.await;
|
||||
annotate_retries(
|
||||
format_ack(
|
||||
resp,
|
||||
"request_apply_commit",
|
||||
format!("apply approval queued for {agent} @ {commit_ref}"),
|
||||
),
|
||||
retries,
|
||||
)
|
||||
})
|
||||
.await
|
||||
}
|
||||
|
||||
// IMPORTANT: this tool is only available when the `lifecycle` tool group
|
||||
// is granted to this agent. hive-c0re enforces the topology check
|
||||
// server-side: the call is rejected unless `name` is a direct child.
|
||||
|
|
|
|||
Loading…
Reference in a new issue