Repository navigation
Commit c32db63
committed
fix(agent): #102 review — stacked marks count, and a lone mark is not emphasis
Two findings, both on saysDone(), both right.
1. One mark was taken off a line start, where a model may stack several.
"> ## **Done:** …" and "- > **Done:** …" were still read as unfinished, and
with a "next " in the answer still nudged — the bug this branch is for, in
another shape. Reproduced on the reviewed code through the loop: a second
turn is requested for both.
The line-start strip now takes every mark stacked there.
2. Every `*`, `_`, backtick and `~` was deleted before the line was looked
for, and a lone mark is not emphasis: it is part of a name. A turn that
said "Let me write config.yaml:" and then pasted
```yaml
_done: false
```
was read as finished. develop nudges that turn; the reviewed code ended the
run without the write it promised. So this was a regression the first
commit made, and it reached further than YAML: a Python field,
`_done: bool = False`, and a JS key, `_done: false,`, were read the same
way.
Emphasis is now unwrapped only as a pair, and only where it opens the line:
an opening run of marks before a non-space, a closing run after one, and no
word character after the closing run — so the `_` inside `default_factory`
closes nothing. **Done:**, **Done**:, a whole sentence in bold or italics,
`Done:` as code and **_Done:_** are all still found: 520 combinations of
stacked marks, emphasis and where it closes were checked, and none is
missed. Nine lone-mark lines that the reviewed code took for a Done line no
longer are.
Found while doing it: the line test could take seconds to say no.
/(^|\n)\s*done/ lets the whitespace run across lines, so from every line start
it read on through all the blank lines below. The work grows with the square
of their number — 64,000 blank lines took 1.8 seconds on a quiet machine,
128,000 took 7 — and that is on develop, for a turn that degenerates into line
breaks. This branch had widened it: once marks are stripped, a line of nothing
but marks is a blank line too.
The whitespace now stays on its line, /(^|\n)[^\S\n]*done/. It is the same
test: over 5.6 million strings, exhaustive to six tokens and random beyond,
the two never disagree. The same inputs now answer in milliseconds.
The last-word test still reads the text as written, as decided. Its comment
gave a reason that no longer holds — with pairs only, a fence's backticks are
not taken away, so the pasted shell loop is nudged either way — and now gives
the one that does: a turn whose last line is the quoted keyword, `done`.
test/agentDone.test.js goes from 7 to 10 cases: stacked marks and every way a
pair can close; lone marks, the pasted file among them; that pasted file
through the real loop, still nudged; and the line test's pattern read out of
the source, because no verdict can tell the two patterns apart and a clock in
a test is a flake. It fails 4 cases on the reviewed commit. Thirteen mutations
of the new code each fail a case.
50 suites, 972 cases, 0 failing (scripts/test-extensions.sh) on this commit's
tree, on macOS with Node 24 and in a Linux container with Node 20. With the
checkout's tsc, agent.js still reports develop's 94 diagnostics.
Unchanged: a "- Done: parser" bullet in a progress list ends a run that also
promises more work, and so does a YAML list item, "- done: false", in a pasted
file. develop nudges both. They come with the list case, which reads a mark,
not emphasis. A Done line behind an emoji is still not recognised.
Not run in the editor against a live model.1 parent 63249cb commit c32db63
2 files changed
Lines changed: 80 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
719 | 719 | | |
720 | 720 | | |
721 | 721 | | |
722 | | - | |
| 722 | + | |
723 | 723 | | |
724 | 724 | | |
725 | 725 | | |
| |||
728 | 728 | | |
729 | 729 | | |
730 | 730 | | |
731 | | - | |
732 | 731 | | |
733 | | - | |
734 | | - | |
735 | | - | |
736 | | - | |
737 | | - | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
738 | 745 | | |
739 | 746 | | |
740 | 747 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
109 | 115 | | |
110 | 116 | | |
111 | 117 | | |
| |||
126 | 132 | | |
127 | 133 | | |
128 | 134 | | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
129 | 168 | | |
130 | 169 | | |
131 | 170 | | |
| |||
143 | 182 | | |
144 | 183 | | |
145 | 184 | | |
146 | | - | |
147 | | - | |
148 | | - | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
149 | 189 | | |
| 190 | + | |
150 | 191 | | |
151 | 192 | | |
152 | 193 | | |
| |||
171 | 212 | | |
172 | 213 | | |
173 | 214 | | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
179 | 237 | | |
180 | 238 | | |
181 | 239 | | |
| |||
0 commit comments