Skip to content

Commit 067ba4e

Browse files
author
Michael Feth
committed
Merge remote-tracking branch 'fork/fix/agent-reliability-audit-fixes' into fix/agent-reliability-audit-fixes
2 parents 1264eba + 6c7f1ad commit 067ba4e

246 files changed

Lines changed: 21398 additions & 3890 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.

‎.github/workflows/release.yml‎

Lines changed: 1 addition & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -775,63 +775,6 @@ jobs:
775775
${{ steps.artifacts.outputs.exe }}
776776
${{ steps.artifacts.outputs.sig }}
777777
778-
desktop-release-smoke:
779-
name: Desktop release smoke
780-
if: github.repository == 'block/buzz'
781-
runs-on: ubuntu-latest
782-
needs: setup
783-
timeout-minutes: 20
784-
permissions:
785-
contents: read
786-
env:
787-
PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/.cache/ms-playwright
788-
steps:
789-
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
790-
with:
791-
ref: ${{ needs.setup.outputs.source_sha }}
792-
persist-credentials: false
793-
- uses: cashapp/activate-hermit@cea9af7913204a965fd488637a8d1811bba2e616 # v1
794-
- name: Install desktop dependencies
795-
run: just desktop-install-ci
796-
- name: Get Playwright version
797-
id: pw-version
798-
run: echo "version=$(cd desktop && node -e \"console.log(require('@playwright/test/package.json').version)\")" >> "$GITHUB_OUTPUT"
799-
- name: Restore Playwright browser cache
800-
id: playwright-cache
801-
uses: actions/cache/restore@caa296126883cff596d87d8935842f9db880ef25 # v5
802-
with:
803-
path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }}
804-
key: playwright-${{ runner.os }}-${{ steps.pw-version.outputs.version }}
805-
- name: Install Playwright Chromium
806-
if: steps.playwright-cache.outputs.cache-hit != 'true'
807-
run: cd desktop && pnpm exec playwright install chromium
808-
- name: Install Playwright system dependencies
809-
run: cd desktop && pnpm exec playwright install-deps chromium
810-
- name: Save Playwright browser cache
811-
if: steps.playwright-cache.outputs.cache-hit != 'true'
812-
uses: actions/cache/save@caa296126883cff596d87d8935842f9db880ef25 # v5
813-
with:
814-
path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }}
815-
key: playwright-${{ runner.os }}-${{ steps.pw-version.outputs.version }}
816-
- name: Build test relay
817-
run: cargo build --profile ci -p buzz-relay
818-
- name: Run deterministic correctness smoke
819-
env:
820-
BUZZ_E2E_RELAY_BIN: ${{ github.workspace }}/target/ci/buzz-relay
821-
BUZZ_RELEASE_SMOKE_ARTIFACT_DIR: ${{ github.workspace }}/release-smoke-artifacts
822-
run: just desktop-release-smoke
823-
- name: Upload release-smoke diagnostics
824-
if: always()
825-
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
826-
with:
827-
name: desktop-release-smoke
828-
path: |
829-
release-smoke-artifacts
830-
desktop/test-results
831-
desktop/playwright-release-smoke-report
832-
if-no-files-found: warn
833-
retention-days: 14
834-
835778
assemble-manifest:
836779
name: Assemble multi-platform latest.json
837780
# Only the tag-bound setup path can reach this job.
@@ -842,10 +785,9 @@ jobs:
842785
needs.release-macos-x64.result == 'success' &&
843786
needs.release-linux.result == 'success' &&
844787
needs.release-windows.result == 'success' &&
845-
needs.desktop-release-smoke.result == 'success' &&
846788
github.ref == format('refs/tags/desktop-v{0}', needs.setup.outputs.version)
847789
runs-on: ubuntu-latest
848-
needs: [setup, release, release-macos-x64, release-linux, release-windows, desktop-release-smoke]
790+
needs: [setup, release, release-macos-x64, release-linux, release-windows]
849791
timeout-minutes: 10
850792
permissions:
851793
contents: write

‎.release/desktop-candidate.json‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"schema": 2,
3-
"version": "0.5.11",
4-
"base_sha": "4749bc7be3cdb78c2db4ce4864775ba7ab60b4cc",
5-
"previous_tag": "desktop-v0.5.10",
6-
"previous_base_sha": "f35930104bcbdb1332ff13735214ecb9fce1fc7b",
7-
"previous_merge_sha": "4b3570671eb2786594267758af18784ac6e82972",
8-
"tag": "desktop-v0.5.11",
9-
"commit_count": 16
3+
"version": "0.5.14",
4+
"base_sha": "1b3dbcaaea882eeea90359c1db02e306d2f4f50a",
5+
"previous_tag": "desktop-v0.5.13",
6+
"previous_base_sha": "09768100ec3420f0aa7cd278bd00fe0baab5de8d",
7+
"previous_merge_sha": "51beba603886d34e751349d12b33c0c5aeb92c28",
8+
"tag": "desktop-v0.5.14",
9+
"commit_count": 1
1010
}

‎AGENTS.md‎

Lines changed: 37 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,9 @@ See CONTRIBUTING.md for full setup details and dependency requirements.
109109

110110
## Quality Gates
111111

112-
Run `just ci` before every PR — it runs `fmt` + `clippy` + desktop lint +
113-
unit tests + builds. Clippy passing does not mean fmt passes; run both.
112+
Run `just ci` before every PR — it runs repository-wide formatting, lint,
113+
and static checks; Rust, Tauri, desktop, and mobile tests; and desktop and web
114+
builds. Clippy passing does not mean fmt passes; run both.
114115

115116
Run `just test` for integration tests if you touched `buzz-relay`,
116117
`buzz-db`, or `buzz-auth` — these require a running Postgres and Redis.
@@ -204,7 +205,7 @@ or invoke with the full path.
204205
thread. To read the linked thread:
205206

206207
```bash
207-
buzz messages thread --channel <uuid> --event <hex> --format compact
208+
buzz --format compact messages thread --channel <uuid> --event <hex>
208209
```
209210

210211
Extract `channel` and `id` from the URL query parameters. The optional
@@ -235,7 +236,9 @@ E2E tests live in `crates/buzz-test-client/tests/`:
235236
- `e2e_media_extended.rs` — extended media scenarios
236237
- `e2e_nostr_interop.rs` — Nostr interop (NIP-50 search, NIP-10 threads, NIP-17 gift wraps)
237238

238-
Desktop E2E: `cd desktop && pnpm exec playwright test`
239+
Desktop E2E: `cd desktop && pnpm test:e2e:smoke` for mock-bridge smoke
240+
coverage, or `pnpm test:e2e:integration` for relay-backed coverage. These
241+
scripts build the required E2E bridge before running Playwright.
239242

240243
See [TESTING.md](TESTING.md) for the full multi-agent E2E guide.
241244

@@ -446,11 +449,10 @@ description. See [PR #803](https://github.com/block/buzz/pull/803).
446449

447450
1. **Kind `39000` for channel metadata, not `41`** — kind 41 is NIP-01 (unused). All kinds defined in `buzz-core/src/kind.rs`.
448451
2. **Relay queries must specify `kinds`** — omitting `kinds` triggers the p-gate (403). Always include explicit kind filters.
449-
3. **`messages search` must include `--kinds`** — an open-ended search (no kinds) hits the relay p-gate and returns 403. Pass at least `--kinds 9,45001,45003` to scope the query.
452+
3. **`messages search` chooses its own supported kinds** — do not add a `--kinds` option; the current command does not accept one. This differs from raw relay filters, which still need explicit kinds.
450453
4. **Worktrees: `cd` in the same command** — shell CWD doesn't persist between tool calls. Use `cd /path && cargo build` as one command.
451454
5. **Desktop crate excluded from root workspace** — `cargo test` at repo root does NOT run desktop tests. Use `cargo test --manifest-path desktop/src-tauri/Cargo.toml` explicitly.
452-
6. **Desktop Tauri fmt fails in worktrees and blocks commits** — the pre-commit hook runs `just desktop-tauri-fmt`, which fails in git worktrees because `cargo fmt` resolves workspace paths relative to the worktree root. Run `just desktop-tauri-fmt` from the main checkout to apply the fix, then re-stage and commit. CI is unaffected.
453-
7. **React render perf: `React.memo` is all-or-nothing** — it only skips a re-render when *every* prop is reference-stable; one unstable prop (inline arrow/JSX, or a hook returning a fresh `{}`/`[]`/`Map` each render) defeats it. Two repeat offenders: (a) React Query results (`useMutation`/`useQuery`) are a **new object each render** — depend on the stable method (`mutation.mutateAsync`), not the object; (b) derived `Map`/array state that recomputes on a version bump — wrap in a content-equality ref cache (`shared/hooks/useStableReference.ts`). When chasing interaction lag, **measure with DevTools closed and no perf probes** (an open Web Inspector + per-keystroke `console.log` inflate the numbers), and isolate by removing one suspect at a time rather than guessing.
455+
6. **React render perf: `React.memo` is all-or-nothing** — it only skips a re-render when *every* prop is reference-stable; one unstable prop (inline arrow/JSX, or a hook returning a fresh `{}`/`[]`/`Map` each render) defeats it. Two repeat offenders: (a) React Query results (`useMutation`/`useQuery`) are a **new object each render** — depend on the stable method (`mutation.mutateAsync`), not the object; (b) derived `Map`/array state that recomputes on a version bump — wrap in a content-equality ref cache (`shared/hooks/useStableReference.ts`). When chasing interaction lag, **measure with DevTools closed and no perf probes** (an open Web Inspector + per-keystroke `console.log` inflate the numbers), and isolate by removing one suspect at a time rather than guessing.
454456

455457
---
456458

@@ -511,27 +513,12 @@ class instances, cached promises) survive across remounts. Every community-scope
511513
singleton needs a reset function wired into `resetCommunityState()` in
512514
`desktop/src/features/communities/useCommunityInit.ts`.
513515

514-
Current singletons that are reset on relay boundary changes (same-relay
515-
reconnects preserve pending avatar verification work):
516-
- `relayClient.disconnect()` — WebSocket teardown + promise rejection
517-
- `resetRateLimitGate()` — clears any active rate-limit window from the old relay
518-
- `clearAllDrafts()` — message draft cache
519-
- `resetAgentObserverStore()` — agent observer relay store
520-
- `resetActiveAgentTurnsStore()` — active agent turn timers
521-
- `resetAgentWorkingSignal()` — agent working indicator signal
522-
- `resetAvatarProfileSync()` — pending verified-avatar profile writes
523-
- `resetAvatarPresentations()` — avatar probes, previews, and Retry toasts
524-
- `resetSidebarRelayConnectionCardState()` — sidebar relay card dismiss state
525-
- `resetMediaCaches()` — proxy port and relay origin caches
526-
- `resetVideoPlayerState()` — video player singleton
527-
- `resetRenderScopedReactionHydration()` — reaction hydration cache
528-
- `clearSearchHitEventCache()` — search result event cache
529-
- `clearMarkdownNodeCache()` — markdown parse-node cache
530-
- `resetLinkPreviewTitleCache()` — link preview title cache (Buzz entity titles come from relay events)
531-
532-
**If you add a new module-level cache, Map, or class instance that holds
533-
community-scoped data, you must add its reset to `resetCommunityState()`.**
534-
Failure to do so causes data from the old community to leak into the new one.
516+
`resetCommunityState()` is the canonical inventory of community-scoped
517+
singletons. **If you add a new module-level cache, Map, or class instance that
518+
holds community-scoped data, add its reset there in the same change.** Failure
519+
to do so causes data from the old community to leak into the new one. Avoid
520+
duplicating its complete reset list here; the implementation is the source of
521+
truth.
535522

536523
Key files:
537524
- `desktop/src/app/App.tsx` — community key, init gate, remount boundary
@@ -556,9 +543,23 @@ The mobile app lives in `mobile/` — a Flutter app using Riverpod + Hooks.
556543

557544
- **NEVER use `StatefulWidget`** — favor Riverpod for state and always use
558545
`HookConsumerWidget` or `ConsumerWidget` with `flutter_hooks` for local state.
559-
- **NEVER run `flutter run`, `flutter build`, `flutter clean`, or
560-
`flutter upgrade`** — only `flutter test`, `flutter analyze`, and
561-
`dart format` are safe for agents to run.
546+
- Agents may build and run the Flutter app when it materially helps implement,
547+
debug, or validate mobile changes. Prefer the smallest relevant command and
548+
reuse an already-running simulator/emulator and the app's configured staging
549+
or production community when that is sufficient. Do not start or rebuild
550+
local relay services unless the task specifically requires relay-side or
551+
isolated integration behavior.
552+
- For iOS runtime validation, prefer `just mobile-dev`; it applies the
553+
worktree-specific debug identity and runs `flutter run`. Direct `flutter run`
554+
or IDE workflows are also allowed. Use `just mobile-build-android` only when
555+
an APK build is relevant to the task.
556+
- Do not rebuild, reinstall, or relaunch merely for ceremony. Preserve Flutter's
557+
incremental build cache and use hot reload/restart where appropriate. Use
558+
`flutter clean` only when stale build artifacts are a credible cause. Run
559+
`flutter upgrade` only when the task explicitly requires a toolchain change.
560+
- For user-visible or integration changes, exercise the affected workflow in a
561+
real app when practical and report the device/simulator, connected community,
562+
and workflow actually tested.
562563
- **Do NOT use `print()`** — use `debugPrint()` or structured logging.
563564
- Prefer `context.colors` and `context.textTheme` (via theme extensions)
564565
over raw `Theme.of(context)` calls.
@@ -584,12 +585,16 @@ flutter test
584585

585586
Or from repo root: `just mobile-fmt` (auto-fix), `just mobile-check` (lint + fmt check), `just mobile-test` (tests).
586587

587-
To run the app locally (starts Docker, relay, iOS simulator automatically):
588+
To run the app locally with a worktree-specific debug identity and a
589+
started or reused iOS Simulator:
588590

589591
```bash
590592
just mobile-dev
591593
```
592594

595+
This runs `flutter run` against the app's configured community; it does not
596+
start Docker or local relay services.
597+
593598
When run from a git worktree, `just mobile-dev` (and `just
594599
mobile-build-android`) give the debug build a per-worktree app identifier
595600
(keyed to the worktree directory name) and a branch-labelled app name via

0 commit comments

Comments
 (0)