Repository navigation
fix(sessions): stop losing session outputs with long file names - #47
Merged
Merged
Conversation
A session could finish with an empty Assets list even though the agent wrote files to /workspace/outputs. The files were found, read back, and silently dropped. read_file tars the requested path and picked the entry out of the archive by comparing File.basename(entry.full_name) to the requested basename. A tar header's name field is 100 bytes; past that the name is carried out-of-band — GNU/busybox tar (what KubernetesRuntime#copy_from runs, and prod is k8s) emits a `././@LongLink` entry and truncates the real entry's name, Docker's Go writer emits a PAX `x` header and garbles it. Either way the comparison failed, extract_from_tar returned nil, and collect_outputs skipped the file on `next if content.blank?` without logging anything, so nothing pointed at the loss. On k8s the whole path is tarred, so the budget is ~82 bytes after `workspace/outputs/`; a Cyrillic title (2 bytes per character) overflows it at around 40 characters, which is why human-named deliverables vanished while machine-named ones came through. Both runtimes tar exactly one path per read, so the first regular-file entry is the answer and the header name never needed to be trusted; the requested basename stays as a preference for a multi-entry archive. Verified against the real busybox tar in the container: 108- and 138-byte paths that returned nil now return their content. Also log the skip in both collect_outputs paths, and split "unreadable" from "empty" — the previous silence is what made this invisible in production. One existing test pinned the old behaviour (a tar whose single entry has a different basename must yield nil). Its premise cannot happen: archive_out always returns the tar of the path asked for. It now asserts the real contract — content wins over a mismatched header name, nil only when the archive carries no file entry at all. Signed-off-by: Artem Petrov <[email protected]> Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…stable
CI failed on this branch in a test the branch does not touch:
inject_repositories falls back to per-repository tokens when one repo
poisons the group token
- expected [["good", "bad"], ["good"], ["bad"]]
+ actual [["bad", "good"], ["bad"], ["good"]]
`Repository.where(id: ids)` carries no ORDER BY, so Postgres is free to hand
the rows back in any order. That order decides the `repositories:` list sent to
GitHub when minting the group installation token, and the order the repositories
clone in — a latent flake that had simply been landing the lucky way until now.
Order by id. The list GitHub sees and the clone order are now the order the
repositories were attached, run to run.
Signed-off-by: Artem Petrov <[email protected]>
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
alex-astafyev
pushed a commit
to alex-astafyev/flow
that referenced
this pull request
Aug 19, 2026
* origin/develop: fix(sessions): stop losing session outputs with long file names (AixleHQ#47) chore(bmad): bump BMAD Method to 6.10.0 (AixleHQ#46) fix: size the Active Record pool from Puma's thread budget (AixleHQ#45)
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.
Problem
A session could finish with an empty Assets list even though the agent wrote files to
/workspace/outputs. The files were found byfind, read back, and then silently dropped — no log line, nothing to grep for.read_filetars the requested path and picked the entry out of the archive by comparingFile.basename(entry.full_name)against the requested basename. A tar header's name field is 100 bytes; past that the name travels out-of-band:KubernetesRuntime#copy_fromruns, and prod isCONTAINER_RUNTIME=k8s— emits a././@LongLinkentry and truncates the real entry's name.xheader and garbles it.Either way the comparison failed,
extract_from_tarreturnednil, andcollect_outputshitnext if content.blank?.On k8s the whole path is tarred, so the budget is ~82 bytes after
workspace/outputs/. A Cyrillic title (2 bytes per character) overflows that at ~40 characters — which is why human-named deliverables vanished while machine-named ones came through. Reproduced against the real busybox tar in the container:Fix
Both runtimes tar exactly one path per read, so the first regular-file entry is the answer — the header name never needed to be trusted. The requested basename stays as a preference so a multi-entry archive still resolves correctly;
L/x/gmetadata entries are skipped viaentry.file?.Same real busybox tar, after the fix:
Both
collect_outputspaths now log the skip and separateunreadablefromempty— the previous silence is what made this invisible in production.Tests
base_runtime_test.rbbuilds the raw tar bytes header by header (regular, GNUL, PAXx, directory-only), so the cases don't depend on which tar binary the environment ships. Fail-first confirmed: without the fix exactly the two long-name tests fail.One existing test pinned the old behaviour — a tar whose single entry has a different basename must yield
nil. That premise cannot occur:archive_outalways returns the tar of the path asked for. It now asserts the real contract: content wins over a mismatched header name,nilonly when the archive carries no file entry at all.docker compose exec -T web make check_allgreen.🤖 Generated with Claude Code