Skip to content

fix(local-archive): default both archive settings to enabled - #4750

Merged
wpfleger96 merged 7 commits into
mainfrom
will/archive-defaults-enabled
Aug 4, 2026
Merged

fix(local-archive): default both archive settings to enabled#4750
wpfleger96 merged 7 commits into
mainfrom
will/archive-defaults-enabled

Conversation

@wpfleger96

Copy link
Copy Markdown
Member

Overview

Both local archive settings — "Archive my agents' observer frames" (kind 24200) and "Archive my agents' turn metrics" (kind 44200) — previously defaulted to OFF in OSS builds, controlled by build-time env vars. This had an irreversible cost: observer frames are ephemeral (not stored by the relay), so any missed events are permanently unrecoverable. This PR makes both settings default to enabled for all builds and removes the build-time flag machinery entirely.

What changed

Rust

  • observer_archive_default_enabled() — returns true unconditionally; removed option_env!("BUZZ_DESKTOP_BUILD_OBSERVER_ARCHIVE_DEFAULT") check and nest_is_dev() runtime fallback.
  • agent_metric_archive_default_enabled() — returns true unconditionally; removed option_env!("BUZZ_DESKTOP_BUILD_AGENT_METRIC_ARCHIVE_DEFAULT") check and its OSS-build test.
  • build.rs — removed both rerun-if-env-changed declarations (BUZZ_BUILD_OBSERVER_ARCHIVE_DEFAULT, BUZZ_BUILD_AGENT_METRIC_ARCHIVE_DEFAULT) and the two baked-env emitting blocks.

Build / CI

  • Justfile — removed desktop-tauri-test-compiled-flags recipe (the dual-compile test machinery).
  • .github/workflows/ci.yml — removed the "Desktop Tauri compiled-flag verification" CI step.

TypeScript

  • useObserverArchiveSeed.ts — removed observerArchiveDefaultEnabled dep from ObserverArchiveSeedDeps and the policyOn gate in reconcileObserverArchive; the function now unconditionally calls mergeSaveSubscriptionKinds.
  • useAgentMetricArchiveSeed.ts — removed agentMetricArchiveDefaultEnabled dep from AgentMetricArchiveSeedDeps and the defaultOn flag-check path in maybeSeed; the hasExplicitChoice guard is preserved as the sole gate against re-seeding.
  • LocalArchiveSettingsCard.tsx — removed policy prop, observerPolicy state, and observerArchiveDefaultEnabled fetch from ObserverArchiveSection; toggle is now always enabled (just toggling disables it); removed the stale "Always on for internal builds" copy branch; removed the observerPolicy !== false guard from handleObserverToggle.
  • tauriArchive.ts — updated JSDoc on both default-enabled functions to reflect always-true.
  • e2eBridge.ts — changed both mock defaults from ?? false to ?? true so E2E tests without an explicit mock override exercise the real default behavior.

Tests

  • useObserverArchiveSeed.test.mjs — replaced policyOn dep with direct merge dep; updated test_oss_policy_off_no_mergetest_reconcile_always_seeds_24200; all cancellation, identity-switch, and ordering tests adapted.
  • useAgentMetricArchiveSeed.test.mjs — removed defaultOn dep and test_oss_build_does_not_seed; updated test_internal_build_unset_seeds_*test_default_enabled_*; hasExplicitChoice guard tests unchanged.

Preservation of explicit opt-outs

Users who have previously toggled the setting off are unaffected:

  • useAgentMetricArchiveSeed skips seeding when hasExplicitChoice(pubkey) returns true (localStorage-persisted per identity).
  • Observer archive reconciliation now unconditionally calls mergeSaveSubscriptionKinds, but a user who already deleted the subscription can turn it off via the Settings toggle, which calls removeSaveSubscriptionKind — this is the existing explicit opt-out path, and the toggle is now always enabled (not locked by a policy flag).

Result

  • No BUZZ_BUILD_*_ARCHIVE_DEFAULT / BUZZ_DESKTOP_BUILD_*_ARCHIVE_DEFAULT references remain outside CHANGELOG/history.
  • Desktop node tests: 4168 pass, 0 fail.
  • just desktop-tauri-check: clean.
  • just desktop-tauri-test: all pass.

Both local archive settings (observer frames kind 24200 and agent turn
metrics kind 44200) previously defaulted to OFF in OSS builds via
build-time env vars, silently losing data for users who didn't discover
the Settings toggle. Observer frames are ephemeral (not stored by the
relay), so any missed events are permanently unrecoverable.

Make both defaults unconditionally true:
- observer_archive_default_enabled() and
  agent_metric_archive_default_enabled() now return true without any
  option_env! check.
- Remove BUZZ_BUILD_OBSERVER_ARCHIVE_DEFAULT and
  BUZZ_BUILD_AGENT_METRIC_ARCHIVE_DEFAULT from build.rs (rerun-if-env
  declarations and baked-env blocks).
- Remove the desktop-tauri-test-compiled-flags Justfile recipe and its
  CI step — the dual-compile test machinery has no purpose now.

Existing explicit opt-outs are preserved: the hasExplicitChoice guard
in useAgentMetricArchiveSeed and the subscription reconciliation
in useObserverArchiveSeed only run for identities that have never
made a choice.

Simplify the TS seed hooks to remove the policy-flag dep entirely.
Update ObserverArchiveSection to remove the policy prop, enable the
toggle unconditionally, and drop the stale 'Always on for internal
builds' copy. Update e2e mock defaults from false to true. Update
both test suites to match.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
@wpfleger96
wpfleger96 requested a review from a team as a code owner August 4, 2026 17:11
npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7 and others added 6 commits August 4, 2026 13:25
reconcileObserverArchive previously merged kind 24200 unconditionally
on every startup. Toggling the observer archive off then restarting
caused reconciliation to re-enable it silently.

Add observerArchivePreference.ts (mirrors agentMetricArchivePreference)
with hasExplicitObserverArchiveChoice / getExplicitObserverArchiveChoice /
setExplicitObserverArchiveChoice stored in localStorage, keyed by pubkey.

Gate reconcileObserverArchive: skip merge when an explicit opt-out is
stored. Persist an explicit enabled choice on first-run seeding so the
guard is consistent from first startup onward.

Wire setExplicitObserverArchiveChoice into handleObserverToggle (both
toggle-on and toggle-off), matching the existing metric path.

Tests: four new cases covering explicit opt-out, explicit opt-in,
first-run seeding + choice persistence, and the toggle-off-then-restart
failure mode.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
- Remove dead nest_is_dev() / path_is_dev_nest() helpers and their four
  orphaned tests (no caller outside nest.rs since the build-flag code was
  dropped in the prior commit)
- Collapse observer preference storage to a single tri-state read
  (readExplicitObserverArchiveChoice → true | false | "unset"); storage
  errors now fail-closed (return true, skip merge) matching the metric path
- Update ObserverArchiveSeedDeps interface: replace hasExplicitChoice +
  getExplicitChoice with single readExplicitChoice; reconcileObserverArchive
  skips merge for any non-"unset" result
- Update useObserverArchiveSeed.test.mjs: migrate all makeDeps factories and
  inline deps objects to new interface; fix test that expected re-merge on
  already-seeded opt-in (wrong under new model); add storage-error path test
- Rewrite observer-archive-policy.spec.ts around the default-on model: drop
  internal/OSS/policy-pending/error cases; add fresh-identity-defaults-on,
  toggle-off-persists, toggle-on-off-cycle, reconciliation-gate, and
  fresh-install-seeding tests
- Remove stale bridge seams: observerArchiveDefaultEnabled,
  observerArchiveDefaultEnabledDelayMs, deferObserverArchiveDefaultEnabled,
  observerArchiveDefaultEnabledError from bridge.ts types,
  e2eBridge.ts mock config type, window global declarations,
  deferredObserverArchivePolicyQueue let, install-reset block, and
  observer_archive_default_enabled IPC case

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
…model

The two failing smoke tests encoded the old default-off assumption:
seeding saveSubscriptions:[] and expecting the toggle OFF. Under the
new model, empty subscriptions + no recorded choice = seed 24200 (ON).

observer-archive-policy.spec.ts:
- explicit-opt-out test: seed the identity-scoped localStorage key
  (buzz:observer-archive-default-seeded:<pubkey> = "0") before
  navigation so reconciliation honours the stored choice and leaves
  the toggle unchecked.
- no-subscriptions test: invert premise — assert default-on seeding
  (toggle checked) first, then exercise OFF removal and ON re-creation.
Spec result: 6 passed, 0 failed (pnpm build:e2e + playwright smoke).

Stale comments updated:
- AppShell.tsx: replace "unconditionally repairs on internal builds"
  with build-agnostic description (default-on seeding / opt-out no-op).
- e2eBridge.ts: replace "fresh-internal-repair" / "OSS toggle" framing
  with default-on seeding and toggle ON/OFF language.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
…-enabled

* origin/main:
  Dock Buzz Term within channel workspace (#4724)
  perf(relay): index channel-id lookups and skip trace-only reads (#4647)
  fix(agents): canonicalize stale persona harness pins (#4631)
  Refine community invite links (#4734)

Signed-off-by: npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7 <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
The deleted desktop-tauri-test-compiled-flags recipe covered two flags:
observer-archive (now removed) and auto-connect (still present). Removing
the full recipe orphaned the compiled_flag_matches_expected test in
identity.rs with no invoker.

Restore a slimmed recipe covering only BUZZ_BUILD_AUTO_CONNECT_DEFAULT_RELAY:
- Clean state: unset flag, expect false
- Internal state: flag set, expect true
build.rs rerun-if-env-changed triggers real recompilation between passes.

Restore the corresponding Desktop Tauri compiled-flag verification step
in ci.yml so the coverage runs in CI on every Desktop Core build.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
…-enabled

* origin/main:
  fix(desktop): close reconnect gaps that previously required CMD+R (#4737)

Signed-off-by: npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7 <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
@wpfleger96
wpfleger96 merged commit 5179726 into main Aug 4, 2026
26 checks passed
@wpfleger96
wpfleger96 deleted the will/archive-defaults-enabled branch August 4, 2026 20:02
loganj pushed a commit that referenced this pull request Aug 4, 2026
…links

* origin/main:
  fix(desktop): integer-align custom reaction emoji (#4779)
  Polish Huddle voice controls (#4694)
  fix(local-archive): default both archive settings to enabled (#4750)
  fix(mobile): stop oversized read-state retry loop (#4595)

Signed-off-by: npub13n66s06epmqf2kc3v373ez8hj65cuzyvxzjf93vwpervxqn2u7jq2qd9je <8cf5a83f590ec0955b11647d1c88f796a98e088c30a492c58e0e46c3026ae7a4@buzz.block.builderlab.xyz>
wpfleger96 added a commit that referenced this pull request Aug 4, 2026
* commit 'ce3cf3cd2': (76 commits)
  Polish Huddle voice controls (#4694)
  fix(local-archive): default both archive settings to enabled (#4750)
  fix(mobile): stop oversized read-state retry loop (#4595)
  fix(desktop): close reconnect gaps that previously required CMD+R (#4737)
  Dock Buzz Term within channel workspace (#4724)
  perf(relay): index channel-id lookups and skip trace-only reads (#4647)
  fix(agents): canonicalize stale persona harness pins (#4631)
  Refine community invite links (#4734)
  feat(desktop): persist sidebar observed-unread across webview reload (#3976)
  feat(desktop): surface config diff in restart-required badge (#3637)
  Polish sidebar unread hierarchy (#4573)
  fix(desktop): show cached display names on startup (#3317)
  docs(acp): explain per-channel session model in base prompt (#4729)
  docs(nip-am): normative amendment — cache SHOULD/MUST + pricingIdentity + consumer cost guidance (#4632)
  Remove blur from Welcome composer guidance (#4691)
  Refine desktop timeline activity presentation (#4582)
  Defer desktop media uploads until send (#4522)
  fix(desktop): stop clipping focus ring on channel intro action cards (#2392) (#4374)
  Polish mobile inbox and media flows (#4512)
  feat: ship Buzz Term (#4347)
  ...

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant