Skip to content

feat(web): show observed context composition in session usage - #914

Merged
tt-a1i merged 4 commits into
mainfrom
codex/context-transparency
Nov 7, 2026
Merged

tt-a1i merged 4 commits into
mainfrom
codex/context-transparency

Conversation

@tt-a1i

@tt-a1i tt-a1i commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

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_system hook 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.

Pi context hook -> numerical snapshot -> existing session usage popover

Includes the pinned community investigation and concrete semantic-navigation/diagnostic-delta limitations.

Validation

  • bun run check passed 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 #915 6e800f83 and feat: add on-demand semantic navigation skill #916 1919dccd: 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.

@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant