postprocess: run function transformations asynchronously with bounded jobs - #1997
Open
thedataking wants to merge 3 commits into
Open
postprocess: run function transformations asynchronously with bounded jobs#1997thedataking wants to merge 3 commits into
thedataking wants to merge 3 commits into
Conversation
Use the native async OpenAI and Gemini clients and await trimming, response validation/retries, and comment transfer without changing prompts or cache keys. Keep file processing serial in this commit. Run the CLI in one event loop and close model transports before it exits, including on failure. Adapt existing tests with asyncio.run and exercise SDK request forwarding with fake clients; no live model calls are needed.
asyncio.run handles Ctrl-C by cancelling the main task. A synchronous merge or cargo check can return with that cancellation still pending, bypassing the existing rollback boundary. Await cancellation checkpoints inside the transaction before checking and before accepting the batch. Keep bisection sequential and cover cancellation during both merge and check, including restoration of the original file.
Use a small pool of async workers to overlap independent functions within each Rust file. Add -j/--jobs with a default of four and require a positive limit; -j 1 preserves serial processing. Keep trimming and retries within each worker, and process files and transform passes sequentially. Collect responses before merging, apply candidates in source order, and cancel and await outstanding workers on abort. Existing prompts and cache entries remain reusable without locks or new dependencies. Test the concurrency bound, ordered writes, failure handling, cancellation, serial replay of a parallel-populated frozen cache, CLI validation, and client cleanup. All 79 local tests passed; four c2rust-dependent tests skipped. Ruff and ty checks passed without live model calls.
thedataking
force-pushed
the
perl/postprocess-async-jobs
branch
from
September 7, 2026 03:39
a88fe98 to
83a1060
Compare
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.
Stacked on #1996.
Process up to four functions concurrently per Rust file using native async OpenAI/OpenRouter and Gemini clients. Set
-j N/--jobs Nto control the limit;-j 1runs serially.Each function keeps its trim/retry sequence, and files and transform passes remain sequential. Responses are applied in source order through the existing batch validator. Abort cancels pending work, and cancellation during validation restores the current batch.
Prompts and cache keys stay unchanged, so existing CI caches and serial/parallel reruns share responses. No new dependencies.
Validation: 79 tests passed; four tests requiring a local c2rust binary skipped. Ruff format, Ruff lint, and ty passed. Tests cover concurrency bounds, ordered writes, abort/rollback, client cleanup, and frozen cache replay. Live model testing is left to you.