Terminus 2 XML parser runs replies missing <analysis> or <plan>

Open
#4,264 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

  • #4281 by @asaraog — closed without merging

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
25/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
python
Domain
backend

Research direction

Start in _extract_sections in src/harbor/agents/terminus_2/terminus_xml_plain_parser.py, which only warns when <analysis> or <plan> is missing, then compare with _validate_json_structure for the JSON format. Check how _run_agent_loop decides whether to skip a turn. Done means a reply missing a required XML section returns an error and its commands are not run, matching JSON. Pull request #4281 is already open against this, so check it before starting.

Written by the indexing model from the issue text.

Description

The XML format's prompt lists <analysis> and <plan> as required sections, but _extract_sections in src/harbor/agents/terminus_2/terminus_xml_plain_parser.py only adds a warning when either is missing. _run_agent_loop skips a turn only on an error, so the reply's commands still run.

The JSON format treats the same omission as an error: _validate_json_structure returns Missing required fields: ... and the turn is not executed.

from harbor.agents.terminus_2.terminus_xml_plain_parser import TerminusXMLPlainParser

reply = """<response>
<analysis>
Look around.
</plan>
<commands>
<keystrokes duration="0.1">ls
</keystrokes>
</commands>
</response>"""
result = TerminusXMLPlainParser().parse_response(reply)
assert result.error  # fails: error is "", the reply is accepted and `ls` runs

I'd expect a reply missing a required section to be rejected in both formats.

Dominant language
Python
Stars
5.6k
Forks
1.9k
Avg merge
1d 17h
Merged PRs (30d)
156

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from harbor-framework/harbor

All issues in harbor-framework/harbor

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.