Repository navigation
Run module agents concurrently, with progress, ETA and failure isolation - #2
Merged
Merged
Conversation
Subscription CLIs sometimes answer with the whole module page as their final message instead of calling str_replace_editor, so the run "completed" without a file and generation then failed on the missing doc. Save that reply as the page when it looks like one (a "#" heading, at least 500 characters). The super-grouping prompt lists each module's components under it, and the LLM sometimes answered with those component ids instead of module names, which were then dropped as unknown modules. Map a component id back to the module that owns it. Also state in the caw str_replace_editor description that working_dir is required and must be "repo" or "docs". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Generation ran every module agent one after another: a 1046-file repository took 7.4 h as 211 serial agent runs of ~2 min each (issue FSoft-AI4Code#126). Independent modules now run at the same time. - The generator walks the module tree as async tasks: siblings and leaves of different branches run together, and a parent page is written once all its children are done. --concurrency (default 4) caps live agent sessions; `codewiki config set --concurrency N` saves a default, which the generate flag overrides per run. - Sub-modules an agent delegates also run side by side (both backends). AgentSlots caps sessions across the whole run; a parent waiting on its sub-agents lends them its slot, so a full pool cannot deadlock. - All agents share one module tree (SharedModuleTree) under a lock. Each agent used to load module_tree.json and save its own copy, so concurrent agents would drop each other's sub-modules. - caw sessions get their cwd from Popen instead of a process-wide os.chdir, which concurrent sessions would race on. - Parent and repository overviews run in a worker thread (complete_async) instead of blocking the event loop that running agents' Mermaid validation uses. - The stderr swap around PythonMonkey validation is reference-counted; interleaved save/restore could leave stderr on a closed devnull. - save_json writes atomically, so readers never see half a tree. - The API-key backend now delegates to sub-agents only when a multi-file module also has max_token_per_leaf_module tokens, the same gate the caw backend and the sub-module tool use. - str_replace that empties a file no longer fails the agent with AssertionError (1, 0, 1) in expand_window. Benchmarks (benchmarks/): itsdangerous with claude-code, 9 module agents + 3 overviews, documentation phase: concurrency 1: 1383 s, 4: 372 s (3.7x), 8: 243 s (5.7x), same page count and size. replay_schedule.py replays a serial run's log through the scheduler; for the 7.4 h run it projects 3.8x at 4 and 6.3x at 8. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The documentation phase is nearly all of a run's time and printed no
progress. After every module, sub-module and overview page it now prints
one status line, in normal and verbose mode:
✓ Signing (2m 12s) · 5/12 done (42%) · 4 running · ETA ~4m
- The total grows as agents split modules into sub-modules (both
backends add to it); "running" counts sessions holding a slot, so a
parent waiting on its sub-modules is not counted.
- ETA is modules left x average time per module / concurrency, plus the
remaining usage-limit wait. Pages that already existed (resume) are
shown as "already documented" and kept out of the average.
- Pauses are reported as they happen, so a waiting run does not look
hung: caw's subscription usage-limit wait (from its log), and HTTP 429
from API providers (httpx response hooks on the agent and completion
clients, noted at most once a minute).
- A summary ends the phase: pages, wall time, failures, rate-limited
requests and the slowest modules.
- Without --verbose, caw's per-session transcripts and FastMCP's INFO
session logs are turned off; with concurrent agents they interleaved
and buried everything else. CAW_LOG=short|full opts back in.
The module list after clustering printed "(? files)" for every module:
it expected a list, but modules are {"components", "children"} dicts.
It now counts distinct source files, sub-modules included.
Adds a test for the pydantic sub-module tool's concurrent fan-out (own
deps per sub-agent, slot cap, progress counts).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… fails - ETA uses observed throughput once `concurrency` modules have finished; per-module averages counted each parent's whole subtree and slot waits. - --update prints a status line per leaf and says leaves run one at a time (every write set shares overview.md); --concurrency help says so. - A failed sub-module is logged instead of re-raised, so its parent agent still writes its page; the missing child is regenerated on the next run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
Module agents now run side by side (
--concurrency, default 4) with a status line after every page. This PR also fixes the problems a real 8-way run on a ~800-file TypeScript repo exposed.The fixes from that run (last commit):
Also in this branch: agent pages that were left unwritten are recovered, component ids in super-grouping are normalized, and the module file count includes sub-modules.
Not changed:
--updatestill updates its leaf modules one at a time. Every leaf may editoverview.md, so running them in parallel would mean redesigning how pages are assigned to agents.--concurrencycovers the missing-page step of an update; the--helptext says so.Evidence
code-wiki-new-logs.txt):directivesafter 2h 26m,core_ui_componentsafter 2h 20m.--updateprinted no progress at all.Not yet run end-to-end on a real repo after the last commit.
Merge Danger
Door: two-way
Revert the merge to go back to sequential generation.
--concurrency 1gives the old one-at-a-time order without reverting.Blast Radius: generation
--concurrencywhen that happens.codewiki generatefills in the gap.tool_use.idpattern). Timeouts still fail that module.🤖 Generated with Claude Code