Repository navigation
feat(core): read what the steps printed, then answer the request - #28
Conversation
The maintainer's retest showed codebud plans steps, runs them, and stops: no model call ever read their output, and the history kept only "planned: tool(target)". It listed a directory but could not summarise or count it, and two turns after writing log_calc.c it guessed a Python file. Its plain replies, prompted as "a helpful coding assistant", said it was Qwen and could not see the project. After the steps of a turn run, chat, run and plan --execute now call the model once more with the request and each step's tool(target), status and output, and show its answer. The outputs are data, not instructions (the prompt says so; they are indented, so they cannot forge a step line or the end marker), secrets in them are masked (the backend may be remote), and they are bounded: at most 2800 characters per step (head and tail kept) and 9000 in all, cut from the largest first. The history's "planned: ..." entry becomes "ran: tool(target) -> exit N; ..." -- from each step's tool and target, never the model's descriptions (security review M1) -- followed by the answer; outputs never enter the history. No step ran: no call. The model unavailable: no answer, no error. Every reply now starts from one identity prompt (persona.py): Codebud, a local coding agent in this project, running allow-listed programs without a shell, never another assistant. * src/codebud/persona.py: New file. * src/codebud/llm_stub.py (call_llm_plain): Use the identity prompt. (call_llm_answer, format_step_results, _fair_caps, _cut) (_step_status): New. * src/codebud/cli/steps.py (StepsOutcome.records): New field. (run_steps): Fill it. * src/codebud/core.py (AgentCore.answer_after_steps): New. * src/codebud/cli/chat.py: Answer after the steps. * src/codebud/cli/run.py (_print_answer): New; used by run and plan --execute. * src/Makefile.am: Install persona.py. * tests/test_answer_after_steps.py: New file. * tests/test_cli.py: The fake agents answer nothing. * tests/test_rag_context.py: The plain prompt starts with the identity. * docs/chapters/usage.texi, docs/chapters/privacy.texi: Document it. * docs/chapters/development.texi: List the test file. * NEWS: Mention it.
Review summary: correct (one non-blocking note)One sweep, locally, before pushing. Conditions.
Verified against the code:
20 new tests; the full suite passes (1870). Measured (#26's evaluation, with #27): 3B 9 → 12/18, 7B 12 → 17/18. Non-blocking note: Verdict: correct. I'll merge when CI passes. |
|
Merging. CI is green on all five jobs at |
The main fix for the failed release-gate retest. Codebud planned steps, ran them, and stopped: no model call ever read their output, and the history kept only
planned: tool(target). It listed a directory but couldn't summarise or count it, and two turns after writinglog_calc.cit guessed a Python file. Its plain replies, prompted as "a helpful coding assistant", said it was Qwen and couldn't see the project.Change
chat,runandplan --executecall the model once more, with the request and each step's tool(target), status and output, and show its answer.step N:line or the end marker. Secrets are masked, because the backend may be remote.planned: …entry becomesran: tool(target) -> exit N; …, followed by the answer. The entry is built from each step's tool and target, never from the model's descriptions (security review M1). Outputs never enter the history.persona.py) starts every reply: Codebud, a local coding agent in this project, running allow-listed programs without a shell, never another assistant.Measured with
scripts/chat_eval.py(#26), this PR together with #27mainat #25)It now says "My name is Codebud", lists and counts the directories, summarises the files, and answers "I wrote
log_calc.cearlier". It no longer claims to be Qwen.Left for the next PR (reply or plan):
src/codebud/planner.py, copied from the planner's few-shot examples;Review and CI
llm_stub.pyand importsstep_summaryfromcorelazily; it could move into the core later.main(it hadn't been pushed before). The full suite passes (1870), ruff is clean, and the manual builds without warnings.