Repository navigation
Sourcehunt native-async refactor; drop llm.compat; FFmpeg docs - #8
Merged
Merged
Conversation
Squashed rollup of the work on this branch.
- Hot path is native async end-to-end: SourceHuntRunner.arun() drives
the pipeline; run() is a thin asyncio.run wrapper. Every stage gets an
async variant: Verifier.averify/arun_patch_oracle, Exploiter.aattempt,
AutoPatcher.aattempt, MechanismExtractor.aextract,
VariantPatternGenerator.agenerate, VariantLoop.arun/arun_once.
- record_finding tolerates extra kwargs from the model (e.g.
severity_reason) instead of crashing on them.
- Trajectory logging + verifier resilience fixes carried through.
- astream / ainvoke are the primary API; internal _arun_loop /
_aassistant_step / _arun_tool_calls / _aresume / _ainvoke_tool are
all async. Dropped the sync stream / invoke / _drain_async_gen
wrappers that reached across the async boundary.
- Operator grows arun(); run() is asyncio.run(arun()). _arun_inner_turn
/ _ahandle_interrupt / _adecide_next use the async graph + ainvoke
on the operator LLM.
- Web app's websocket handler drives astream / ainvoke directly; awaits
operator.arun() instead of run_in_executor(operator.run).
- CI/CD runner and interactive CLI bridge to async via one asyncio.run
at their own sync entry points.
- Delete clearwing/llm/compat.py and tests/test_llm_compat.py.
- Remove sync entrypoints that only existed to feed the compat shim
(Exploiter.attempt, Verifier.verify/run_patch_oracle,
AutoPatcher.attempt, MechanismExtractor.extract,
VariantPatternGenerator.generate, VariantLoop.run/run_once).
- Async entrypoints await llm.aask_text / llm.aask_json directly.
- harness_generator bridges to aask_text via asyncio.run inside its
ThreadPoolExecutor worker.
- Rewrite 16 sourcehunt/operator tests to AsyncMock + aask_text /
aask_json / ainvoke / astream instead of MagicMock.invoke.
- Switch pyproject dep from git+URL to PyPI "genai-pyo3 >= 0.1.9".
- genai-pyo3's ChatResponse is now isomorphic to rust-genai: `content`
is the single source of truth, `first_text()` / `texts()` /
`tool_calls()` are derived-view methods (matching rust-genai's getter
names). Dropped the flattened `text` / `texts` / `tool_calls` fields
that forced callers to coalesce None manually.
- Switch every call site to the method form: sourcehunt verifier /
exploiter / patcher / variant_loop / mechanism_memory /
harness_generator / hunter, plus clearwing/llm/chat.py and
clearwing/llm/native.py.
- Delete clearwing's ~45-line _collect_stream_response stream-synth:
native.py now just routes to client.achat_via_stream() (a 0.1.9
Rust-side feature that forces the capture flags, drains the stream,
and hands back a fully-collected ChatResponse) for openai_resp and
client.achat() otherwise.
- Tests that faked a ChatResponse via SimpleNamespace(text=...) now
build a real pyclass via ChatResponse(content=[{"text": ...}]).
- New "Running sourcehunt on a local repo (FFmpeg example)" section
showing how to drive SourceHuntRunner directly against an
already-cloned tree with per-stage AsyncLLMClient instances against
an OpenAI-compatible endpoint.
- ruff --fix + ruff format across sorted imports, dropped unused
MagicMock imports, closure-var binding in interactive CLI
_collect_events.
- 1400 tests passing, ruff + ruff-format clean, scoped mypy gate clean
on py3.10/3.11/3.12.
ropoctl
force-pushed
the
sourcehunt-native-h264-fixes
branch
from
April 16, 2026 21:08
761f770 to
15bbf28
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.
Summary
SourceHuntRunner.arun()drives the pipeline;run()is a thinasyncio.runwrapper. All stages now have async variants (Verifier.averify/arun_patch_oracle,Exploiter.aattempt,AutoPatcher.aattempt,MechanismExtractor.aextract,VariantPatternGenerator.agenerate,VariantLoop.arun/arun_once). Dropped theGenAIPyO3ChatModelalias and hardenedrecord_findingagainst extra model-supplied kwargs.NativeAgentGraphis async-only.astream/ainvokeare the primary API; internal loop / assistant-step / tool-call / tool-invoke are all async, and_ainvoke_toolawaits directly instead of spawning a nested event loop viaasyncio.run. Operator growsarun;run()is anasyncio.runwrapper. Web app's websocket session and CI/CD runner / interactive CLI bridge at their own entry points — no in-graph sync-to-async drain.clearwing/llm/compat.py. Removed sync entrypoints in 7 sourcehunt files that only existed to feed the compat shim; async entrypoints now callllm.aask_text/llm.aask_jsondirectly. Rewrote 16 sourcehunt/operator test files toAsyncMock+aask_text/aask_json/ainvoke/astreampatterns (~300 edits). Deletedtests/test_llm_compat.py.SourceHuntRunnerdirectly against an already-cloned tree with per-stageAsyncLLMClients against an OpenAI-compatible endpoint.Commits
62a5188Move sourcehunt hot path to native async and harden record_finding5c0b0b3Make NativeAgentGraph async-only; drop sync stream/invoke wrappersb4b5203Drop llm.compat; sourcehunt stages are native async end-to-endc4e0dd8README: document local-repo sourcehunt flow via SourceHuntRunnerTest plan
uv run python -m pytest -q tests/→ 1400 passeduv run python -m compileall clearwing→ cleanastream/ainvokecontracts inclearwing/agent/runtime.pyand the AsyncMock patterns in the rewritten sourcehunt tests