Repository navigation
feat(agents): stream the usage log instead of holding it whole (relands #290) - #291
Merged
Merged
Conversation
`#collect_usage` took its log as a String, which is why `/var/log/mitm/http.log` had to be copied out of the container and materialised here — and copying it is what failed. Over the 30 days to 2026-09-17, cleanup ran for 277 of the 281 cursor_cli/grok/codex sessions while only 52 produced an `http.log` row, the largest 2.04 MB; exactly one session in that window failed inside the cleanup phase. The ceiling was the transfer, not the time budget, so moving the work to a job would have fixed the wrong thing. Those logs now take the same direct upload as every other, and come back as a Sessions::LogSource that reads the stored object in chunks. Every parser was already written as `log_content.each_line`, and a String is still one, so the small-log path is untouched and no adapter can tell the difference. `#usage_log_paths`, added one commit ago to keep these on the bounded read, is gone with the reason for it. Codex counted the log's lines to log that count, which is a third full pass over something that no longer fits; it reports the size alone now. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Signed-off-by: Artem Petrov <[email protected]>
aixle-com Bot
pushed a commit
that referenced
this pull request
Nov 30, 2026
…nregisters itself (#291) (#918) * Runners: remove a machine's workspace and cache volumes when it unregisters itself Signed-off-by: Alex <[email protected]> * Runners: build the keyless environment of the test without copying a lock Signed-off-by: Aixle Flow <[email protected]> Signed-off-by: Alex <[email protected]> * fix(runner): say when unregister cannot reach Docker and leaves the volumes Signed-off-by: Alex <[email protected]> * test(runner): use a DOCKER_HOST the Docker client refuses Signed-off-by: Alex <[email protected]> --------- Signed-off-by: Alex <[email protected]> Signed-off-by: Aixle Flow <[email protected]> Co-authored-by: Alex <[email protected]>
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.
Why this exists twice
#290 was opened with
artempartos/container-side-log-uploadas its base, so that is where it merged — into #289's branch, after #289 had already gone intodevelop. It reports MERGED and its content never reacheddevelop:Same commit, cherry-picked onto
develop, no changes. My mistake in stacking it.What it does
#collect_usagetook its log as a String, and that is the only reason the bytes had to be in this process at all. Measuring the failure said the phase was never the problem — over the 30 days to 2026-09-17, forcursor_cli/grok/codex:The ceiling was the transfer — a tar copy of the whole file through the API server — against a log that reaches 90 MB.
So those logs take the same direct upload as every other (#289),
#usage_log_pathsgoes away with the reason for it, and they come back asSessions::LogSource, which reads the stored object a chunk at a time. Every parser was already written againsteach_line, and a String is still one, so the small-log path is untouched and no adapter can tell which it got.Codex counted the log's lines in order to log that count — a third full pass over something that no longer fits. It reports the size alone.
Care taken in the streaming
CHUNK_BYTES + 100.Verification
Re-run against current
developafter the cherry-pick, not just on the original branch:test/services/agents,test/services/sessions,test/services/container_strategies,test/temporal— 843 runs, 2360 assertions, 0 failures, 0 errors.rubocopandbrakemanwere clean on the same tree before the replant and nothing changed in it.Coverage includes the contract itself:
GrokAdapter#collect_usageproduces the same token breakdown from aLogSourceas from the String its existing test feeds it.🤖 Generated with Claude Code