open --prompt with no session hook drops the prompt and the session, and still exits 0 #555

Closed
opened 2026-09-14 09:54:22 +00:00 by mph · 1 comment
Owner

iw open <key> --prompt "..." asks for two things: open the session, and send it a prompt. With no session action hook installed the user gets neither.

WorkspaceSession.enterAfterHooks:

case SessionHookResult.NoHooks =>
  if ctx.prompt.isDefined then
    env.console.out("Warning: --prompt ignored: no session action hook installed")
    CommandResult.ok
  else join(sessionName, state, env)

Three separate problems.

  1. The undeliverable prompt costs the session too. Not sending the prompt is honest. Skipping join as well is an unrelated penalty — the session exists, is ready, and the user is not put into it. The no-prompt path joins; the prompt path should too.

  2. The warning names an internal concept and offers no next step. "No session action hook installed" describes the plugin architecture to somebody who typed a command. iw-cli's own gate rule is that every blocking result carries the command that clears it, because the hint is the whole interface. This one carries nothing — not what to run instead, not where a hook would come from.

  3. It exits 0 having not done what was asked. A script cannot distinguish a prompt that ran from a prompt that vanished.

There is a fourth, subtler one: the same flag behaves differently on start and on open, and the difference is an invisible plugin detail — start has a hook, open does not.

Suggested shape, in order of preference:

  • Join the session anyway, and print the prompt so it can be pasted: the user keeps the session and loses only the automation.
  • Say what to do next, in the terms of the caller: "no session action hook is installed, so the prompt was not sent; the session is ready — run it there by hand".
  • Consider a non-zero exit when an explicitly requested action could not be performed, so a caller can tell.

Found while looking for a single terminal command to run a triage in an existing worktree.


Type: bug
Filed from: /home/mph/Devel/iw/iw-cli-IW-517 on branch IW-517

`iw open <key> --prompt "..."` asks for two things: open the session, and send it a prompt. With no session action hook installed the user gets neither. `WorkspaceSession.enterAfterHooks`: case SessionHookResult.NoHooks => if ctx.prompt.isDefined then env.console.out("Warning: --prompt ignored: no session action hook installed") CommandResult.ok else join(sessionName, state, env) Three separate problems. 1. **The undeliverable prompt costs the session too.** Not sending the prompt is honest. Skipping `join` as well is an unrelated penalty — the session exists, is ready, and the user is not put into it. The no-prompt path joins; the prompt path should too. 2. **The warning names an internal concept and offers no next step.** "No session action hook installed" describes the plugin architecture to somebody who typed a command. iw-cli's own gate rule is that every blocking result carries the command that clears it, because the hint is the whole interface. This one carries nothing — not what to run instead, not where a hook would come from. 3. **It exits 0 having not done what was asked.** A script cannot distinguish a prompt that ran from a prompt that vanished. There is a fourth, subtler one: the same flag behaves differently on `start` and on `open`, and the difference is an invisible plugin detail — `start` has a hook, `open` does not. Suggested shape, in order of preference: - Join the session anyway, and print the prompt so it can be pasted: the user keeps the session and loses only the automation. - Say what to do next, in the terms of the caller: "no session action hook is installed, so the prompt was not sent; the session is ready — run it there by hand". - Consider a non-zero exit when an explicitly requested action could not be performed, so a caller can tell. Found while looking for a single terminal command to run a triage in an existing worktree. --- **Type:** bug **Filed from:** `/home/mph/Devel/iw/iw-cli-IW-517` on branch `IW-517`
Member

Intake: agent-ready
Workflow: diagnostic
Reason: all gates passed
Analysis: project-management/issues/IW-555/analysis.md on branch IW-555

Intake: agent-ready Workflow: diagnostic Reason: all gates passed Analysis: project-management/issues/IW-555/analysis.md on branch IW-555
mph closed this issue 2026-09-21 07:33:04 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
iterative-works/iw-cli#555
No description provided.