Skip to content

feat(internal): merge Pi canary, bounded agents, and usage UI - #1

Merged
malkovitc merged 19 commits into
mainfrom
local/linza-patched-pi-0.5.18
Aug 25, 2026
Merged

malkovitc merged 19 commits into
mainfrom
local/linza-patched-pi-0.5.18

Conversation

@malkovitc

Copy link
Copy Markdown
Owner

Internal downstream patch

Merges the production-proven Pi ACP canary, opt-in Codex efficiency controls, empty-message hardening, and NIP-AM agent-usage UI into the fork only. This is not intended for upstream block/buzz.

Review feedback resolved

  • pooled adapter now supports multiple ACP sessions;
  • every inbound task gets a fresh Pi SDK process/session;
  • BUZZ_PRIVATE_KEY and auth tag stay in the trusted adapter; Pi publications use a typed parent-side broker;
  • non-event initial/heartbeat prompts work without reply routing;
  • rejected provider prompts propagate as ACP errors;
  • forum reply kind is inferred by the hardened Buzz CLI parent lookup;
  • Pi adapter has an install command and strict minimum 0.2.0 version gate;
  • autonomous session/history bounds remain opt-in (0/12 product defaults preserved).

Checks

  • Pi Node tests: 20/20
  • Biome: PASS
  • Rust config/ACP metadata tests: PASS
  • Desktop Pi catalog/version tests: PASS
  • Forum-kind inference test: PASS
  • rustfmt and git diff --check: PASS
  • prior Caliper Pi canary + Codex rollback + packaged smoke: PASS

Pi remains canary-only; no fleet-wide runtime switch.

malkovitc and others added 17 commits August 25, 2026 12:43
Signed-off-by: evgeniy.chernomortsev <j.malkovitc@gmail.com>
Signed-off-by: evgeniy.chernomortsev <j.malkovitc@gmail.com>
Signed-off-by: evgeniy.chernomortsev <j.malkovitc@gmail.com>
Signed-off-by: evgeniy.chernomortsev <j.malkovitc@gmail.com>
Signed-off-by: evgeniy.chernomortsev <j.malkovitc@gmail.com>
Signed-off-by: evgeniy.chernomortsev <j.malkovitc@gmail.com>
Signed-off-by: evgeniy.chernomortsev <j.malkovitc@gmail.com>
Signed-off-by: evgeniy.chernomortsev <j.malkovitc@gmail.com>
Signed-off-by: evgeniy.chernomortsev <j.malkovitc@gmail.com>
Signed-off-by: evgeniy.chernomortsev <j.malkovitc@gmail.com>
Signed-off-by: evgeniy.chernomortsev <j.malkovitc@gmail.com>
Signed-off-by: evgeniy.chernomortsev <j.malkovitc@gmail.com>
Adds the agent-usage UI feature on top of the merged NIP-AM backend.

- `desktop/src/features/agent-usage/`: daily bars chart, 7/30-day range
  tabs, focused agent view with caveats, hooks, and lib utilities. All
  state is driven by the `get_agent_usage_series` Tauri command.
- Profile panel: usage ingress row + focused view wired into agent
  profiles; gated on owner-scoped visibility (`viewerIsOwner && isBot`).
- `AgentsView`: agent-usage overview section.
- `AgentsScreen`/`ProfilePanelContext`: usage navigation state.
- `e2eBridge.ts` + `tests/helpers/bridge.ts`: `get_agent_usage_series`
  mock handler + fixture types, including the M2 cache fields
  (`cacheReadTokens`, `cacheWriteTokens`, `freshInputTokens`) the wire
  type carries. The UI absorbs but does not display these fields.
- `tests/e2e/agent-usage.spec.ts` + `agent-usage-screenshots.spec.ts`:
  Playwright coverage for loading, empty state, bars, range switching,
  error/retry, focused view, caveats, and cache invalidation.
- `desktop/playwright.config.ts`: agent-usage specs added to suite.
- `desktop/package.json`: recharts dependency.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
(cherry picked from commit 3d723a7)
Signed-off-by: evgeniy.chernomortsev <j.malkovitc@gmail.com>
…t-usage focused view

The plumbing already returned cacheReadTokens/cacheWriteTokens/freshInputTokens
at every scope of AgentUsageSeries, but the focused view rendered only the four
top-level stats and never surfaced them. Add an Input-breakdown subsection to the
totals card (Cache read / Cache write / Fresh input) gated on any known cache
value, and a compact per-model breakdown line. Fields follow the existing
unknown-not-zero semantics: absent subsets are omitted, a known-but-incomplete
value shows its lower bound with a Partial marker, and a scope with no cache data
renders no subsection at all.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
(cherry picked from commit b01a381)
Signed-off-by: evgeniy.chernomortsev <j.malkovitc@gmail.com>
Signed-off-by: evgeniy.chernomortsev <j.malkovitc@gmail.com>
Signed-off-by: evgeniy.chernomortsev <j.malkovitc@gmail.com>
Signed-off-by: evgeniy.chernomortsev <j.malkovitc@gmail.com>
@malkovitc

Copy link
Copy Markdown
Owner Author

@codex review

Signed-off-by: evgeniy.chernomortsev <j.malkovitc@gmail.com>
@malkovitc

Copy link
Copy Markdown
Owner Author

Review audit complete for exact head fb900af1a2c82843224d0fdb23cb4be3f1343912. All prior review threads were checked and addressed:

Additional validation: Node 20/20; desktop and Rust targeted tests PASS; live Caliper 0.2.0 broker smoke inbound e1b68bca… → durable reply c3a4452e…, 11s, exactly one reply.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 702812b404

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +2426 to +2432
let reply_to = batch
.events
.last()
.or_else(|| batch.cancelled_events.last())?
.event
.id
.to_hex();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Route brokered replies through the resolved thread anchor

When Pi handles a human reply inside an existing channel thread, this always sets replyTo to the newest event ID. However, format_prompt deliberately uses resolve_reply_anchor to target the thread root and keep human-facing replies flat at layer 1. Because buzz_reply treats this metadata as authoritative, Pi responses become nested under the triggering comment instead of following the routing shown in the prompt; derive this value with the same thread/DM anchor logic used by format_prompt.

Useful? React with 👍 / 👎.

Comment on lines +526 to +530
const result = await tool.execute(
String(event.id),
event.args ?? {},
new AbortController().signal,
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Abort brokered tools when the ACP prompt is cancelled

If cancellation or the harness deadline occurs while buzz_reply is running, this creates an untracked controller whose signal is never aborted. session/cancel only aborts the Pi session, while the broker's separately spawned buzz messages send process continues and can publish after the turn has already completed as cancelled. Store a per-prompt controller and abort it from cancellation and teardown so cancelled work cannot produce a late channel message.

Useful? React with 👍 / 👎.

Signed-off-by: evgeniy.chernomortsev <j.malkovitc@gmail.com>
@malkovitc

Copy link
Copy Markdown
Owner Author

Follow-up exact head 7590cf6a614be60206eb25c63ff6928e486b19ff: discovery metadata/version logic and tests were split into focused modules; local just file-size-check now PASS. Node 20/20, Biome, rustfmt, desktop Pi tests, and live 0.2.0 broker smoke remain PASS.

@malkovitc
malkovitc merged commit d3f90f5 into main Aug 25, 2026
48 of 53 checks passed
@malkovitc
malkovitc deleted the local/linza-patched-pi-0.5.18 branch August 25, 2026 12:50
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