Skip to content

Navigation Menu

Sign in
Sign up

feat(agent-metrics): add encrypted usage snapshots - #7443

Open
timmstudio wants to merge 6 commits into
block:main from
timmstudio:victra/context-core
Open

feat(agent-metrics): add encrypted usage snapshots #7443
timmstudio wants to merge 6 commits into
block:main from
timmstudio:victra/context-core

Conversation

@timmstudio

@timmstudio timmstudio commented Sep 7, 2026

Copy link
Copy Markdown

Summary

  • define and validate encrypted NIP-AM kind 44200 agent usage snapshots
  • publish context and provider-window usage from local and remote agent paths
  • archive and query snapshots with exact agent, channel, and thread scope
  • show compact usage rings and details on desktop and Flutter mobile
  • bound payloads, provider windows, known agents, history pagination, and caches

Changes

  • adds a backward-compatible NIP-AM payload contract with per-field timestamps
  • validates NIP-01 event identity/signature, exact p/agent tags, owner/agent binding, forbidden h tags, and encrypted payload sizes
  • adds buzz metrics publish for cloud or external producers
  • reconstructs scoped mobile history across inclusive same-second pages without silently skipping ties
  • preserves partial snapshots with deterministic (timestamp, event id) conflict resolution
  • isolates trust/history state across identity and relay changes and bounds remembered scopes
  • filters desktop archive candidates in SQL with at most 64 agents and eight newest candidates per agent
  • uses profile/local agent names with pubkeys only as fallback
  • distinguishes unknown, stale, unavailable, and fresh states without drawing a false 100% ring
  • shows the highest known utilization across context and arbitrary provider windows

Testing

  • cargo fmt --all -- --check
  • cargo test -p buzz-core -p buzz-agent -p buzz-acp -p buzz-cli
  • cargo clippy -p buzz-core -p buzz-agent -p buzz-acp -p buzz-cli --all-targets -- -D warnings
  • cancel/usage race regression repeated 10/10 successfully
  • isolated Tauri archive modules compiled and executed against in-memory SQLite
  • dart format --output=none --set-exit-if-changed lib test
  • flutter analyze
  • flutter test — 2,129 passed
  • pnpm check
  • pnpm typecheck
  • pnpm test — 6,463 passed
  • focused desktop status tests — 13 passed
  • pnpm build
  • differential file-size, whitespace, DCO, forbidden-name, and added-line secret scans
  • independent security/correctness review; all findings closed and re-reviewed

Screenshots / recording

Not attached from this Linux build host: GTK/WebKit development libraries are unavailable, so the Tauri application cannot be launched here. Desktop rendering states and mobile interactions are covered by automated component/widget tests; visual confirmation can be added from a supported development machine.

Local environment limitation

The complete native Tauri application could not be compiled or launched because glib-2.0, gtk+-3.0, and webkit2gtk-4.1 development packages are unavailable. To validate the changed native archive code, agent_usage.rs and metric_store.rs were compiled in a minimal Rust harness and executed against in-memory SQLite, confirming the 64-agent request limit, eight-candidate fallback bound, newest-first ordering, and SQL-side agent filtering. Repository CI remains responsible for the full native matrix.

Victra added 6 commits September 6, 2026 06:40
Signed-off-by: Victra <victra@timmstudio.com>
Signed-off-by: Victra <victra@timmstudio.com>
Subscribes to kind:44200 agent turn metrics (NIP-AM), decrypts them
via the existing NIP-44 helper, and renders a ring + detail sheet on
bot rows in the members sheet, mirroring the desktop agent status
feature added in fe526bd.
Signed-off-by: Victra <victra@timmstudio.com>
Signed-off-by: Victra <victra@timmstudio.com>
Signed-off-by: Victra <victra@timmstudio.com>
Validate encrypted event envelopes consistently, bound archive and mobile history work, and make snapshot merging deterministic across desktop and mobile. Close review findings around identity isolation, pagination ties, unavailable states, and cancellation-test ordering.
Signed-off-by: Victra <victra@timmstudio.com>
timmstudio requested a review from a team as a code owner September 7, 2026 05:13

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown

🔐 Codex Security Review

Status: review required for the current range.

The current range is 3c7f288c60d67df78577b237e27c3dfc8831aaa1...4a3d36300265ecbf8f4ee4c869f04b8ec011ec5b.
A new review must complete for this exact range. When manual authorization
is required, a Block organization member must comment exactly
@buzz-security-review 4a3d36300265ecbf8f4ee4c869f04b8ec011ec5b to authorize a new review.
Any previous review applies only to its recorded range.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /