Repository navigation
feat(capture): read conversation folders; fetch and clean whole conversations - #60
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…moted Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s folder Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… its turns Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…as a new turn Once no whole conversation fits, the budget left went to the first one skipped, as its earliest counted turns. Promoted turns usually sort first, so the leftover could be spent entirely on turns the suite already holds, the conversation never progressed, and after `capture clean` every sync re-downloaded the same promoted turns. Walk the skipped conversations in rank order and give the leftover to the first whose leading turns include one not promoted; pass over one whose leading turns are all promoted, and leave the leftover unused when none qualifies. The choice still reads only the listing and the promoted ids, so a re-run with nothing new fetches nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reading conversation folders listed each suite directory's children with iterdir, which raises on an unreadable directory and aborted list, sync, clean and promote for every suite; the earlier glob passed such a directory over. Return the flat files when the listing fails, and check a child's name before stat-ing it. Pin the two-levels-deep folder in the reader and the 17-hex folder in the fetch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…le expiry - evalshift-sdk 0.7.0 files only a capture.agent_session conversation's turns in a conv_<16 hex>/ folder; @capture.agent captures stay flat. Every list of what is written flat, and the "turn(s) not promoted" warning, name the decorator. - The fetch budget's leftover goes to the next conversation whose turns that fit include one not yet promoted, and goes unused when none qualifies; clean causes a re-download only for a conversation with an unpromoted turn inside the window. - A bucket lifecycle rule is a cause of missing earlier turns, and promoted turns come along "whatever their age" only while the bucket still holds them. - CHANGELOG: capture fetch applies neither limit but moves whole conversations too; capture clean SUITE and capture promote --suite read the SDK's suite directory. - docs/sdk.md: the SDK 0.7.0 eviction rule is versioned, capture_ttl still evicts every older capture, and the bucket diagram shows conversation folders. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4 tasks done
Collaborator
Author
|
The SDK half is open as a draft: evalshift/evalshift-sdk#18. It must not merge before CLI 1.6.0 is on PyPI. Two commits since the PR opened: b5a26ec and 157ab21 bring
Cross-repo smoke. The SDK branch wrote and this branch read, in a scratch venv with both editable installs:
That last point is why the CLI 1.6.0 version bump has to land before SDK 0.7.0 ships. 🤖 Generated with Claude Code |
Merged
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.
What this changes
This is the CLI half of conversation capture folders. evalshift-sdk 0.7.0 (a separate, later PR) will file a
capture.agent_sessionconversation's turns in one folder,captures/<suite>/conv_<16 hex of sha256(conversation_id)>/cap_<hex>.json, on disk and in a bucket. This PR teaches the CLI that layout first. It ships in 1.6.0 with the unreleased #57 and #58.It is safe on its own. With today's SDK (0.6, flat files) a flat capture is a unit of one, so
capture sync,list,fetchandcleanbehave as before. The exceptions are the two fixes listed undercapture cleanand suite names below.iter_capturesreadscaptures/<suite>/*.json, then eachcaptures/<suite>/conv_<16 hex>/*.jsonfolder. It goes one level deep and matches folder names withfullmatch, sonested/, uppercase hex and wrong lengths are ignored. A suite argument maps to the directory the SDK writes, soteam/supportreadscaptures/team_support/. That fixescapture list <suite>,sync --suite,fetch --suite,clean SUITEandpromote --suitefor suite names containing a slash. A suite directory that can't be listed is skipped, as in 1.5.x.captures/<suite>/<name>.jsonorcaptures/<suite>/conv_<16 hex>/<name>.json; anything else counts as malformed. A conversation folder moves as a unit:max_casesbudget (3 ×max_casesper suite) counts captures but ranks and takes whole conversations, newest first.capture clean(default--promoted) keeps a conversation's promoted turns while any of its turns is unpromoted, says how many it kept, and removes the conversation folders it empties.EVALSHIFT_CAPTURE_LAYOUT=flat, or the@capture.agentdecorator, whoseconversation_idis static);max_captures/capture_ttl;Compatibility
conversation_idacross both layouts. On a fresh checkout, the conversation's promoted flat turns are not fetched (documented).Release order:
Test plan
make ci: 3331 passed, 1 skipped (the existing evalshift-server skip), coverage 95.23%.ruff,ruff format,mypy --strictandpre-commit run --all-filesare clean._safe_segment;cleankeeping a half-promoted conversation in both layouts, removing a fully promoted folder, and never removing a folder with other files;testApp):converter's 11 conversation captures into theirconv_*folders, the suite is still byte-identical, andcapture listshows them.capture cleanmade sync re-download the same turns every cycle.Known trade-offs (documented)
max_cases, and every machine computes the same step from the committed suites), so a re-sync downloads nothing only while the promoted set is unchanged.🤖 Generated with Claude Code