Preflight
Issue origin
Observed and reproduced in a real environment, then reduced to synthetic input.
Version and area
Commit 741d2e3c0162f785eb21a5fe609f9d93e0eb470b; control plane, goal bootstrap and Todo readback. Not host-specific. Reproduced with Python 3.13.12 on macOS.
Problem
A goal prompt enclosed in a Markdown code fence can produce state whose generated Todos are invisible to the shared parser. Start-goal collapses whitespace, so an otherwise closed multiline fence becomes one line. render_state_markdown inserts that line directly under ## Objective. The parser treats it as an opening fence and hides the remaining document.
Minimal reproduction
Run from a source checkout with Python 3.11 or later. This uses temporary synthetic state only.
from pathlib import Path
from tempfile import TemporaryDirectory
from loopx.bootstrap import render_state_markdown
from loopx.control_plane.todos.active_state_todo_parser import parse_todo_source
with TemporaryDirectory() as directory:
state = render_state_markdown(
project=Path(directory),
goal_id="objective-example",
adapter_kind="read_only_project_map_v0",
objective="```text Implement and validate the task. ```",
updated_at="2026-09-15T00:00:00+00:00",
goal_doc=None,
execution_profile=None,
)
items, archive, sources = parse_todo_source(state)
print(sources)
print(len(items["agent"]))
Expected behavior
Both generated Todo source sections remain readable. The generated connection-validation Todo is present. Objective examples are text, not additional authoritative Todo sections.
Actual behavior
The reproduction prints {'user': None, 'agent': None} and 0.
The focused regression also fails for a tilde fence and an open HTML comment. An unfenced Todo example in the objective is read as an additional Todo. Plain text and a properly closed multiline fenced example pass.
Proposed scope and validation
Isolate objective content in generated Markdown, preserve its text, and verify the direct objective readback path. Inspect both loopx/bootstrap.py:render_state_markdown and loopx/control_plane/projects/registry.py:_state_markdown. Do not weaken fence handling, change Todo authority, or migrate live goal state as a test.
Current regression result: four failing boundary cases, two passing controls, and one passing existing bootstrap test. Follow-up validation should cover bootstrap, project registration, Todo readback, and objective context readback.
Related merged PRs #4299 and #4097 address document ownership and canonical Todo recovery. Neither changes these objective writers.
Preflight
Issue origin
Observed and reproduced in a real environment, then reduced to synthetic input.
Version and area
Commit
741d2e3c0162f785eb21a5fe609f9d93e0eb470b; control plane, goal bootstrap and Todo readback. Not host-specific. Reproduced with Python 3.13.12 on macOS.Problem
A goal prompt enclosed in a Markdown code fence can produce state whose generated Todos are invisible to the shared parser. Start-goal collapses whitespace, so an otherwise closed multiline fence becomes one line.
render_state_markdowninserts that line directly under## Objective. The parser treats it as an opening fence and hides the remaining document.Minimal reproduction
Run from a source checkout with Python 3.11 or later. This uses temporary synthetic state only.
Expected behavior
Both generated Todo source sections remain readable. The generated connection-validation Todo is present. Objective examples are text, not additional authoritative Todo sections.
Actual behavior
The reproduction prints
{'user': None, 'agent': None}and0.The focused regression also fails for a tilde fence and an open HTML comment. An unfenced Todo example in the objective is read as an additional Todo. Plain text and a properly closed multiline fenced example pass.
Proposed scope and validation
Isolate objective content in generated Markdown, preserve its text, and verify the direct objective readback path. Inspect both
loopx/bootstrap.py:render_state_markdownandloopx/control_plane/projects/registry.py:_state_markdown. Do not weaken fence handling, change Todo authority, or migrate live goal state as a test.Current regression result: four failing boundary cases, two passing controls, and one passing existing bootstrap test. Follow-up validation should cover bootstrap, project registration, Todo readback, and objective context readback.
Related merged PRs #4299 and #4097 address document ownership and canonical Todo recovery. Neither changes these objective writers.