Skip to content

Commit 91080e0

Browse files
Merge branch 'main' into duncan/byoh-generic-acp-harness
Brings the branch up to date with origin/main (2a051a4) so CI and local gates run against the tree that will actually merge. Requested as a merge commit rather than a rebase to keep Duncan's authored history intact. Two ratchet entries in desktop/scripts/check-file-sizes.mjs needed composing, since both sides raised per-file ceilings from a shared base: - src-tauri/src/commands/agent_discovery.rs — textual conflict. BYOH took 1826 -> 2038 (+212); main #2767 took 1826 -> 1836 (+10). Resolved to 2048 with both comment blocks kept, preserving the slack each side intended rather than discarding one growth. - src-tauri/src/managed_agents/discovery.rs — no textual conflict, but the BYOH ceiling of 1715 predates main's +17 and the merged file is 1729 lines, so the check failed on a clean auto-merge. Composed to 1732. The overrides map is a ceiling (violation only when lineCount > limit), so composing deltas is the resolution that matches the file's convention. Verified on the merged tree: desktop file-size check clean, frontend suite 3554/3555 (the one failure is the pre-existing styled-qr-code 'Cannot find package qrcode' local module-resolution fault, which fails identically on pristine heads), presetLogos drift guard 10/10 with all 8 preset ids still parsing out of main's modified discovery.rs, tsc --noEmit clean, biome clean over 1640 files, just test-unit 5/5 crates, and desktop-tauri-test 1691/1691. Co-authored-by: tlongwell-block <[email protected]> Signed-off-by: tlongwell-block <[email protected]>
2 parents 22218cc + 2a051a4 commit 91080e0

21 files changed

Lines changed: 2388 additions & 584 deletions

‎CHANGELOG.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Changelog
22

