Skip to content

fix(session): make context usage persistence authoritative - #2125

Merged
bobleer merged 1 commit into
GCWing:mainfrom
bobleer:bob/fix-context-usage-persistence
Aug 6, 2026
Merged

fix(session): make context usage persistence authoritative#2125
bobleer merged 1 commit into
GCWing:mainfrom
bobleer:bob/fix-context-usage-persistence

Conversation

@bobleer

@bobleer bobleer commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #2098 after review found that the UI-owned metadata write could race with title saves, miss non-Web hosts, survive history rewrites, and leave Peer gap recovery without an exact value.

  • persist typed currentContextUsage in the Session runtime for model requests and applied compression
  • serialize writes with the Session mutation owner and reject stale events from removed turns
  • preserve or clear provenance across fork, rollback, delete, and partial-history hydration
  • expose the authoritative value through restore_session_view for Peer recovery
  • keep ACP context accounting separate and retain only safe single-round fallbacks

Validation

  • Web UI focused suites: 157 passed
  • Web UI type-check
  • bitfun-core context usage tests: 5 passed
  • services-core metadata contracts: 15 passed
  • services-core lineage tests: 2 passed
  • Desktop metadata merge contract
  • repository hygiene and core boundary checks

@bobleer
bobleer merged commit b69f345 into GCWing:main Aug 6, 2026
7 checks passed
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