slop: Say how long approvers have to answer #12
No files matched your search
Generated
+1
-1
@@ -3859,7 +3859,7 @@ checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
|
||||
|
||||
[[package]]
|
||||
name = "slop-broker"
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
dependencies = [
|
||||
"age",
|
||||
"anyhow",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "slop-broker"
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
edition = "2024"
|
||||
description = "Approval broker that runs privileged operations for coding agents"
|
||||
license = "MIT"
|
||||
|
||||
+5
-3
@@ -6,9 +6,11 @@ applies a policy, and asks a human to approve most requests.
|
||||
|
||||
## How requests behave
|
||||
|
||||
- A request that needs approval blocks for up to **five minutes** while a human answers. Run
|
||||
`slop` with a tool timeout of at least six minutes, or in the background. Don't retry a request
|
||||
that is waiting, denied or expired in a loop; tell the user instead.
|
||||
- A request that needs approval blocks while a human answers, for as long as the broker allows:
|
||||
five minutes by default, but often much longer. `slop` prints how long when it starts waiting
|
||||
(`approvers have 45m to answer`), and a deploy or build waits that long at each approval. Run
|
||||
`slop` in the background, or with a tool timeout longer than that. Don't retry a request that
|
||||
is waiting, denied or expired in a loop; tell the user instead.
|
||||
- Exit status **125** means the broker did not run the operation: it was denied, expired, invalid
|
||||
or failed. Any other status is the operation's own.
|
||||
- Approvers see who sent a request and can see `--label` (or `SLOP_LABEL`). Use it to say briefly
|
||||
|
||||
+2
-1
@@ -28,7 +28,8 @@ const GUIDE: &str = include_str!("../../slop-tools.md");
|
||||
#[derive(Parser)]
|
||||
#[command(
|
||||
about = "Ask the slop broker to run privileged operations",
|
||||
after_help = "Requests wait up to five minutes for an approver; don't retry them in a loop.\n\
|
||||
after_help = "Requests wait for an approver for as long as the broker allows (it says how long);\n\
|
||||
don't retry them in a loop.\n\
|
||||
Exit status 125 means the broker did not run the operation.\n\
|
||||
SLOP_BROKER, or broker in ~/.config/slop/config.toml, selects the broker:\n\
|
||||
vsock:<cid>:<port>, unix:<path> or ssh:<destination>."
|
||||
|
||||
@@ -387,6 +387,8 @@ async fn authorize(
|
||||
.submit(id, pending, settings.max_pending)
|
||||
.map_err(|e| ServerMessage::Error(e.to_string()))?;
|
||||
io.out.send(ServerMessage::Pending { id: id.to_owned(), summary: parsed.summary.clone() }).await;
|
||||
let window = humantime::format_duration(broker.queue.timeout());
|
||||
io.out.send(ServerMessage::Info(format!("approvers have {window} to answer"))).await;
|
||||
|
||||
let outcome = tokio::select! {
|
||||
outcome = reply => outcome.unwrap_or(Outcome::Expired),
|
||||
|
||||
@@ -264,6 +264,9 @@ async fn pending_id(client: &mut Client) -> String {
|
||||
match client.next(&mut String::new()).await {
|
||||
ServerMessage::Pending { id, summary } => {
|
||||
assert_eq!(summary, "ssh river");
|
||||
// Then how long approvers have, so agents know how long to wait.
|
||||
let window = client.next(&mut String::new()).await;
|
||||
assert!(matches!(&window, ServerMessage::Info(m) if m.starts_with("approvers have ")), "{window:?}");
|
||||
id
|
||||
}
|
||||
other => panic!("expected pending, got {other:?}"),
|
||||
@@ -425,6 +428,9 @@ async fn remote_requesters_and_approvers_use_one_socket() {
|
||||
let request = ClientMessage::Request(Request { version: PROTOCOL_VERSION, label: None, operation: ssh(&["true"]) });
|
||||
send(&mut requester, &request).await.unwrap();
|
||||
let Some(ServerMessage::Pending { id, .. }) = receive(&mut requester).await.unwrap() else { panic!("not pending") };
|
||||
let Some(ServerMessage::Info(_)) = receive::<_, ServerMessage>(&mut requester).await.unwrap() else {
|
||||
panic!("no window")
|
||||
};
|
||||
|
||||
// One approver connection carries several requests.
|
||||
let mut approver = remote(&path, Role::Approver, "laptop").await;
|
||||
|
||||
Reference in new issue
Block a user