perf(runtime): import local sources via single tar put_archive#740
Open
pranav-afk wants to merge 2 commits into
Open
perf(runtime): import local sources via single tar put_archive#740pranav-afk wants to merge 2 commits into
pranav-afk wants to merge 2 commits into
Conversation
Contributor
Greptile SummaryThis PR moves local source imports from SDK manifest entries to a Docker archive upload path. The main changes are:
Confidence Score: 4/5The new local-source import path needs fixes before merging.
strix/runtime/session_manager.py Important Files Changed
Prompt To Fix All With AIFix the following 4 code review issues. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 4
strix/runtime/session_manager.py:93
**Archive Buffer Exhausts Memory**
When a large local source is copied, `_build_source_tar()` stores the whole tar in `BytesIO` and then returns another full `bytes` copy. The changed path is meant for large repos, but a multi-GB repo or a tree with many small files can now OOM the Strix process before Docker receives the archive.
### Issue 2 of 4
strix/runtime/session_manager.py:277
**Started Container Escapes Cleanup**
`_import_local_sources()` runs after the backend has started the container but before the bundle is cached. If tar creation, `put_archive`, `mkdir`, or `chown` fails, `create_or_reuse()` raises with no cached bundle for `cleanup(scan_id)` to delete, leaving the started container running.
### Issue 3 of 4
strix/runtime/session_manager.py:97
**Unreadable Directories Disappear Silently**
`os.walk()` suppresses directory-read errors when no `onerror` handler is provided. If a local repo contains an unreadable subdirectory, the tar import can succeed while omitting that subtree, so the agent later sees missing files under `/workspace/<subdir>` with no import failure or skip count.
### Issue 4 of 4
strix/runtime/session_manager.py:201-209
**Fixed User Breaks Custom Images**
The new import path always runs `chown -R pentester:pentester` after extracting sources. `create_or_reuse()` accepts arbitrary sandbox images, so an image without that user or group now fails during local-source import even though the container started correctly.
Reviews (1): Last reviewed commit: "perf(runtime): import local sources via ..." | Re-trigger Greptile |
1c360fe to
c33df59
Compare
|
WTF? This is a direct copy of my PR #695. |
44e87ca to
daf39a2
Compare
Replace the SDK per-file LocalDir copy path that hangs for hours on large repos with one container.put_archive() per source, so sandbox startup finishes quickly and scans can produce reports.
Spill tars to temp files, tear down containers on setup failure, fail on unreadable dirs, and resolve workspace ownership from the image user instead of hard-coding pentester.
c33df59 to
d8d9af1
Compare
|
This is a direct copy of my PR #695!!! You THEIF!!! |
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.
Replace the SDK per-file LocalDir copy path that hangs for hours on large repos with one container.put_archive() per source, so sandbox startup finishes quickly and scans can produce reports.