senpi icon indicating copy to clipboard operation
senpi copied to clipboard

Edit/write calls hang with no permission prompt when an edit rule uses a path pattern other than `*`

Open davidbgonz opened this issue 3 weeks ago • 7 comments

What happened?

With any edit rule whose pattern isn't *, edit/write calls that should prompt never show the approval prompt. The call stays running until aborted. It happens with both read-only and accept-edits. Bash prompts are fine. Removing the path-specific rule brings the prompt back. No tool_call_preflight_stalled line was logged.

@code-yeongyu/senpi 2026.11.10-2 (via omo-ai), Linux x64.

Steps to reproduce

  1. ~/.omo/agent/settings.json:
    {
      "permissionPreset": "read-only",
      "permission": { "edit": { ".omo/*": "allow" } }
    }
    
  2. Start a new session.
  3. Have the agent edit any file outside .omo/.

Also reproduces with accept-edits + "edit": { "*": "ask", ".omo/*": "allow" }.

Expected behavior

Edits outside .omo/ show the normal approval prompt. Edits under .omo/ are allowed without one.

Version

5.1.69

AI disclosure: the issue text above was drafted with an AI coding agent from my own config and testing, then reviewed by me.

davidbgonz avatar Nov 11 '26 22:11 davidbgonz

Reproduced the decision half on main (HEAD 285f83fb8e, 2026-11-11 13:43Z). I could not run a live omo-ai session on this Linux VM, so this is a source-side verification of the exact path, not an end-to-end hang capture.

