Skip to content

fix(agent): persist recovered session usage - #2224

Draft
devRickyyy wants to merge 1 commit into
mainfrom
fix/session-usage-resume
Draft

fix(agent): persist recovered session usage#2224
devRickyyy wants to merge 1 commit into
mainfrom
fix/session-usage-resume

Conversation

@devRickyyy

Copy link
Copy Markdown
Contributor

Summary

  • merge provider runtime context recovered during session resume back into the controller session
  • emit an explicit session snapshot only when resume recovers new runtime context
  • add regression coverage and document the resume data flow and troubleshooting path

Root cause

Provider adapters can replay context-window usage while reattaching to an existing provider session. Controller.Resume previously stored the pre-resume session without reading StateAdapter.SessionState, so the recovered usage remained a live adapter observation.

An event report with an empty event list does not create a state patch, so metadata enrichment cannot make that observation durable. AgentGUI hydration could therefore lose usage after reopening the session.

Impact

Resumed sessions now persist provider-recovered usage and other newly recovered runtime context. Resumes with no context change do not emit an extra report.

Validation

  • go test ./runtime -shuffle=on -count=3
  • pnpm check:changed (7/7 lanes)
  • pnpm check:changed -- --push-ready (8/8 lanes)

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