Skip to content

Commit 2245383

Browse files
author
Eva
committed
Merge origin/main into carl/relay-primary-agent-config
Absorbs the relay half that shipped separately in block#5133 (squash commit 4a8c67a): the kind:30179 ingest acceptance hunk in crates/buzz-relay/src/handlers/ingest.rs was byte-identical on both sides, so this merge removes all relay-side changes from this PR's diff. block#4999 now carries only the desktop + buzz-core codec half. No rebase, no force-push — history preserved per operator instruction. Co-authored-by: Tyler Longwell <[email protected]> Signed-off-by: Tyler Longwell <[email protected]> * origin/main: fix(bench): mention the orchestrator by pubkey when posting the task (block#5136) feat(relay): accept kind:30179 private managed-agent events at ingest (block#5133) fix(media): require authenticated reads (block#4610) fix(desktop): preserve authoritative agent avatars (block#4984) fix(desktop): next/back navigation during key creation onboarding (block#4978) Alert community owners and admins when a new key joins (block#4900) fix(desktop): prevent sidebar prefs from reverting on stale-localStorage boot (block#5086) chore(hooks): run desktop typecheck in pre-push (block#5110) feat(identity): recover desktop identity from a signed-in phone (block#4845) fix(buzz-agent): classify read timeouts distinctly in LLM error messages (block#4959) Refine agent runtime controls (block#5026) test(desktop): await thread scroll anchor (block#3174) Improve desktop mobile pairing flow (block#5024) feat(desktop): show selected community in rail (block#5000) fix(desktop): stop rate-limited reconnect backfill from tearing down the authenticated socket (block#4990) fix(desktop): skip native notifications outside app bundles (block#5004) ci: prove the relay-driven mesh lifecycle — discover, join, infer, deny — with real nodes (block#3862) fix(desktop): virtualize channel member lists (block#4991) Signed-off-by: Eva <011987e296fd5006292d2f930b574be47c7801048d1983c46c425d3c95f0cffd@buzz.block.builderlab.xyz>
2 parents 4e3fba1 + a71a3f9 commit 2245383

107 files changed

Lines changed: 11266 additions & 1542 deletions

File tree

Some content is hidden

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

‎.env.example‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,10 @@ BUZZ_S3_ADDRESSING_STYLE=path
102102
# BUZZ_MEDIA_MAX_CONCURRENT_UPLOADS=8
103103
# BUZZ_MEDIA_MAX_CONCURRENT_UPLOADS_PER_PUBKEY=2
104104
# BUZZ_MEDIA_UPLOADS_PER_MINUTE=30
105-
# Require Blossom t=get auth and relay membership for GET/HEAD /media/*.
106-
# Keep off until desktop/mobile/CLI clients that attach media read auth are deployed.
107-
# BUZZ_REQUIRE_MEDIA_GET_AUTH=false
108-
# Legacy alias accepted by the relay while rollout docs catch up:
109-
# BUZZ_REQUIRE_MEDIA_READ_AUTH=false
105+
# GET/HEAD /media/* always require Blossom t=get auth and relay membership.
106+
# BUZZ_REQUIRE_MEDIA_GET_AUTH and BUZZ_REQUIRE_MEDIA_READ_AUTH are no longer
107+
# read; setting either (including to false) changes nothing and the relay warns
108+
# about it at startup.
110109

111110
# -----------------------------------------------------------------------------
112111
# Ephemeral Channels (TTL testing)

‎.github/workflows/ci.yml‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -768,6 +768,19 @@ jobs:
768768
env:
769769
RELAY_URL: ws://localhost:3000
770770
GIT_CREDENTIAL_NOSTR_BIN: ${{ github.workspace }}/target/ci/git-credential-nostr
771+
- name: Media read-auth e2e
772+
# Reads require kind:24242 `t=get` auth, so these binaries are the only
773+
# coverage that a real relay rejects bare reads and honours host- and
774+
# hash-scoped tokens. They were #[ignore]d and selected by no CI job, so
775+
# the lane never ran; select it here, where MinIO and the seeded
776+
# 'localhost:3000' community already exist.
777+
# --no-fail-fast: without it cargo stops after the first failing binary,
778+
# so one broken case hides every later binary's result.
779+
run: |
780+
cargo test -p buzz-test-client --no-fail-fast --test e2e_media --test e2e_media_extended --test e2e_media_video -- --ignored --nocapture
781+
env:
782+
RELAY_URL: ws://localhost:3000
783+
RELAY_HTTP_URL: http://localhost:3000
771784
- name: Upload relay logs
772785
if: failure()
773786
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
name: Mesh Lifecycle
2+
# Relay-driven mesh lifecycle smoke: membership → signed discovery notes →
3+
# relay-derived allowlist → join → CPU inference over QUIC → stranger denied
4+
# (relay membership rejection + no routed inference, with a differential
5+
# trusted-inference health proof so a dead serve node can't fake a denial).
6+
# Runs the full Buzz "shared compute" join story with three real mesh-llm
7+
# node processes on one runner, using the Buzz relay as the control plane
8+
# (no hand-carried invite tokens). Mirrors the shape mesh-llm's own CI uses
9+
# for its two-node smokes (tiny CPU model, one runner, real QUIC mesh).
10+
11+
on:
12+
push:
13+
branches: [main]
14+
paths:
15+
- 'crates/buzz-relay/examples/mesh_*.rs'
16+
- 'crates/buzz-relay/Cargo.toml'
17+
- 'crates/buzz-admin/**'
18+
- 'crates/buzz-test-client/**'
19+
- 'crates/buzz-ws-client/**'
20+
- 'Cargo.lock'
21+
- 'desktop/src-tauri/src/mesh_llm/**'
22+
- 'scripts/ci-mesh-lifecycle-smoke.sh'
23+
- 'scripts/start-relay-for-tests.sh'
24+
- '.github/workflows/mesh-lifecycle.yml'
25+
pull_request:
26+
paths:
27+
- 'crates/buzz-relay/examples/mesh_*.rs'
28+
- 'crates/buzz-relay/Cargo.toml'
29+
- 'crates/buzz-admin/**'
30+
- 'crates/buzz-test-client/**'
31+
- 'crates/buzz-ws-client/**'
32+
- 'Cargo.lock'
33+
- 'desktop/src-tauri/src/mesh_llm/**'
34+
- 'scripts/ci-mesh-lifecycle-smoke.sh'
35+
- 'scripts/start-relay-for-tests.sh'
36+
- '.github/workflows/mesh-lifecycle.yml'
37+
workflow_dispatch:
38+
39+
concurrency:
40+
group: mesh-lifecycle-${{ github.event_name == 'pull_request' && github.ref || github.sha }}
41+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
42+
43+
env:
44+
CARGO_TERM_COLOR: always
45+
46+
jobs:
47+
lifecycle-smoke:
48+
name: Relay-Driven Mesh Lifecycle Smoke
49+
runs-on: ubuntu-24.04
50+
timeout-minutes: 45
51+
permissions:
52+
contents: read
53+
steps:
54+
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
55+
56+
- uses: cashapp/activate-hermit@cea9af7913204a965fd488637a8d1811bba2e616 # v1
57+
58+
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
59+
with:
60+
save-if: ${{ github.event_name != 'pull_request' }}
61+
62+
# The mesh-llm SDK downloads a signed native runtime (llama.cpp CPU
63+
# build) on first init, and the serve node downloads the smoke model
64+
# from HuggingFace on first run. Key on the lockfile so a mesh pin bump
65+
# rolls the runtime cache; the model ref is stable.
66+
- name: Restore mesh runtime + model caches
67+
id: mesh-caches
68+
uses: actions/cache/restore@caa296126883cff596d87d8935842f9db880ef25 # v5
69+
with:
70+
path: |
71+
~/.cache/mesh-llm/native-runtimes
72+
~/.cache/huggingface/hub
73+
key: mesh-lifecycle-${{ runner.os }}-smollm2-135m-${{ hashFiles('Cargo.lock') }}
74+
restore-keys: |
75+
mesh-lifecycle-${{ runner.os }}-smollm2-135m-
76+
77+
- name: Start integration services
78+
run: |
79+
for attempt in 1 2 3; do
80+
if docker compose up -d postgres redis minio minio-init; then
81+
break
82+
fi
83+
if [ "$attempt" -eq 3 ]; then
84+
echo "docker compose up failed after 3 attempts" >&2
85+
exit 1
86+
fi
87+
echo "docker compose up failed (attempt $attempt), retrying in $((attempt * 5))s..." >&2
88+
sleep $((attempt * 5))
89+
done
90+
91+
- name: Run relay-driven mesh lifecycle smoke
92+
run: ./scripts/ci-mesh-lifecycle-smoke.sh 2>&1 | tee /tmp/mesh-lifecycle-harness.log
93+
94+
- name: Save mesh runtime + model caches
95+
if: github.ref == 'refs/heads/main' && steps.mesh-caches.outputs.cache-hit != 'true'
96+
uses: actions/cache/save@caa296126883cff596d87d8935842f9db880ef25 # v5
97+
with:
98+
path: |
99+
~/.cache/mesh-llm/native-runtimes
100+
~/.cache/huggingface/hub
101+
key: mesh-lifecycle-${{ runner.os }}-smollm2-135m-${{ hashFiles('Cargo.lock') }}
102+
103+
- name: Upload relay + harness logs
104+
if: failure()
105+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
106+
with:
107+
name: mesh-lifecycle-logs
108+
path: |
109+
/tmp/buzz-relay.log
110+
/tmp/mesh-lifecycle-harness.log
111+
if-no-files-found: ignore

‎AGENTS.md‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,11 @@ Run `just test` for integration tests if you touched `buzz-relay`,
100100
formatting via `stage_fixed`. Pre-commit runs fix variants in parallel (Rust
101101
fmt, Tauri Rust fmt, desktop biome fix, web biome fix, mobile dart format).
102102
Auto-fixable issues are fixed and re-staged; unfixable lint issues block the
103-
commit. **Pre-push hooks** run clippy (workspace + Tauri) and fast unit tests
104-
in parallel (Rust, desktop JS, Tauri Rust, mobile Flutter) — no overlap with
105-
pre-commit. Builds are CI-only. Run `just fix-all` to auto-fix all formatting
106-
in one shot. Run `just ci` for the full local gate. Run `just hooks` to
103+
commit. **Pre-push hooks** run clippy (workspace + Tauri), desktop TypeScript
104+
typechecking (`tsc --noEmit`), and fast unit tests in parallel (Rust, desktop
105+
JS, Tauri Rust, mobile Flutter) — no overlap with pre-commit. Builds are
106+
CI-only. Run `just fix-all` to auto-fix all formatting in one shot. Run
107+
`just ci` for the full local gate. Run `just hooks` to
107108
re-install hooks after env changes. Before agents run Git or hooks, activate the
108109
repo's Hermit environment (`. ./bin/activate-hermit`); do not rewrite hook
109110
commands to compensate for an unconfigured shell `PATH`.

‎Cargo.lock‎

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎TESTING.md‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,6 @@ out of the box with `just setup` or `just relay`. Common overrides:
277277
| `REDIS_URL` | `redis://localhost:6379` | |
278278
| `BUZZ_REQUIRE_AUTH_TOKEN` | `false` | When true, REST requires NIP-98 (no `X-Pubkey` fallback) |
279279
| `BUZZ_REQUIRE_RELAY_MEMBERSHIP` | `false` | When true, only pubkeys in `relay_members` can connect |
280-
| `BUZZ_REQUIRE_MEDIA_GET_AUTH` | `false` | When true, `GET`/`HEAD /media/*` require Blossom kind 24242 `t=get` auth plus relay membership. |
281280
| `BUZZ_DRAIN_JITTER_MS` | `0` (off) | Per-connection upper bound, in ms, for the random delay before each live WebSocket gets its `1012 Service Restart` close on graceful shutdown. `0` closes every socket at once (the previous behavior). A positive value spreads closes uniformly over `[1, value]` ms to avoid a reconnect thundering herd on rolling deploys. Values above `20000` are capped to `20000` (`MAX_DRAIN_JITTER_MS`) to leave close-frame delivery headroom under the relay's 30s hard-drain timeout. Empty or whitespace-only is treated as unset (off); a non-integer fails startup loudly. |
282281
| `BUZZ_AUDIT_ENABLED` | `true` | Tamper-evident event/media audit log. Set `false`/`0`/`off` to skip its DB pool and writes. Does not disable the separate moderation audit trail. |
283282
| `BUZZ_AUTO_MIGRATE` | `false` | Opt in with `true`/`1`/`yes`/`on` to run embedded SQLx migrations on relay startup |