3+
## v0.4.26
4+
5+
- Style mobile pairing QR codes ([#2775](https://github.com/block/buzz/pull/2775)) ([`50655ac09`](https://github.com/block/buzz/commit/50655ac097fbf1a7db1a5284dccc7e2a0b0f1bfc))
6+
- Refine community management flows ([#2738](https://github.com/block/buzz/pull/2738)) ([`384c72dee`](https://github.com/block/buzz/commit/384c72dee6336234beae3c1a0fec305044815245))
7+
- docs: replace VPN-vendor references with generic wording ([#2805](https://github.com/block/buzz/pull/2805)) ([`bcca885ba`](https://github.com/block/buzz/commit/bcca885ba92b74df77e36b8e6c45a54dafc291f9))
8+
- fix(desktop): explain macOS local network access ([#2263](https://github.com/block/buzz/pull/2263)) ([`e527d74f0`](https://github.com/block/buzz/commit/e527d74f069de5d706714d63d99a494389e824af))
9+
- fix(desktop): clarify CLI runtime setup ([#2680](https://github.com/block/buzz/pull/2680)) ([`b8510ede1`](https://github.com/block/buzz/commit/b8510ede1b52ebe87ed3cf18cf0b2590a86b2245))
10+
11+
312
## v0.4.25
413

514
- fix(discovery): spawn PowerShell install commands natively on Windows ([#2750](https://github.com/block/buzz/pull/2750)) ([`f3981dbfe`](https://github.com/block/buzz/commit/f3981dbfefc09e6a888ada489badb7dafdf122cf))

‎crates/buzz-db/src/lib.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,7 @@ impl Db {
898898
.fetch_one(&mut *tx)
899899
.await?;
900900

901-
if owned_count >= relay_members::MAX_COMMUNITIES_PER_OWNER {
901+
if owned_count >= relay_members::max_communities_per_owner() {
902902
tx.rollback().await?;
903903
return Ok(CreateCommunityWithOwnerResult::LimitReached);
904904
}

‎crates/buzz-db/src/relay_members.rs‎

Lines changed: 55 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -373,11 +373,37 @@ pub enum TransferResult {
373373
LimitReached,
374374
}
375375

376-
/// Maximum number of communities a single pubkey can own. Enforced at the
377-
/// relay layer — the authoritative layer — so that concurrent transfers or
376+
/// Default maximum number of communities a single pubkey can own. Enforced at
377+
/// the relay layer — the authoritative layer — so that concurrent transfers or
378378
/// transfer-vs-create races cannot both pass a preflight count.
379379
pub const MAX_COMMUNITIES_PER_OWNER: i64 = 3;
380380

381+
/// Effective per-owner community limit for this deployment.
382+
///
383+
/// Reads `BUZZ_MAX_COMMUNITIES_PER_OWNER` once (cached for the process
384+
/// lifetime); a missing, unparsable, or non-positive value falls back to
385+
/// [`MAX_COMMUNITIES_PER_OWNER`]. Lets multi-tenant operators raise the cap
386+
/// without a source change while keeping the stock default for everyone else.
387+
pub fn max_communities_per_owner() -> i64 {
388+
static LIMIT: std::sync::OnceLock<i64> = std::sync::OnceLock::new();
389+
*LIMIT.get_or_init(|| {
390+
effective_owner_limit(
391+
std::env::var("BUZZ_MAX_COMMUNITIES_PER_OWNER")
392+
.ok()
393+
.as_deref(),
394+
)
395+
})
396+
}
397+
398+
/// Pure resolution of the owner limit from a raw env value — extracted from
399+
/// [`max_communities_per_owner`] so the parse/fallback rules are testable
400+
/// without process-global env state.
401+
fn effective_owner_limit(raw: Option<&str>) -> i64 {
402+
raw.and_then(|value| value.trim().parse::<i64>().ok())
403+
.filter(|limit| *limit > 0)
404+
.unwrap_or(MAX_COMMUNITIES_PER_OWNER)
405+
}
406+
381407
/// Stable advisory-lock key for serializing ownership-granting operations
382408
/// (transfer + create) per recipient pubkey. Uses FNV-1a over the hex pubkey
383409
/// so the same recipient always maps to the same lock across processes.
@@ -472,7 +498,7 @@ pub async fn transfer_ownership(
472498
.fetch_one(&mut *tx)
473499
.await?;
474500

475-
if owned_count >= MAX_COMMUNITIES_PER_OWNER {
501+
if owned_count >= max_communities_per_owner() {
476502
tx.rollback().await?;
477503
return Ok(TransferResult::LimitReached);
478504
}
@@ -555,6 +581,32 @@ pub async fn backfill_from_allowlist(pool: &PgPool, community: CommunityId) -> R
555581

556582
#[cfg(test)]
557583
mod tests {
584+
#[test]
585+
fn owner_limit_defaults_when_unset_or_invalid() {
586+
assert_eq!(
587+
super::effective_owner_limit(None),
588+
super::MAX_COMMUNITIES_PER_OWNER
589+
);
590+
assert_eq!(
591+
super::effective_owner_limit(Some("not-a-number")),
592+
super::MAX_COMMUNITIES_PER_OWNER
593+
);
594+
assert_eq!(
595+
super::effective_owner_limit(Some("0")),
596+
super::MAX_COMMUNITIES_PER_OWNER
597+
);
598+
assert_eq!(
599+
super::effective_owner_limit(Some("-5")),
600+
super::MAX_COMMUNITIES_PER_OWNER
601+
);
602+
}
603+
604+
#[test]
605+
fn owner_limit_honors_positive_override() {
606+
assert_eq!(super::effective_owner_limit(Some("100")), 100);
607+
assert_eq!(super::effective_owner_limit(Some(" 12 ")), 12);
608+
}
609+
558610
use super::*;
559611
use uuid::Uuid;
560612

‎desktop/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "buzz",
33
"private": true,
4-
"version": "0.4.25",
4+
"version": "0.4.26",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",

‎desktop/scripts/check-file-sizes.mjs‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,10 @@ const overrides = new Map([
337337
// +29: rebase over main (#2680) — discover_acp_runtime_phase1 extracted
338338
// helper + discover_acp_runtime_availability; both load-bearing for
339339
// post-install verification. Semantic composition with BYOH changes.
340-
["src-tauri/src/managed_agents/discovery.rs", 1715],
340+
// +17: merge of main (#2767) — codex_adapter_is_outdated_with_path split out
341+
// so Codex adapter planning takes an explicit PATH. Auto-merged cleanly; only
342+
// the ceiling needed composing with the BYOH growth above.
343+
["src-tauri/src/managed_agents/discovery.rs", 1732],
341344
// BYOH — save_custom_harness_to_dir (backup-swap atomic write) + save_and_warm /
342345
// delete_and_warm (persist-mutex serialization for concurrent-safe registry
343346
// refresh, B-6). Also: id/collision/load/registry tests (from the file base) +
@@ -563,7 +566,10 @@ const overrides = new Map([
563566
// return value so the frontend immediately has the updated env.
564567
// +1: rebase over main (#2680) — requires_external_cli: false added to
565568
// save_custom_harness catalog entry construction (new required field).
566-
["src-tauri/src/commands/agent_discovery.rs", 2038],
569+
// +10: merge of main (#2767) — pass an explicit PATH through Codex adapter
570+
// install planning so unit tests avoid the process-global login-shell PATH
571+
// cache. Independent of the BYOH growth above; the two deltas compose.
572+
["src-tauri/src/commands/agent_discovery.rs", 2048],
567573
// draft-persistence predicate: submit-time `loadDraft` check + inline comment
568574
// + deps-array entry in submitMessage closes the never-persisted-boundary
569575
// defect (Thufir Pass-3 finding). Load-bearing correctness fix; queued to

‎desktop/src-tauri/Cargo.lock‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎desktop/src-tauri/Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[package]
44
name = "buzz-desktop"
5-
version = "0.4.25"
5+
version = "0.4.26"
66
description = "Buzz desktop app"
77
authors = ["you"]
88
edition = "2021"

‎desktop/src-tauri/src/commands/agent_discovery.rs‎

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,19 @@ pub(crate) fn plan_adapter_install<'c>(
4444
runtime_id: &str,
4545
adapter_path: Option<&std::path::Path>,
4646
adapter_install_commands: &'c [&'c str],
47+
adapter_probe_path: Option<&str>,
4748
) -> Option<Vec<&'c str>> {
4849
match adapter_path {
4950
// Adapter present and current — no install needed.
5051
Some(_) if runtime_id != "codex" => None,
51-
Some(path) if !crate::managed_agents::codex_adapter_is_outdated(path) => None,
52+
Some(path)
53+
if !crate::managed_agents::codex_adapter_is_outdated_with_path(
54+
path,
55+
adapter_probe_path,
56+
) =>
57+
{
58+
None
59+
}
5260
// Codex adapter is outdated: uninstall the old package first so npm
5361
// doesn't hit EEXIST on the shared `codex-acp` bin-link, then install.
5462
Some(_) => Some(vec![
@@ -327,10 +335,12 @@ fn install_acp_runtime_blocking(runtime_id: &str) -> Result<InstallRuntimeResult
327335
.commands
328336
.iter()
329337
.find_map(|cmd| crate::managed_agents::resolve_command(cmd));
338+
let adapter_probe_path = crate::managed_agents::readiness::cli_probe::augmented_path();
330339
if let Some(cmds) = plan_adapter_install(
331340
runtime_id,
332341
adapter_path.as_deref(),
333342
runtime.adapter_install_commands,
343+
adapter_probe_path.as_deref(),
334344
) {
335345
let use_managed_npm =
336346
cmds.iter().any(|cmd| is_npm_global_install(cmd)) && managed_node_runtime_supported();
@@ -1331,7 +1341,7 @@ mod tests {
13311341
.expect("chmod script");
13321342

13331343
let install_cmds = &["npm install -g @agentclientprotocol/codex-acp"];
1334-
let plan = plan_adapter_install("codex", Some(&bin), install_cmds);
1344+
let plan = plan_adapter_install("codex", Some(&bin), install_cmds, Some("/usr/bin:/bin"));
13351345

13361346
assert!(
13371347
plan.is_some(),
@@ -1366,7 +1376,7 @@ mod tests {
13661376
.expect("chmod script");
13671377

13681378
let install_cmds = &["npm install -g @agentclientprotocol/codex-acp"];
1369-
let plan = plan_adapter_install("codex", Some(&bin), install_cmds);
1379+
let plan = plan_adapter_install("codex", Some(&bin), install_cmds, Some("/usr/bin:/bin"));
13701380

13711381
assert!(
13721382
plan.is_none(),
@@ -1377,7 +1387,7 @@ mod tests {
13771387
#[test]
13781388
fn test_plan_adapter_install_returns_catalog_cmds_when_no_adapter_path() {
13791389
let install_cmds = &["npm install -g @agentclientprotocol/codex-acp"];
1380-
let plan = plan_adapter_install("codex", None, install_cmds);
1390+
let plan = plan_adapter_install("codex", None, install_cmds, None);
13811391
assert!(plan.is_some(), "missing adapter must trigger install plan");
13821392
// Missing arm: use the catalog's install commands directly (no prior
13831393
// package to uninstall — fresh install, not a reinstall).
@@ -1401,7 +1411,7 @@ mod tests {
14011411
.expect("chmod script");
14021412

14031413
let install_cmds = &["npm install -g @block/goose-acp"];
1404-
let plan = plan_adapter_install("goose", Some(&bin), install_cmds);
1414+
let plan = plan_adapter_install("goose", Some(&bin), install_cmds, None);
14051415
assert!(
14061416
plan.is_none(),
14071417
"non-codex runtime with resolved binary must not trigger reinstall"

‎desktop/src-tauri/src/managed_agents/discovery.rs‎

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1228,9 +1228,26 @@ pub(crate) fn codex_adapter_availability(path: &Path) -> AcpAvailabilityStatus {
12281228
}
12291229

12301230
/// Returns `true` when the codex-acp binary at `path` is outdated (major version < 1)
1231-
/// or cannot be probed. Thin wrapper around [`codex_adapter_availability`].
1231+
/// or cannot be probed using `augmented_path`. Thin wrapper around
1232+
/// [`codex_adapter_is_outdated_with_path`].
1233+
#[cfg(test)]
12321234
pub(crate) fn codex_adapter_is_outdated(path: &Path) -> bool {
1233-
codex_adapter_availability(path) == AcpAvailabilityStatus::AdapterOutdated
1235+
codex_adapter_is_outdated_with_path(
1236+
path,
1237+
crate::managed_agents::readiness::cli_probe::augmented_path().as_deref(),
1238+
)
1239+
}
1240+
1241+
/// Returns `true` when the codex-acp binary at `path` is outdated (major version < 1)
1242+
/// or cannot be probed with the supplied PATH.
1243+
pub(crate) fn codex_adapter_is_outdated_with_path(
1244+
path: &Path,
1245+
augmented_path: Option<&str>,
1246+
) -> bool {
1247+
!matches!(
1248+
probe_codex_acp_major_version_with_path(path, augmented_path),
1249+
Some(major) if major >= 1
1250+
)
12341251
}
12351252

12361253
/// Intermediate struct built before the (potentially slow) auth probe phase.

‎desktop/src-tauri/tauri.conf.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "https://schema.tauri.app/config/2",
33
"productName": "Buzz",
4-
"version": "0.4.25",
4+
"version": "0.4.26",
55
"identifier": "xyz.block.buzz.app",
66
"build": {
77
"beforeDevCommand": {

0 commit comments

Comments
 (0)