Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions src/council/artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,17 @@ def _source_to_dict(src: ContextSource) -> dict:


def save_round0(run_dir: Path, prompts: dict[str, str], results: dict[str, ToolResult]) -> None:
"""Save Round 0 artifacts (parallel generation)."""
"""Save Round 0 artifacts (parallel generation).

Saves all tool results by their actual names (supports multi-candidate
names like ``claude_0``, ``codex_1`` in addition to plain ``claude``).
"""
rdir = run_dir / "rounds" / "0_generate"
for name in ("claude", "codex"):
if name in prompts:
(rdir / f"prompt_{name}.md").write_text(prompts[name], encoding="utf-8")
if name in results:
r = results[name]
(rdir / f"{name}_stdout.md").write_text(r.stdout, encoding="utf-8")
(rdir / f"{name}_stderr.txt").write_text(r.stderr, encoding="utf-8")
for name, prompt_text in prompts.items():
(rdir / f"prompt_{name}.md").write_text(prompt_text, encoding="utf-8")
for name, r in results.items():
(rdir / f"{name}_stdout.md").write_text(r.stdout, encoding="utf-8")
(rdir / f"{name}_stderr.txt").write_text(r.stderr, encoding="utf-8")


def save_round(
Expand Down
19 changes: 15 additions & 4 deletions src/council/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,9 @@ async def run_pipeline(opts: RunOptions, config: CouncilConfig) -> Path:
if patch:
_print_progress(f" Patch file: {run_dir / 'final' / 'final.patch'}")

# Print final output to stdout so the user sees the answer directly.
print(final_output)

return run_dir


Expand Down Expand Up @@ -364,6 +367,8 @@ async def resume_pipeline(
if patch:
_print_progress(f" Patch file: {run_dir / 'final' / 'final.patch'}")

print(final_output)

return run_dir


Expand Down Expand Up @@ -457,10 +462,16 @@ def _should_run(round_name: str) -> bool:
for name, result in r0_results.items():
_print_progress(f" {name}: {_tool_status_str(result)} ({result.duration_sec:.1f}s)")
_print_verbose(f"stdout: {len(result.stdout)} bytes, stderr: {len(result.stderr)} bytes", verbose)
# Show stderr when a tool fails so users can diagnose issues.
if not _tool_ok(result) and result.stderr.strip():
for line in result.stderr.strip().splitlines()[:10]:
_print_progress(f" [dim]{line}[/dim]")
# Show error output when a tool fails so users can diagnose issues.
# Check both stderr and stdout since some tools (e.g. Claude Code)
# write errors to stdout in print mode.
if not _tool_ok(result):
for stream, label in ((result.stderr, "stderr"), (result.stdout, "stdout")):
text = stream.strip()
if text:
_print_progress(f" [dim]{label}:[/dim]")
for line in text.splitlines()[:10]:
_print_progress(f" [dim] {line}[/dim]")

# Collect successful outputs grouped by tool family.
claude_candidates: list[tuple[str, str]] = []
Expand Down