perf: bootstrap Caido concurrently with the scan start - #1143
Merged
Conversation
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Contributor
Greptile SummaryThe PR starts Caido bootstrap concurrently with scan startup and resolves the shared client on first proxy use.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Important Files Changed
Reviews (2): Last reviewed commit: "fix: close the Caido client when connect..." | Re-trigger Greptile |
Contributor
Author
0xallam
approved these changes
Aug 21, 2026
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.
Summary
Session bring-up blocked on the Caido bootstrap (sidecar login + project setup, a couple of seconds of guest-side polling) before the scan could start, even though nothing needs the proxy client until the first proxy tool call. The bootstrap now runs as a task and bring-up returns as soon as the container is up; the client is resolved at first use.
Two things the handle has to get right:
get()awaits underasyncio.shield, so one caller's cancellation (a tool timeout) does not cancel the bootstrap everyone else shares.get()caller, and the proxy tools degrade to their existing "client unavailable" result.aclose()cancels an in-flight bootstrap or closes the finished client, so the cleanup path stays leak-free either way.Callers that already stored the bundle's
caido_clientkeep working:aclose()is the only method cleanup used.Testing
tests/test_caido_handle.pycovers resolution,peek()before/after completion, repeated failure propagation, a cancelled caller not cancelling the shared task, and bothaclose()paths (in-flight cancel, finished-client close, failed bootstrap swallowed).tests/test_proxy_client.pygains handle-resolution and failed-bootstrap-degrades-to-Nonecases.953 tests, ruff, mypy, bandit green.
Link to Devin session: https://app.devin.ai/sessions/b55b94e7b0e6401a9348bcb505c7f91f