Skip to content

fix(sleep): do not harvest api-request-blob records and host notices as user prompts - #382

Open
Aditya Nikam (adityaanikam) wants to merge 1 commit into
microsoft:mainfrom
adityaanikam:fix-harvest-api-request-blob
Open

Aditya Nikam (adityaanikam) wants to merge 1 commit into
microsoft:mainfrom
adityaanikam:fix-harvest-api-request-blob

Conversation

@adityaanikam

Copy link
Copy Markdown

Fixes #371.

digest_transcript branched only on message.role, so an api-request-blob record (the raw API payload, role user, no isMeta) was counted as a typed prompt, and a loaded skill's body could count as negative feedback. Records with a type other than user or assistant are now skipped. A record without a type is still read, as before, because transcripts of that shape exist in the tests.

Two other kinds of user records passed _is_meta_prompt as well and are now skipped: <task-notification> messages from background tasks, and the summary the host writes after compaction.

The four new tests in tests/test_sleep_harvest_non_user_records.py run the example from the issue: three fail on main and all pass here. The full suite has the same 22 failures with and without this change on my Windows machine.

Copilot AI balanced review requested due to automatic review settings November 8, 2026 13:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

This branch has not been deployed

No deployments
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.

harvest: Claude Code api-request-blob records and host notices are read as user prompts

2 participants