mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
The "Restart required" badge reports that an agent's running config has
drifted from its spawn-time config, but never says what changed. This
ships the full feature: a typed Rust diff engine and a TS/UI layer that
renders it at every badge site.
## Rust core (spawn-snapshot diff engine)
Replaces the lossy `u64` `spawn_config_hash` with a typed
`SpawnConfigSnapshot`. The snapshot is stamped from the already-resolved
command/env/config values immediately before `spawn()`, closing the race
window where a mid-spawn config edit would suppress the badge.
`SpawnConfigSnapshot::canonical()` is the single JSON projection shared
by the badge and the diff. Drift is `to_value(stamped) !=
to_value(current)`; the diff is a generic leaf walk over those same two
values, so badge-on and diff-non-empty are structurally guaranteed.
Adding a snapshot field reaches the UI with no code change to the diff
engine — `mutation_table_covers_every_serialized_field` fails CI if a
new field arrives without a mutation row.
`eligible_restart_diff(persona_orphaned, Option<TrackedSpawnState>)`
returns the final vector — snapshot walk entries plus a synthetic
`adapter_availability` entry. It returns empty for an orphaned instance
(spawning one would fail) and for agents with no tracked spawn state
(never stamped, can never have drifted). `needs_restart =
!restart_diff.is_empty()` derives from that vector and nothing else.
Redaction policy (`policy_for(path)`) is shared by the wire diff and the
snapshot's manual `Debug` via `is_safe_to_reveal()` from
`managed_agents::env_vars` as the single authority for env-key masking:
| Policy | Paths | Rendering |
|---|---|---|
| `Text` | `system_prompt`, `team_instructions` | character counts only
|
| `MaskedBare` | `args`, `relay_url` | `••••`, no suffix |
| `MaskedSuffix` | non-allowlisted `env.*` | `••••` + last 4 chars when
longer than 8 |
| `Plain` | allowlisted `env.*` (`BUZZ_AGENT_THINKING_EFFORT`,
`BUZZ_AGENT_PROVIDER`, `BUZZ_AGENT_MODEL`, `DATABRICKS_HOST/MODEL`) and
everything else | verbatim |
Default-deny: every env key not in the explicit allowlist stays masked.
`is_safe_to_reveal()` is the single allowlist authority for both the
baked-env display and the diff.
`restart_diff` is omitted from the wire when empty
(`skip_serializing_if`).
## TypeScript / UI layer
New `restartDiff.ts` module defines `RestartDiffEntry`, `RestartChange`,
`JsonValue`; `tauri.ts` and `types.ts` re-export and add `restart_diff`
/ `restartDiff` fields (Rust omission → `restartDiff: []`).
**`RestartDiffBadge`** — hover tooltip capped at 6 entries + "and N
more", `asChild` span trigger (never inside a `<button>`), auto-restart
blurb below the diff list (on/off variant from `autoRestartEnabled`
prop; same `AUTO_RESTART_ON_BLURB` / `AUTO_RESTART_OFF_BLURB` constants
shared with the Runtime-tab banner). **`RestartDiffList`** renders the
full uncapped list for the Runtime-tab banner with `tooltip`/`inline`
presentation variants for correct foreground in both surfaces.
**`ManagedAgentRow` B4 fix** — badge moved to a sibling `div` of the row
expansion button; tooltip trigger has no `button` ancestor.
**`UnifiedAgentsSection`** — both badge sites render
`<RestartDiffBadge>` instead of a raw `<Badge>`, with
`autoRestartEnabled` threaded from `agent.autoRestartOnConfigChange`.
**Side-panel fix** — `RestartDiffBadge` rendered tab-independently in
the `ProfileSummaryView` hero area (was Runtime-tab only — root cause of
the ~50% inconsistency Will reported). Hero badge is `self-center` in
the flex column. `ProfileRuntimeTabContent` early-return checks
`needsRestart` so the banner is never dropped when all other content is
empty. Auto-restart blurb in the Runtime-tab banner uses the shared
constants.
## Wire shape
```jsonc
"restart_diff": [
{ "field": "model", "change": { "kind": "value", "before": "gpt-5", "after": "claude-4" } },
{ "field": "system_prompt", "change": { "kind": "text", "before_chars": 1234, "after_chars": 1410 } },
{ "field": "env.OPENAI_API_KEY", "change": { "kind": "masked", "before": "••••bc12", "after": "••••xyz9" } },
{ "field": "env.BUZZ_AGENT_THINKING_EFFORT", "change": { "kind": "value", "before": "medium", "after": "high" } }
]
```
`added`/`removed` occur only for dynamic-map keys; nullable struct
fields always serialize as `null`; arrays are atomic leaves (`args`,
never `args.0`).
## Tests
**Rust** — 1902 passing: snapshot mutation coverage, diff entry
serialization, allowlist-aware env masking
(`allowlisted_env_key_shows_plain_value`,
`allowlisted_env_key_is_case_insensitive`,
`non_allowlisted_env_key_stays_masked`),
`unstamped_agent_yields_no_badge_and_no_entries` (both orphan values),
`summary_without_drift_omits_restart_diff_from_the_wire`,
`unstamped_availability_is_not_drift`. Clippy clean, fmt clean.
**TypeScript** — `needs-restart-screenshots.spec.ts`: 11 E2E cases
registered in the smoke project — all three badge sites, tooltip +
keyboard focus, DOM no-button-ancestor assertion, 6+1 truncation,
uncapped Runtime list, unknown field humanisation, side-panel badge on
default Info tab, inactive/friendly-error Runtime opening path.
Consolidates [#3652](https://github.com/block/buzz/pull/3652)
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
Co-authored-by: npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7 <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
182 lines
6.5 KiB
TypeScript
182 lines
6.5 KiB
TypeScript
import { defineConfig, devices } from "@playwright/test";
|
|
|
|
export default defineConfig({
|
|
testDir: "./tests/e2e",
|
|
timeout: 30_000,
|
|
retries: process.env.CI ? 2 : 0,
|
|
workers: 1,
|
|
reporter: [
|
|
["list"],
|
|
["html", { open: "never", outputFolder: "playwright-report" }],
|
|
],
|
|
use: {
|
|
baseURL: "http://127.0.0.1:4173",
|
|
screenshot: "only-on-failure",
|
|
trace: "on-first-retry",
|
|
video: "retain-on-failure",
|
|
},
|
|
projects: [
|
|
{
|
|
name: "smoke",
|
|
testMatch: [
|
|
"**/smoke.spec.ts",
|
|
"**/onboarding-docked-cta-screenshots.spec.ts",
|
|
"**/identity-key-help.spec.ts",
|
|
"**/key-import-reveal.spec.ts",
|
|
"**/navigation.spec.ts",
|
|
"**/channels.spec.ts",
|
|
"**/channel-shared-header-backdrop.spec.ts",
|
|
"**/channel-composer-overflow.spec.ts",
|
|
"**/badge.spec.ts",
|
|
"**/channel-browser.spec.ts",
|
|
"**/channel-add-screenshots.spec.ts",
|
|
"**/add-community-screenshots.spec.ts",
|
|
"**/hosted-communities-settings-screenshots.spec.ts",
|
|
"**/invites-settings-screenshots.spec.ts",
|
|
"**/messaging.spec.ts",
|
|
"**/message-feedback-snapshots.spec.ts",
|
|
"**/custom-emoji.spec.ts",
|
|
"**/profile-custom-emoji-status.spec.ts",
|
|
"**/custom-emoji-ui.spec.ts",
|
|
"**/channel-mute.spec.ts",
|
|
"**/channel-star.spec.ts",
|
|
"**/channel-controls.spec.ts",
|
|
"**/channel-activity-popover.spec.ts",
|
|
"**/active-turn-resilience.spec.ts",
|
|
"**/profile-active-turn.spec.ts",
|
|
"**/config-bridge-screenshots.spec.ts",
|
|
"**/observer-feed-screenshots.spec.ts",
|
|
"**/core-memory-screenshots.spec.ts",
|
|
"**/activity-scope-label-screenshots.spec.ts",
|
|
"**/welcome-agent-modal-screenshots.spec.ts",
|
|
"**/local-archive-screenshots.spec.ts",
|
|
"**/voice-settings.spec.ts",
|
|
"**/agent-readiness-screenshots.spec.ts",
|
|
"**/agent-error-state-screenshots.spec.ts",
|
|
"**/edit-agent.spec.ts",
|
|
"**/doctor-cta-screenshots.spec.ts",
|
|
"**/pubkey-display-screenshots.spec.ts",
|
|
"**/file-attachment.spec.ts",
|
|
"**/image-attachment-gallery.spec.ts",
|
|
"**/composer-image-draw.spec.ts",
|
|
"**/video-attachment.spec.ts",
|
|
"**/spoiler.spec.ts",
|
|
"**/composer-link-shortcut.spec.ts",
|
|
"**/composer-selection-formatting.spec.ts",
|
|
"**/composer-tooltip-dismiss.spec.ts",
|
|
"**/mentions.spec.ts",
|
|
"**/team-mentions.spec.ts",
|
|
"**/persistent-agent-audience.spec.ts",
|
|
"**/relay-reconnect.spec.ts",
|
|
"**/relay-reconnect-affordance.spec.ts",
|
|
"**/workflows.spec.ts",
|
|
"**/identity-archive.spec.ts",
|
|
"**/identity-archive-hide.spec.ts",
|
|
"**/relay-connectivity.spec.ts",
|
|
"**/unread-pill.spec.ts",
|
|
"**/sidebar-more-unread-overlap.spec.ts",
|
|
"**/home-collapsed-top-chrome.spec.ts",
|
|
"**/top-chrome-zoom-clearance.spec.ts",
|
|
"**/thread-unread.spec.ts",
|
|
"**/workspace-rail.spec.ts",
|
|
"**/community-rail.spec.ts",
|
|
"**/boot-splash.spec.ts",
|
|
"**/thread-reply-anchor-roleplay.spec.ts",
|
|
"**/threadpane-ultrawide.spec.ts",
|
|
"**/thread-focus-mode.spec.ts",
|
|
"**/animated-avatar.spec.ts",
|
|
"**/reminders.spec.ts",
|
|
"**/reminder-click-repro.spec.ts",
|
|
"**/virtualization.spec.ts",
|
|
"**/scroll-history.spec.ts",
|
|
"**/channel-dense-second-reach.spec.ts",
|
|
"**/channel-window-mock-paging.spec.ts",
|
|
"**/live-broadcast-reply-timeline.spec.ts",
|
|
"**/markdown-parse-cache.spec.ts",
|
|
"**/overscroll-boundary.spec.ts",
|
|
"**/terminal-wheel.spec.ts",
|
|
"**/cold-switch-longtask.perf.ts",
|
|
"**/timeline-no-shift.spec.ts",
|
|
"**/human-edit-agent-content.spec.ts",
|
|
"**/empty-edit-delete.spec.ts",
|
|
"**/reaction-order.spec.ts",
|
|
"**/reaction-names.spec.ts",
|
|
"**/inbox-reactions.spec.ts",
|
|
"**/send-channel-binding.spec.ts",
|
|
"**/project-commit-detail.spec.ts",
|
|
"**/project-inbox.spec.ts",
|
|
"**/project-pr-review.spec.ts",
|
|
"**/persona-model-combobox-screenshots.spec.ts",
|
|
"**/drafts-screenshots.spec.ts",
|
|
"**/drafts-all-fix-screenshots.spec.ts",
|
|
"**/inbox-refactor-screenshots.spec.ts",
|
|
"**/buzz-theme-screenshots.spec.ts",
|
|
"**/channel-sort.spec.ts",
|
|
"**/identity-lost.spec.ts",
|
|
"**/deep-link-invite.spec.ts",
|
|
"**/invite-link-copy.spec.ts",
|
|
"**/global-agent-config-screenshots.spec.ts",
|
|
"**/doctor-states.spec.ts",
|
|
"**/onboarding-avatar-skip.spec.ts",
|
|
"**/onboarding-backup.spec.ts",
|
|
"**/onboarding-agent-defaults.spec.ts",
|
|
"**/nostr-bind.spec.ts",
|
|
"**/mobile-pairing-qr.spec.ts",
|
|
"**/profile-nsec-reveal.spec.ts",
|
|
"**/profile-backup-settings.spec.ts",
|
|
"**/signout-confirmation.spec.ts",
|
|
"**/agent-provider-dropdowns.spec.ts",
|
|
"**/agent-lifecycle-feedback.spec.ts",
|
|
"**/agent-access-warning.spec.ts",
|
|
"**/edit-agent-run-on.spec.ts",
|
|
"**/inbox-live-update.spec.ts",
|
|
"**/mesh-compute.spec.ts",
|
|
"**/observer-archive-policy.spec.ts",
|
|
"**/harness-management.spec.ts",
|
|
"**/harness-catalog-screenshots.spec.ts",
|
|
"**/inline-custom-harness.spec.ts",
|
|
"**/where-to-run-config.spec.ts",
|
|
"**/huddle-transcription.spec.ts",
|
|
"**/agent-numeric-tuning.spec.ts",
|
|
"**/needs-restart-screenshots.spec.ts",
|
|
],
|
|
use: {
|
|
...devices["Desktop Chrome"],
|
|
},
|
|
},
|
|
{
|
|
name: "integration",
|
|
testMatch: [
|
|
"**/agents.spec.ts",
|
|
"**/agent-snapshot-recipient.spec.ts",
|
|
"**/onboarding.spec.ts",
|
|
"**/stream.spec.ts",
|
|
"**/integration.spec.ts",
|
|
"**/dm-double-notification.spec.ts",
|
|
"**/profile.spec.ts",
|
|
"**/sidebar.spec.ts",
|
|
"**/sidebar-relay-card.spec.ts",
|
|
"**/tokens.spec.ts",
|
|
"**/persona-env-vars.spec.ts",
|
|
"**/persona-sync.spec.ts",
|
|
"**/team-snapshot.spec.ts",
|
|
"**/agents-everywhere.live.spec.ts",
|
|
"**/relay-restart.live.spec.ts",
|
|
"**/parity-ancestor-island.spec.ts",
|
|
],
|
|
use: {
|
|
...devices["Desktop Chrome"],
|
|
},
|
|
expect: {
|
|
timeout: process.env.CI ? 15_000 : 10_000,
|
|
},
|
|
},
|
|
],
|
|
webServer: {
|
|
command: "python3 -m http.server 4173 -d dist",
|
|
cwd: ".",
|
|
reuseExistingServer: !process.env.CI,
|
|
url: "http://127.0.0.1:4173",
|
|
},
|
|
});
|