docs(B-0844): zflash --agent flag — close docstring-vs-implementation gap on agent-driven mode#5374
Merged
AceHack merged 1 commit intoMay 27, 2026
Conversation
… gap on agent-driven mode (empirical 2026-05-26 USB re-flash bug)
Empirical anchor 2026-05-26: 3rd USB re-flash session, operator
authorized agent-driven zflash with Touch ID. Agent ran via
'bun zflash.ts | tail -50' which broke stdin → flash-usb's
readline returned empty → bail'd silently → tail filter swallowed
the bail error → iter-4.2 inject ran on PRE-EXISTING USB ESP →
operator saw 'safe to remove USB' + thought flash succeeded →
attempted to boot → 'i got the fingerprint but it didn't format'.
Root cause: zflash.ts docstring (lines 56-63) PROMISES 'agent
auto-types the yes <nonce> challenge' — but the implementation
uses execFileSync({stdio: 'inherit'}) with NO actual auto-type
mechanism. Per substrate-or-it-didnt-happen.md: the docstring
promise was WEATHER not SUBSTRATE.
Workaround (used in session): external expect wrapper. Worked
end-to-end (Flash complete; 1.51 GiB in 80s; iter-4.2 inject
clean). But external dep is fragile.
Target: add '--agent' flag to zflash.ts that uses spawn with
piped stdin/stdout — reads stdout for 'yes <nonce>' line,
auto-types response to stdin, passes everything through. ~30
lines. No new deps. Backward-compatible (default unchanged).
Preserves: Touch ID PAM gate (cannot be agent-bypassed), nonce
randomness (agent reads from stdout, can't pre-bake), runtime
acceptance (typing exact challenge IS acceptance), glass-halo
transparency (operator sees '[agent-mode: auto-typing yes XXXX]'
line so flow visible).
P1 priority: empirical failure mode + bounded scope + closes
substrate-honest gap.
Per 'backlog rows land immediately; decompose later' discipline.
Implementation can be follow-up PR; this row creates substrate
anchor + acceptance criteria.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
Pull request overview
Adds a new P1 backlog row (B-0844) documenting a docstring-vs-implementation gap in zflash.ts around “agent-driven mode” and outlining an implementation plan for a native --agent flag, plus updates the generated backlog index to reference the new row.
Changes:
- Added
docs/backlog/P1/B-0844-...mdwith problem statement, root cause, acceptance criteria, and an implementation sketch forzflash --agent. - Updated
docs/BACKLOG.mdto include the new B-0844 entry under P1.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| docs/backlog/P1/B-0844-zflash-agent-mode-native-implementation-close-doc-vs-implementation-gap-aaron-2026-05-26.md | New backlog row capturing the zflash agent-mode issue, workaround, and target implementation/acceptance criteria. |
| docs/BACKLOG.md | Adds the B-0844 link into the P1 index list. |
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.
What
Empirical anchor 2026-05-26: 3rd USB re-flash session surfaced a docstring-vs-implementation gap in zflash.ts.
Operator authorized agent-driven zflash with Touch ID. Agent ran `bun zflash.ts | tail -50` which:
Root cause
zflash.ts docstring (lines 56-63) promises:
But the IMPLEMENTATION uses `execFileSync({stdio: "inherit"})` with NO actual auto-type mechanism. Per `substrate-or-it-didnt-happen.md`: the docstring promise was WEATHER not SUBSTRATE.
Target
Add `--agent` flag to zflash.ts that uses `spawn` with piped stdin/stdout — reads stdout for "yes " line, auto-types response back to stdin, passes everything through.
~30-line change. No new deps. Backward-compatible (default behavior unchanged).
Preserves all safety rails
Workaround (used in session)
External `expect` wrapper worked end-to-end (Flash complete; 1.51 GiB in 80s; iter-4.2 inject clean). But external dep is fragile + agent-driven mode IS PROMISED in docstring — should be native.
Composes with
🤖 Generated with Claude Code