Skip to content

fix: let enter-spec-mode approve read-only commands - #84

Open
factory-droid[bot] wants to merge 1 commit into
mainfrom
droid/enter-spec-readonly
Open

factory-droid[bot] wants to merge 1 commit into
mainfrom
droid/enter-spec-readonly

Conversation

@factory-droid

@factory-droid factory-droid Bot commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Description

What: examples/node/enter-spec-mode.ts now also approves shell commands that Droid rates low impact (read-only). It still cancels every other tool call except the plan and the write to the output file.

Why: The scheduled Examples workflow failed on 2026-11-16, 17, 20, 21 and 22 with no change to main (every run was on a410305). There were two failures:

  • enter-spec-mode (11-20, 21, 22, across all three matrix jobs). After the plan is approved, Droid writes hello.txt. The Create tool stores hello\n, but the plan often says "no trailing newline". The model then checks the bytes with a read-only command (od -c or wc -c). The handler cancelled that command, and a cancel ends the turn, so Result.success is false (Turn ended: interrupted). One retry often failed the same way.
  • resume-session (11-16, 17). The model (gpt-6.1-sol then) tried a tool to "check the previous session". resumeSession() has no permission handler, so the SDK cancelled the call, which interrupted the turn. This has not happened since 11-18. It passed 6 of 6 local runs, so this PR leaves it unchanged.

This is not a Droid CLI regression. The enter-spec-mode failure reproduces at the same rate on droid 1.12.1, the version from the last passing days, and on 1.17.2 (2 of 4 failed on each, with retries off). The handler logs from those runs show the cancelled exec confirmation with impactLevel: "low" every time.

How: I added one more allowed case to the handler: ToolConfirmationType.Execute with impactLevel === 'low'. That uses Droid's own "read-only command" classification, the same one AutonomyLevel.Low uses. The example still cancels writes to other paths and any command Droid rates medium or high impact.

Validation

  • npm test, 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 --retries 0, droid 1.17.2:
    • before: 2 of 4 passed (both failures were a cancelled od -c)
    • after: 8 of 8 passed
  • Examples workflow on this branch through workflow_dispatch (all three node matrix jobs plus browser): linked in a comment below.

No unit test: the handler is inline in a runnable example, and npm test makes no model calls. The live harness above is the check that turns red without this change.

The model sometimes checks the bytes it wrote with a read-only shell
command such as `od -c hello.txt`. The permission handler cancelled it,
and a cancel ends the turn as interrupted, so the nightly Examples run
failed on about half of its attempts.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
@factory-droid

factory-droid Bot commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Examples workflow on this branch (workflow_dispatch, runs=2, retries=0, droid 1.18.0): https://github.com/Factory-AI/droid-sdk-typescript/actions/runs/45287567026

All jobs passed. Every Node example passed 2 of 2 on ubuntu/Node 20, ubuntu/Node 22.23.5 and macOS/Node 22.23.5, with no retries. That includes enter-spec-mode.

This branch has not been deployed

No deployments
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.

0 participants