Repository navigation
fix: give the spec-mode examples a realistic task - #85
factory-droid[bot] wants to merge 3 commits into
Conversation
The spec-mode examples asked for a file "containing \"hello\"". Droid often read that as exact bytes with no trailing newline, which the file tools cannot write. It then asked the user (AskUser) or checked the bytes with a shell command. The examples cancel both, which ends the turn as interrupted and fails the nightly Examples run. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
|
The Nov 26 nightly on main failed the same way (droid 1.21.1): enter-spec-mode ended "interrupted" on both attempts on ubuntu/Node 22.23.5, and spec-mode-same-session needed a retry on macOS (https://github.com/Factory-AI/droid-sdk-typescript/actions/runs/45768917134). I reran this branch on droid 1.21.1 with |
factory-davidgu
left a comment
There was a problem hiding this comment.
This seems like an example change to please the tests, but the change in the example is not really useful for users. I think we should probably fix the test, and possibly make the examples more specific, but not like this
Ask for a short Markdown note instead of a file "containing" an exact string. The exact-string wording made Droid try to strip the newline that file tools add, through shell commands or AskUser, which the examples cancel, ending the turn. Drop the earlier trailing-newline prompt text. The enter-spec-mode check now looks for hello in the printed note. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
|
Agreed, thanks. The trailing-newline sentence was there only to keep the model on track, and it isn't useful to readers. I removed it, and the comments that explained it. I logged every permission request to see what actually fails. So, following your suggestion, I made the examples more specific in a way that matches real use: each one now asks for a short Markdown note ( Results (droid 1.23.0, no retries): harness 8/8 for each of the three examples. Separate logged runs: 12/12 for |
Description
What: The three spec-mode examples (
enter-spec-mode,spec-mode-same-session,spec-mode-new-session) now ask Droid for a short Markdown note (hello.md, a note that says hello, or one titled "Hello from Droid") instead of a filecontaining "hello". The permission handlers are unchanged. In the harness, theenter-spec-modecheck now looks for "hello" in the note the example prints, instead of requiring the last stdout line to be exactlyhello.enter-spec-modeprints the note under ahello.md:line so the check can tell it apart from the plan, which is printed earlier.Why: The scheduled Examples workflow keeps failing on
enter-spec-mode, andspec-mode-same-sessionsometimes needs retries. The failing runs end withTurn ended: interrupted.Root cause:
containing "hello"reads as exact file contents, and the prompt also rules out shell commands. File tools always end a file with a newline. So after writing a correct file, Droid keeps trying to remove that newline: it re-patches the file, runs read-only checks such aswhich vim, triesviornpm exec, or asks (AskUser) "How should I handle the trailing newline inhello.txt?". The handler cancels those commands, and the SDK cancelsAskUserbecause the examples set noaskUserHandler. A cancel ends the turn, so the example exits 1 even though the file is already on disk.A short note is a task where exact bytes don't matter. That is closer to how a user would use spec mode, and it removes the conflict without changing the handlers.
Supersedes #84. #84 lets
enter-spec-modeapprove low-impact shell commands. I tried that locally on droid 1.23.0, with anAskUserhandler added as well:enter-spec-modestill failed 3 of 12 runs, because Droid moved on to medium-impact commands (vi,npm exec) to strip the newline.Validation
npm test(14/14),npm run typecheck,npm run lint,npm run format:check,npm run check:docs: all pass.node scripts/run-examples.mjs --only enter-spec-mode,spec-mode-same-session,spec-mode-new-session --runs 8 --retries 0, droid 1.23.0, Linux: 8/8 for each example, about 50k credits per run.enter-spec-modespec-mode-same-sessionmain(containing "hello")enter-spec-modecheck fails when only the plan mentions hello and when thehello.md:marker is missing.workflow_dispatch(runs=2,retries=0): https://github.com/Factory-AI/droid-sdk-typescript/actions/runs/46186181964