write: create parent directories; minimal_tools: add lex_test; run.lex: stop discarding the final message - #100
Merged
Merged
Conversation
…x: stop discarding the final message
Three real bugs found by auditing a full 4-agent pipeline run
(LEX_PERSIST_TRACE=1) end to end:
1. write failed outright on any path whose parent directory didn't
exist yet — a bare "No such file or directory (os error 2)", no
hint to mkdir first. Every agent that hit this recovered by falling
back to a flat filename, but two prompts actively tell agents to
write into subdirectories that don't exist yet
(spec_agent: ".lex/specs/<module>_specs.lex",
test_agent: "tests/<module>_test.lex") — both ran into exactly this
during today's pipeline run, wasting real turns each time. Fixed by
mkdir -p'ing the parent directory (via std.process, already in the
tool's effect row — no Tool type change needed) before writing.
Also drops the now-stale "use plain filenames, not subdirectory
paths" pitfall from lex_lang.lex's own reference, which was
documenting the workaround rather than fixing the tool.
2. dynamic_tools() (what every local-model agent actually calls) never
included test_tool (lex_test) — it's cloud-only, in lex_tools(),
never in minimal_tools(). test_agent.lex's own prompt names
lex_test as how to verify a suite, but a local-model test run had
no way to call it. Today's run improvised with
lex_run(fn_name: "run_all") instead — which worked, genuinely
passed, but isn't recognised as a verification call by
lex-llm#51's is_verification_tool, so the run never got credit for
finishing and burned its full step budget anyway. Added
test_tool.tool() to minimal_tools().
3. bootstrap/run.lex's print_step discarded StepDone's actual message
(`io.print("")`) instead of printing it. A normal completion's text
already streamed via TextChunk deltas before StepDone, which is why
this went unnoticed — but a max_steps turn skips straight to
StepDone with no preceding deltas, so a run that hit the budget
printed nothing explaining why. Today's pipeline run's test node hit
this exactly: the log just stopped after the last tool call, no
[max_steps reached] anywhere, until the underlying trail (lex-trail,
LEX_PERSIST_TRACE) was inspected directly.
lex check --strict, lex fmt --check, lex test, and the bar-mode gate
are all green. ensure_parent_dir verified directly: creates a fresh
nested directory tree from nothing before write proceeds.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three real bugs found by auditing a full 4-agent pipeline run
(
LEX_PERSIST_TRACE=1, thanks to #99) end to end vialex-trail.writefailed on any nonexistent parent directory with a bare OSerror, no recovery hint — despite
spec_agent/test_agent's ownprompts telling them to write into
.lex/specs/.../tests/....Fixed by
mkdir -p'ing first, viastd.process(already in thetool's effect row — no
Tooltype change). Also drops the now-stale"use plain filenames" pitfall from
lex_lang.lex, which documentedthe workaround instead of the tool being fixed.
dynamic_tools()never includedlex_test— local-model agentshad no way to call the tool their own prompt names. Today's test run
improvised with
lex_run(fn_name: "run_all"), which genuinely passedbut isn't recognised by lex-llm#51's
is_verification_tool, so therun never got credit for finishing. Added
test_tool.tool()tominimal_tools().print_stepdiscardedStepDone's message (io.print(""))instead of printing it — invisible on a normal completion (its text
already streamed via
TextChunks) but amax_stepsturn skipsstraight to
StepDone, so a run that hit the budget printed nothingexplaining why. Exactly what happened to today's test node.
lex check --strict,lex fmt --check,lex test, and the bar-modegate are all green.
ensure_parent_dirverified directly.Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com