Skip to content

fix(implementer): a stray closing fence is not file contents - #1577

Merged
jeremymanning merged 1 commit into
mainfrom
fix/implementer-trailing-fence-20261011
Oct 11, 2026
Merged

jeremymanning merged 1 commit into
mainfrom
fix/implementer-trailing-fence-20261011

Conversation

@jeremymanning

Copy link
Copy Markdown
Member

What happened

Canary PROJ-9999 on main at 4e4161c was kicked back at step 28. Two causes, both in changes made earlier in this series.

1. Reply recovery (#1573). Four implementer replies in a row (gpt-oss-120b) were correct YAML followed by one closing ``` with no opening fence, or a final ---. Strict parsing fails on either ("found character '`' that cannot start any token"; "expected a single document"). The fallback from #1573 then recovered the artifact but kept the stray line as the last line of the file, so compilable Python was refused:

[implementer] refusing to write 'code/run_totient_analysis.py': SyntaxError at line 317: invalid syntax

Line 317 was the fence. Before #1573 the fallback did not match this reply shape at all, so this path is a regression introduced there.

2. Pattern evidence (#1574). The collector listed all twelve files of a family but quoted only the first and last. The verifier rejected: "the provided evidence only shows the contents of two CSVs … cannot verify that each of them sums to its respective N".

Changes

  • yaml_extract.strip_trailing_markers() drops blank, fence and separator lines from the end of a reply, flush-left only. parse_yaml_lenient applies it, so these replies parse as YAML with no fallback; _regex_parse_implementer applies it too. An indented fence inside contents is kept.
  • _pattern_evidence quotes every file of a matched family when the family fits a 30 KB budget; a larger family quotes the first and last and states how many are listed but not quoted.

Tests

  • New fixture: the canary's real reply. It parses, and its Python compiles.
  • Six trailing forms (```, ```yaml, ---, ..., with blank lines, combined) written and executed through write_artifacts.
  • Fallback plus trailing fence; indented fence kept as content.
  • Small family quoted in full; 40-file family quotes the ends and reports 38 not quoted.

Contract, unit and integration suites: 8543 passed, 21 skipped. ruff==0.17.0 clean.

Not verified: a canary run with this change.

🤖 Generated with Claude Code

https://claude.ai/code/session_01V7QkYvK7jaE1QVY1ZMfAt2

PROJ-9999 canary on main at 4e4161c, 2026-10-11. Four implementer replies
in a row were correct YAML followed by one closing ``` (no opening fence) or a
final ---. Strict parsing fails on either. The fallback added in #1573 then
kept the stray line as the last line of the file, so compilable Python was
refused with "SyntaxError at line 317" on a line the model never wrote as code.
The cap was exhausted and the project was kicked back.

strip_trailing_markers() drops blank, fence and separator lines from the END
of a reply, flush-left only. parse_yaml_lenient uses it, so these replies parse
without any fallback; the fallback uses it too.

Also: the verifier is shown EVERY file of a pattern-matched family when the
family fits a 30 KB budget. Quoting the first and last of twelve got "the
evidence only shows the contents of two CSVs" and a rejection. A larger family
quotes the ends and says how many it left out.

Contract, unit and integration suites: 8543 passed. ruff 0.17.0 clean.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V7QkYvK7jaE1QVY1ZMfAt2
@jeremymanning
jeremymanning merged commit 2bbfa15 into main Oct 11, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant