Skip to content

Commit 61cc738

Browse files
tlongwell-blocknpub1jh9wn95s0472h86ahapupaf7m6kx4v9sx2n0atj2hltcfer8k06s5n3pyfTyler Longwellnpub12gtutshhh76rx0jx697f32f9tffd4hhp3hx58fp4x6u4uemkm7sqf8f757npub1mprnacetjua2xx3p5eddmhxyk6wv929ymm5py8kd2xfxurxahspqqlgyta
authored
feat(desktop+acp): spawn a harness per (agent, community) pair at GUI startup — warm sockets, lazy LLM pool (#2122)
Signed-off-by: Tyler Longwell <[email protected]> Signed-off-by: Matt Toohey <[email protected]> Signed-off-by: npub12gtutshhh76rx0jx697f32f9tffd4hhp3hx58fp4x6u4uemkm7sqf8f757 <5217c5c2f7bfb4333e46d17c98a9255a52dadee18dcd43a43536b95e6776dfa0@sprout-oss.stage.blox.sqprod.co> Signed-off-by: Tyler <[email protected]> Co-authored-by: npub1jh9wn95s0472h86ahapupaf7m6kx4v9sx2n0atj2hltcfer8k06s5n3pyf <95cae996907d7cab9f5dbf43c0f53edeac6ab0b032a6feae4abfd784e467b3f5@sprout-oss.stage.blox.sqprod.co> Co-authored-by: Tyler Longwell <[email protected]> Co-authored-by: npub12gtutshhh76rx0jx697f32f9tffd4hhp3hx58fp4x6u4uemkm7sqf8f757 <5217c5c2f7bfb4333e46d17c98a9255a52dadee18dcd43a43536b95e6776dfa0@sprout-oss.stage.blox.sqprod.co> Co-authored-by: npub1mprnacetjua2xx3p5eddmhxyk6wv929ymm5py8kd2xfxurxahspqqlgyta <d8473ee32b973aa31a21a65adddcc4b69cc2a8a4dee8121ecd51926e0cddbc02@sprout-oss.stage.blox.sqprod.co> Co-authored-by: npub1t2tgm7d8f995uqvmnm8h88sg3wnpp9a5xysjf6dg3tjmgt3ltulqdp8ehr <5a968df9a7494b4e019b9ecf739e088ba61097b4312124e9a88ae5b42e3f5f3e@sprout-oss.stage.blox.sqprod.co> Co-authored-by: Dawn <c6237ef84fa537c78dcee78efd2d4e59f728859c7f194da42ac51ededfa0be05@sprout-oss.stage.blox.sqprod.co> Co-authored-by: npub1qyvc0c5kl4gqv2fd97fsk46tu378sqgy35vc83rvgfwne90sel7s0ed67d <011987e296fd5006292d2f930b574be47c7801048d1983c46c425d3c95f0cffd@sprout-oss.stage.blox.sqprod.co> Co-authored-by: Matt Toohey <[email protected]> Co-authored-by: Claude Fable 5 <[email protected]> Co-authored-by: npub1hwqy0rnujtl25dzmlhn8qwux4kr8sjhas3ugltx9j5dm5dwkp2dsqjhytw <bb80478e7c92feaa345bfde6703b86ad86784afd84788facc5951bba35d60a9b@buzz.block.builderlab.xyz>
1 parent 6d04d27 commit 61cc738

68 files changed

Lines changed: 4882 additions & 706 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎TESTING.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,14 @@ The justfile also ships `just goose key="$AGENT_NSEC"` (foreground) and
235235
same env. See `crates/buzz-acp/README.md` for parallel agents, heartbeats,
236236
respond-to gates, and forum subscriptions.
237237

238+
To exercise deferred ACP startup, add `BUZZ_ACP_LAZY_POOL=true` before launching
239+
`buzz-acp`. The harness should connect, authenticate, subscribe, and publish
240+
online presence without starting the configured ACP child. The first accepted,
241+
flushable mention should start exactly one child and then dispatch the queued
242+
message. Automated coverage in `pool_lifecycle_state` pins single-wake,
243+
retry/backoff, and stale-result behavior; it does not replace this real
244+
relay/process smoke test.
245+
238246
Send the agent a task — switch your shell back to the **sender** identity
239247
from step 4 and @mention the agent:
240248

‎crates/buzz-acp/README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ All configuration is via environment variables (or CLI flags — every env var h
115115
| Flag | Env Var | Default | Description |
116116
|------|---------|---------|-------------|
117117
| `--agents` | `BUZZ_ACP_AGENTS` | `1` | Number of agent subprocesses (1–32). |
118+
| `--lazy-pool` | `BUZZ_ACP_LAZY_POOL` | `false` | Connect, subscribe, and queue accepted work before starting ACP/LLM subprocesses. The first accepted event wakes one pool initialization task; failures retry with bounded exponential backoff while work remains. |
118119
| `--heartbeat-interval` | `BUZZ_ACP_HEARTBEAT_INTERVAL` | `0` | Seconds between heartbeat prompts. `0` = disabled. Must be `0` or ≥10 when enabled. |
119120
| `--heartbeat-prompt` | `BUZZ_ACP_HEARTBEAT_PROMPT` | (built-in) | Custom heartbeat prompt text. Conflicts with `--heartbeat-prompt-file`. |
120121
| `--heartbeat-prompt-file` | `BUZZ_ACP_HEARTBEAT_PROMPT_FILE` | — | Read heartbeat prompt from a file. Conflicts with `--heartbeat-prompt`. |

‎crates/buzz-acp/src/config.rs‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,10 @@ pub struct CliArgs {
467467
/// Publish encrypted ACP observer frames over the relay.
468468
#[arg(long, env = "BUZZ_ACP_RELAY_OBSERVER", default_value_t = false)]
469469
pub relay_observer: bool,
470+
471+
/// Connect and subscribe before starting the ACP/LLM subprocess pool.
472+
#[arg(long, env = "BUZZ_ACP_LAZY_POOL", default_value_t = false)]
473+
pub lazy_pool: bool,
470474
}
471475

472476
/// Merged NIP-01 subscription filter for a single channel.
@@ -537,6 +541,8 @@ pub struct Config {
537541
pub has_generated_codex_config: bool,
538542
/// Whether to publish encrypted observer frames through the relay.
539543
pub relay_observer: bool,
544+
/// Whether ACP/LLM subprocess initialization is deferred until accepted work arrives.
545+
pub lazy_pool: bool,
540546
/// Agent owner pubkey (hex). Used for `--respond-to=owner-only` gate.
541547
/// Replaces the old REST-based owner lookup.
542548
pub agent_owner: Option<String>,
@@ -993,6 +999,7 @@ impl Config {
993999
persona_env_vars,
9941000
has_generated_codex_config,
9951001
relay_observer: args.relay_observer,
1002+
lazy_pool: args.lazy_pool,
9961003
agent_owner: args.agent_owner.map(|s| s.trim().to_ascii_lowercase()),
9971004
no_base_prompt: args.no_base_prompt,
9981005
base_prompt_content,
@@ -1361,6 +1368,7 @@ mod tests {
13611368
persona_env_vars: vec![],
13621369
has_generated_codex_config: false,
13631370
relay_observer: false,
1371+
lazy_pool: false,
13641372
agent_owner: None,
13651373
no_base_prompt: false,
13661374
base_prompt_content: None,
@@ -2026,6 +2034,20 @@ channels = "ALL"
20262034
assert!(err.to_string().contains("turn liveness interval must be 0"));
20272035
}
20282036

2037+
#[test]
2038+
fn lazy_pool_defaults_off() {
2039+
let key = "0".repeat(64);
2040+
assert!(!CliArgs::parse_from(["buzz-acp", "--private-key", &key]).lazy_pool);
2041+
}
2042+
2043+
#[test]
2044+
fn lazy_pool_cli_flag_enables_deferred_startup() {
2045+
let key = "0".repeat(64);
2046+
let args = CliArgs::try_parse_from(["buzz-acp", "--private-key", &key, "--lazy-pool=true"]);
2047+
assert!(args.is_err(), "bool flags do not take an explicit value");
2048+
assert!(CliArgs::parse_from(["buzz-acp", "--private-key", &key, "--lazy-pool"]).lazy_pool);
2049+
}
2050+
20292051
#[test]
20302052
fn test_summary_includes_agents_and_heartbeat() {
20312053
let config = test_config(SubscribeMode::Mentions);

0 commit comments

Comments
 (0)