Repository navigation
feat(web): show observed context composition in session usage - #914
Merged
Merged
Conversation
3 tasks done
This was referenced Nov 6, 2026
This was referenced Nov 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The session usage popover reports total tokens and context occupancy, but does not show how much observed context comes from system text, tool declarations or conversation content. Relates to #913.
Value
Users can inspect the latest observed call's composition while keeping local byte measurements separate from Pi's context estimate and provider-reported token usage.
Approach
Observe Pi's existing
context_with_systemhook and replay its native system/tool state. Keep one numerical snapshot per Session and project it through existing session usage. Clear it at native context/lifecycle boundaries. No raw prompt archive, extra model call, new tool or configuration is introduced.Includes the pinned community investigation and concrete semantic-navigation/diagnostic-delta limitations.
Validation
bun run checkpassed with Bun 1.3.14.bun run test: Node 2,467 passed, 8 skipped; UI 1,633 passed.Additional unskipped observer test passed; native integration verifies unchanged input, replay, later-handler boundary, repeated calls and lifecycle invalidation.
Actual PiWebRuntime factory + isolated loopback provider exposed 12 normal tools; observation reached /api/snapshot and the browser. Ego visual acceptance passed.
Independent review corrected an inaccurate Pi 1.2 availability hint. Minimum-host CI remains a separate gate.
Initial CI stopped before runtime tests on Web bundle freshness. Both worktrees now have independent Bun 1.3.14 frozen installs; rebuilt assets eliminate 33 unrelated chunks. Full check/test passed again under that installation, and corrected-head CI passed.
Packaged-startup CI then exposed a missing Pi AI root alias. The exact missing-peer pack/install failed before the fix and started/served local assets/exited cleanly afterward. The fix extends the existing selected-host alias map, with no dependency change. Full check/test passed again after this fix.
Final head
e156a220f46dabe979c7536e001c2eb6ca57b004: CI run 42267480520 passed all 19 jobs, including minimum/latest Pi, packaged startup, Windows and both Web E2E shards. The repository still requires an independent GitHub approval.Local combined integration of feat(web): show observed context composition in session usage #914
e156a220, feat(web): preserve source identity in review and plan references #9156e800f83and feat: add on-demand semantic navigation skill #9161919dccd: full check/test passed (Node 2,471 pass / 8 existing skips; UI 1,638 pass). The two overlapping generated assets were rebuilt from combined source; no source conflicts. This is separate from individual-head CI and remote merge.Impact
User-visible: an observed-context section in session usage, with unavailable and omitted-media states.
Model-visible: no additional tools, prompts or calls.
Runtime: one numerical latest-call observation; no raw context retained or persisted.
Configuration/data: unchanged.
Compatibility: helper capability detection; source inspection confirms Pi 0.99.1 support.
Limit: this is the hook's observed context, not final wire content, exact token attribution or billing. Generated Web assets are included.