Skip to content
PifeatureWeb22 files · +490 −252

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

1h 09msession
0interventions
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.

  1. Prompt · +0
    Several commands (e.g. /snake) can't run while Pi is streaming. Please think through how to allow this without breaking Escape-to-abort.
  2. Agent did · +0m
    Explored 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).
  3. Prompt · +3m
    Default busyAllowed to true for extension commands since it's pre-release with no users.
  4. Agent did · +3m
    Added 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.
  5. Prompt · +25m
    Please open a PR.
  6. Agent did · +25m
    Committed 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.
  7. Prompt · +34m
    There's a Codex review comment on the PR I don't understand — explain it in plain terms.
  8. Agent did · +35m
    Explained 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.
  9. Prompt · +50m
    Any opportunities to refactor this further?
  10. Agent did · +50m
    Proposed 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.
  11. Outcome · +1h 9m
    Two 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.

I tried this · 0

Discussion · 0

How Builds work