‎benchmarks/harbor-buzz-orchestra/src/harbor_buzz_orchestra/container_runtime.py‎

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,17 @@ async def run(
157157
)
158158
# The task arrives exactly as it would in production Buzz: a
159159
# user prompt @mentioning the orchestrator. The harness never
160-
# speaks as any agent.
160+
# speaks as any agent. The orchestrator is mentioned by pubkey,
161+
# not by name resolution: task text is untrusted payload, and any
162+
# @-token inside it (e.g. Vim's `:%normal! @a`) would otherwise
163+
# fail member resolution and kill the trial before the agent
164+
# ever saw the task. An explicit --mention demotes unresolved
165+
# @-tokens in the text to presentation-only.
161166
await self._send(
162-
trial.user, trial, f"@{orchestrator.agent_id} {instruction}"
167+
trial.user,
168+
trial,
169+
f"@{orchestrator.agent_id} {instruction}",
170+
mention=orchestrator.nostr_pubkey,
163171
)
164172
final_message = await asyncio.wait_for(
165173
self._wait_for_done(environment, orchestrator, trial, agents + infra),
@@ -519,18 +527,24 @@ async def _verify_m1_output(
519527
)
520528

521529
async def _send(
522-
self, credential: AgentCredential, trial: TrialHandle, content: str
530+
self,
531+
credential: AgentCredential,
532+
trial: TrialHandle,
533+
content: str,
534+
*,
535+
mention: str | None = None,
523536
) -> None:
524-
await self._buzz_json(
525-
credential,
526-
trial,
537+
args = [
527538
"messages",
528539
"send",
529540
"--channel",
530541
trial.channel_id,
531542
"--content",
532543
content,
533-
)
544+
]
545+
if mention is not None:
546+
args += ["--mention", mention]
547+
await self._buzz_json(credential, trial, *args)
534548

535549
async def _buzz_json(
536550
self, credential: AgentCredential, trial: TrialHandle, *args: str

‎benchmarks/harbor-buzz-orchestra/tests/test_container_runtime.py‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,37 @@ async def test_m1_output_probe_matches_grader_and_is_condition_scoped(
372372
assert bool(probed) == (condition == "M1-hello-world")
373373

374374

375+
async def test_send_mentions_by_pubkey_so_task_text_stays_inert(
376+
tmp_path, monkeypatch
377+
):
378+
"""Task text is untrusted payload: `:%normal! @a` in a task statement must
379+
not be fed to member-name resolution (it would fail and kill the trial).
380+
An explicit --mention pins delivery to the orchestrator's pubkey."""
381+
rt = runtime(tmp_path)
382+
orch = credential("orch-1", "orchestrator", "orch-model")
383+
trial = trial_handle((orch,))
384+
calls = []
385+
386+
async def buzz_json(credential, trial, *args):
387+
calls.append(args)
388+
return {}
389+
390+
monkeypatch.setattr(rt, "_buzz_json", buzz_json)
391+
392+
await rt._send(
393+
trial.user,
394+
trial,
395+
"@orch-1 run `:%normal! @a` on the file",
396+
mention=orch.nostr_pubkey,
397+
)
398+
assert calls[-1][-2:] == ("--mention", "pubkey-orch-1")
399+
400+
# Without an explicit mention the send is unchanged (name resolution).
401+
await rt._send(trial.user, trial, "plain content")
402+
assert "--mention" not in calls[-1]
403+
assert calls[-1][-2:] == ("--content", "plain content")
404+
405+
375406
async def test_wait_for_done_requires_orchestrator_authorship(tmp_path, monkeypatch):
376407
rt = runtime(tmp_path, poll_seconds=0)
377408
orch = credential("orch-1", "orchestrator", "orch-model")

0 commit comments

Comments
 (0)