Allow extension slash commands to run while Pi is streaming
Session from pi-for-excel-sessions on Hugging Face by thomasmustier · MIT · condensed by Coders Talk
Click a segment to jump to that moment
1h 09msession
0interventions
by library · 23h
GOAL
Enable extension slash commands (like /snake) to run while the agent is streaming, and fix the Escape-key handling so closing an extension widget doesn't abort the active stream.
- +0Prompt · +0Several commands (e.g. /snake) can't run while Pi is streaming. Please think through how to allow this without breaking Escape-to-abort.
- +0mAgent did · +0mExplored busy-command-policy, escape-guard, keyboard-shortcuts, command registry and extension API to map out why extension commands are blocked and how Escape currently aborts streams; laid out a two-part analysis (busy policy allowlist + escape ownership).
- +3mPrompt · +3mDefault busyAllowed to true for extension commands since it's pre-release with no users.
- +3mAgent did · +3mAdded a busyAllowed flag (default true) to extension commands, threaded it through extension-api, runtime-manager, sandbox-runtime and srcdoc, updated busy-command-policy to check metadata instead of a hardcoded allowlist, updated escape-guard to treat extension widgets as escape owners, updated docs and tests, and verified with npm run check, tests, and build.
- +25mPrompt · +25mPlease open a PR.
- +25mAgent did · +25mCommitted the changes, created an isolated worktree/branch off origin/main, cherry-picked the commit, opened PR #409, fixed the PR description, and confirmed CI checks passed.
- +34mPrompt · +34mThere's a Codex review comment on the PR I don't understand — explain it in plain terms.
- +35mAgent did · +35mExplained that making extension widgets claim Escape globally also affects unrelated autofocus logic; after developer agreement, added a separate doesExtensionWidgetClaimEscape() scoped only to abort paths, updated keyboard-shortcuts.ts and pi-input.ts, updated tests, pushed, waited for CI, resolved the review thread, and merged PR #409 to main.
- +50mPrompt · +50mAny opportunities to refactor this further?
- +50mAgent did · +50mProposed and implemented two refactors: a single doesUiClaimStreamingEscape() helper to unify the two escape-check call sites, and a shared slash-command-execution.ts module unifying the busy-check/enqueue logic used by both the Enter-key and command-menu-click code paths; opened PR #410, waited through the review polling window (no review appeared), rebased on main after CI conflicts, merged the PR, then cleaned up worktrees and stale branches.
- +1h 9mOutcome · +1h 9mTwo PRs merged to main: #409 (extension commands run while busy, opt-out via busyAllowed) and #410 (unified slash-command execution + escape guard refactor), all checks green, worktrees cleaned up.
VERDICT
Next time I'd ask upfront for the busyAllowed default and mention this is pre-release so it can just default to true, since that saved a back-and-forth. The Codex review catch on Escape scope was the real save — without it we'd have shipped a subtle autofocus regression, and letting the agent explain the review in plain terms before applying it stopped me from rubber-stamping a change I didn't understand.