Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.
Python agentagent-osaiai-agentsai-partnerchatopsclaudeclaude-codecodexdevtoolsdiscord-botlark-botllmlocal-firstlong-term-memoryopencodeslack-botvibe-codingvibeywechat
fix(agent-core): accept checkpoint section markers at heading levels 1 to 3 (#2453)
Call White84254be1773d
diff --git a/core/agent_core/harness/context.py b/core/agent_core/harness/context.pyindex ec6078fb0..550075de0 100644--- a/core/agent_core/harness/context.py+++ b/core/agent_core/harness/context.py@@ -570,19 +570,26 @@ def checkpoint_text(message: AssistantMessage) -> str:)-#: The approved template's top-level section markers (section 11), whatever language the headings are in.-_SECTION = re.compile(r"^#[ \t]*([123])\.", re.M)+#: The approved template's top-level section markers (section 11), whatever language the headings are in: written+#: ``# 1.`` there, or one or two levels deeper in a reply.+_SECTION = re.compile(r"^(#{1,3})[ \t]*([123])\.", re.M)def checkpoint_problem(reply: str) -> Optional[str]:"""Why a checkpoint turn's reply is not a checkpoint, or None when it is (section 6), judged on what the userwould see of it: the product's one silent-block grammar (``strip_silent_blocks``, which delivery uses) removes its- ``<silent>`` notes first. Then the template's three top-level markers (``# 1.``, ``# 2.``, ``# 3.``) appear- exactly once each, in order, each section with content under its heading (a line that is not itself a heading).- The one check every checkpoint path applies."""+ ``<silent>`` notes first. Then the template's three section markers (``# 1.``, ``# 2.``, ``# 3.``, each written at+ heading level 1 to 3) appear exactly once each, in order, each section with content under its heading (a line+ that is not itself a heading). The markers at the template's own level are judged first, so a numbered+ sub-heading under them stays content. The one check every checkpoint path applies."""visible = strip_silent_blocks(reply)markers = list(_SECTION.finditer(visible))- numbers = [marker.group(1) for marker in markers]+ problem = _sections_problem(visible, [marker for marker in markers if len(marker.group(1)) == 1])+ return None if problem is None else _sections_problem(visible, markers)+++def _sections_problem(visible: str, markers: Sequence[re.Match[str]]) -> Optional[str]:+ numbers = [marker.group(2) for marker in markers]for number in "123":if number not in numbers:return f"section {number} is missing"diff --git a/docs/plans/agent-core-contracts/context.md b/docs/plans/agent-core-contracts/context.mdindex a6d5a1127..451bdad5a 100644--- a/docs/plans/agent-core-contracts/context.md+++ b/docs/plans/agent-core-contracts/context.md@@ -204,10 +204,12 @@ below, and the budget's 5 rounds, 4,000-token floor, and 1,000-token slack; C-10with calls continues the turn. That text is a checkpoint only if one validator, the same for every checkpointturn (normal and rolling), accepts it, judged on what the user would see of it: the product's one silent-blockgrammar (`core/reply_enhancer.strip_silent_blocks`, which delivery uses) removes its `<silent>` notes first. Then- the template's three top-level section markers (`# 1.`, `# 2.`, `# 3.` at the start of a line, whatever language- the headings are in) appear exactly once each, in order, each section with content under its heading (a line that- is not itself a heading). A reply wrapped in, or made only of, a `<silent>` note, or with a section missing,- repeated, out of order, or empty, is no checkpoint. Anything else (a response refused at admission, a length stop, a `tool_use` stop without calls, calls+ the template's three section markers (`# 1.`, `# 2.`, `# 3.` at the start of a line, whatever language the+ headings are in, each written at heading level 1 to 3: `# 1.`, `## 1.`, or `### 1.`) appear exactly once each, in+ order, each section with content under its heading (a line that is not itself a heading). The markers at the+ template's own level (`#`) are judged first, so a numbered sub-heading under them stays content; only when they do+ not form a checkpoint are the markers at all three levels judged. A reply wrapped in, or made only of, a `<silent>`+ note, or with a section missing, repeated, out of order, or empty, is no checkpoint. Anything else (a response refused at admission, a length stop, a `tool_use` stop without calls, callsunder any other stop, an error, no text, or a reply the validator rejects) is a failure: it counts as unproductive(§10), nothing enters the context, the old context is kept, and the ladder continues; the reply's text is only inthe audit row. So is a checkpoint whose row the host cannot complete (§10, invariant 4).diff --git a/tests/agent_core/agent/test_context.py b/tests/agent_core/agent/test_context.pyindex b845d5c78..125317fb0 100644--- a/tests/agent_core/agent/test_context.py+++ b/tests/agent_core/agent/test_context.py@@ -801,6 +801,17 @@ def test_a_displayed_path_or_skill_name_is_one_line_of_plain_text():_VALID = "# 1. Self and method\n- terse\n# 2. Goals and requirements\n- fix it\n# 3. Now and next\n- read f05 next"+# A real claude-haiku-4-5 checkpoint reply (A6 acceptance, 2026-10-11), trimmed: complete in substance, with+# section 2's marker written one level deeper than the template's.+_HAIKU_REPLY = (+ "# 1. Self and method\n\n## How I work here\n- User expects me to complete a review task: read 6 files in big/\n"+ "- Working agreement: read every file completely, then list each file with line count. Do not write anything yet."+ "\n\n## 2. Goals and requirements\n\n## Goals\n- Review six files in big/ for error-handling weaknesses\n\n"+ "## User requirements\n- Do not write anything yet\n\n## Key decisions\n(none)\n\n## Pitfalls\n(none)\n\n"+ "# 3. Now and next\n\n## Progress\n### Done\n- Listed files in big/ and obtained line counts via wc\n\n"+ "### In progress\n- Reading all 6 files completely\n\n## Next steps\n1. Read anthropic.py.txt (1018 lines)\n\n"+ "## Exact references\n- Output: `/home/avibe/a6-acceptance/out/v7-review.md`"+)@pytest.mark.parametrize(@@ -818,6 +829,17 @@ _VALID = "# 1. Self and method\n- terse\n# 2. Goals and requirements\n- fix it\n("# 1. Self and method\n# 2. Goals\n- g\n# 3. Now\n- n", "section 1 is empty"),("# 1. Self\n## How I work here\n# 2. Goals\n- g\n# 3. Now\n- n", "section 1 is empty"),("# 1. Self\n- s\n# 2. Goals\n- g\n# 3. Now and next", "section 3 is empty"),+ # A marker may be written one or two levels deeper than the template's, alone or mixed; it stays positional.+ (_HAIKU_REPLY, None),+ ("## 1. Self\n- s\n## 2. Goals\n- g\n## 3. Now\n- n", None),+ ("### 1. Self\n- s\n### 2. Goals\n- g\n### 3. Now\n- n", None),+ ("## 1. Self\n- s\n### 2. Goals\n- g\n# 3. Now\n- n", None),+ ("#### 1. Self\n- s\n#### 2. Goals\n- g\n#### 3. Now\n- n", "section 1 is missing"),+ ("## 1. Self\n- s\n## 3. Now\n- n", "section 2 is missing"),+ ("## 2. Goals\n- g\n# 1. Self\n- s\n# 3. Now\n- n", "a section marker is repeated or out of order"),+ ("## 1. Self\n## 2. Goals\n- g\n## 3. Now\n- n", "section 1 is empty"),+ # Under the template's own markers a numbered sub-heading is content, not another section.+ ("# 1. Self\n- s\n# 2. Goals\n### 1. First goal\n- g\n# 3. Now\n- n", None),(f"<silent>\n{_VALID}\n</silent>", "section 1 is missing"),# The product's own silent grammar decides what is hidden, exactly as delivery would: any case, attributes,# a spaced closing tag; and a tag shown in a code span hides nothing.