Decision layer is not the bug. I ran the repo's real evaluator (permission-system/evaluate.ts + rulesForPreset + fromConfig) against your exact configs:

  • read-only + edit: {".omo/*": "allow"}: edit src/foo.ts → ask (matched preset edit *); edit .omo/x.json → allow (matched .omo/*).
  • accept-edits + edit: {"*": "ask", ".omo/*": "allow"}: edit src/foo.ts → ask; edit .omo/x.json → allow.

So an edit outside .omo/ correctly decides ask in both configs — the prompt should appear.

Side note (not the hang cause): the .omo/* allow rule only matches relative paths. Wildcard.match is not a substring match, so an absolute path like /home/u/proj/.omo/x.json still decides ask. If your edits carry absolute paths, the allow rule never bites.

Where the hang lives: service.ask() registers a pending request and awaits a human reply (pendingRequests.register → pendingPromise). index.ts shows the TUI prompt only when ctx.hasUI, otherwise handleNoUI rejects immediately — so a hang (rather than a fast reject) means the session has a UI and the reply never arrives. And agent-session.ts preflightToolCall states it plainly: "Neither wait below has a deadline of its own: one that never settles is logged once, never cut short (senpi#6189)". The prompt/reply path never completing matches your symptom exactly.

Two questions to pin it down:

  1. Is this session driven via omo-ai (RPC) or a local TUI? If RPC, the suspect is the ctx.ui.select dialog bridge to the desktop client, not the rule engine.
  2. Where did you look for the tool_call_preflight_stalled line? It goes through _sessionLogger.warn, so it lands in the session log file, not necessarily on console/stdout.

surlymochan avatar Nov 12 '26 05:11 surlymochan

Thanks @davidbgonz for the minimal config and repro steps, and @surlymochan for running the real evaluator against them. That narrows it down: the decision is correct (ask for an edit outside .omo/ in both configs), so the hang comes after the decision. The prompt is never shown or never answered, and the pending ask has no deadline of its own, so the call stays running until it's aborted.

To pin it down, please answer @surlymochan's first question: is this a local terminal session or one driven through the desktop app or another RPC client? If it's RPC, the suspect is the dialog bridge to the client, which would tie this to #6510 and #6470. One more thing worth knowing from that comment: a .omo/* rule only matches relative paths, so an edit addressed by absolute path won't hit the allow rule.

I've taken this into triage as a bug.

code-yeongyu avatar Nov 13 '26 13:11 code-yeongyu

This is a local install. One thing of note, however, that I need to look into if its a cause: I have omo installed as a custom nix pkg running in a FHS environment. Next time I'm on my machine I can check that.

davidbgonz avatar Nov 13 '26 14:11 davidbgonz

Thanks @davidbgonz, that helps. Since this is a local terminal session, the RPC dialog bridge isn't involved, which narrows it to the terminal prompt path itself: the rule decides ask, but the prompt never shows up in the TUI. The Nix FHS environment is worth checking when you're back. If you can, try the same config with a stock install (or outside the FHS wrapper) to see whether the prompt appears. That tells us whether it's an environment issue or a bug on our side.

code-yeongyu avatar Nov 13 '26 14:11 code-yeongyu

Follow-up on the FHS question: it reproduces outside the FHS wrapper and outside tmux.

Setup: fresh kitty window, TMUX unset, nix-shell -p nodejs bun, then node ~/.local/share/omo-ai/node_modules/omo-ai/bin/omo.js launched directly. Same config as the original report (read-only + edit: {".omo/*": "allow"}).

Verified not in the FHS env: my normal omo sessions run under bwrap (Nix buildFHSEnv). The test process's parent chain, read from /proc, is bun ← bash (nix-shell) ← fish ← kitty, with no bwrap ancestor. /usr/lib doesn't exist in that shell.

Result: a write outside .omo/ still hangs with no prompt. session.log:

{"ts":"2026-11-13T21:18:47.618Z","level":"warn","event":"tool_call_preflight_stalled","sessionId":"01a1d6c6-353f-7e35-a323-270b40fcee9d","toolName":"write","thresholdMs":30000,"elapsedMs":30000}

The transcript ends at the write call: no tool result, no permission entry.

An earlier non-FHS run inside tmux behaved the same (session 01a1d6bd…, stall logged 21:09:43Z).

Versions: omo 5.1.69, senpi 2026.11.10-2, NixOS (unstable), kitty.

Side note for the .omo/* relative pathing behavior. I used to have also a **/.omo/* rule but left it out for this issue to keep the minimal config down, since the issue is making edits outside of the .omo directory.

davidbgonz avatar Nov 13 '26 21:11 davidbgonz

Thanks @davidbgonz, that's a thorough check. With no bwrap ancestor, no tmux, and a direct node .../omo.js launch, the FHS environment is ruled out, and the tool_call_preflight_stalled line in session.log confirms the call is stuck waiting on the permission step itself. So this is a bug on our side: the rule decides ask, and the prompt never reaches the terminal. Your repro is enough for us to work from; nothing more is needed from you.

code-yeongyu avatar Nov 14 '26 02:11 code-yeongyu

AI-assisted diagnostic follow-up

Reproduced this admission race on main at 30918021e9; proposed correction: https://github.com/code-yeongyu/senpi/pull/6935.

PermissionService.ask() yields while preparing filesystem identity, before adding its pending request. The builtin preflight starts ask(), immediately checks list(), and can see an empty list. It then waits for an answer without opening the dialog that would provide that answer.

A portable reproduction uses an ask preset with a path-specific allow rule:

{
  "permissionPreset": "ask",
  "permission": {
    "read": { "approved.txt": "allow" },
    "edit": { "approved.txt": "allow" }
  }
}

For real read/write calls against another existing file, four Allow once/Deny cases stalled with zero prompts on the original code. Two preapproved controls completed without prompts. The maintained six-case regression now passes, checking actual read results, written bytes and denied-write immutability:

CI=1 bun run --cwd packages/coding-agent test test/suite/regressions/permission-async-path-prompt.test.ts

The PR subscribes before ask, waits for this request's pending admission or its completed decision, and removes the temporary listener before the existing prompt branch. Permission rules and the current abort-signal handling remain intact.

The new regression, neighboring abort/unload/shutdown regressions, affected permission checks, source build, full static check and separate built-SDK/CLI exercises were executed locally. Broader workspace limits are disclosed in the PR; this comment does not claim that full workspace suite passed.

Web-Usov avatar Nov 17 '26 23:11 Web-Usov