IW-555: an undeliverable --prompt costs the automation, not the session #580

Merged
mph merged 23 commits from IW-555 into main 2026-09-21 07:33:04 +00:00
Member

Summary

iw open --prompt "…" and iw start --prompt "…" ask for two things: put the
caller into the worktree session, and send that session a prompt. When no
session action hook was there to take the prompt, the caller got neither —
and the command exited 0.

This branch makes the undeliverable prompt cost only the automation:

  • The caller keeps the session. NoHooks and SetupOnly now join exactly
    as the no-prompt path does. Skipping the join was an unrelated penalty.
  • The message carries the next step. Instead of naming the plugin
    architecture ("no session action hook installed"), the command prints the
    prompt itself: The prompt was not sent. Run it in the session by hand: ….
  • A script can tell. A new exit code 5 (CommandResult.promptNotSent)
    means "session open, prompt not sent", declared on open, start and
    analyze. A failed join still exits 1.

The SetupOnly branch — silent prompt loss on any repository with an .envrc
or a zvec-grep index — was the worse of the two cases and is fixed by the same
condition.

Defects fixed

Phase Defect PR
1 --prompt with no action hook drops the prompt, skips the join, and exits 0 (NoHooks) #564
2 A setup hook fires and --prompt is dropped in silence (SetupOnly) #576

Testing

  • core/test/OpenHarnessTest.scala, core/test/StartHarnessTest.scala — the
    prompt is printed, the session is joined, and the exit code is 5; a failed
    attach still exits 1; a setup hook with no prompt attaches silently.
  • test/open-prompt.bats, test/start-prompt.bats, test/analyze.bats — the
    wiring smoke tests follow the new message and exit code.
  • docs/api/SessionHooks.md corrected to describe what the branches now do.

Reproduce with IW_PLUGINS_DISABLED=1 and IW_HOOK_CLASSES unset — on a
developer machine the kanon plugin supplies an action hook for open and
hides the symptom.

Release notes

project-management/issues/IW-555/release-notes.md (Czech, user-facing).

Follow-ups filed

  • #577 — IW_CORE_JAR is exported into every iw open session and makes one
    worktree run another worktree's jar (found while comparing against a
    baseline; see LESSONS.md).

Closes #555

🤖 Generated with Claude Code

## Summary `iw open --prompt "…"` and `iw start --prompt "…"` ask for two things: put the caller into the worktree session, and send that session a prompt. When no session *action* hook was there to take the prompt, the caller got neither — and the command exited 0. This branch makes the undeliverable prompt cost only the automation: - **The caller keeps the session.** `NoHooks` and `SetupOnly` now join exactly as the no-prompt path does. Skipping the join was an unrelated penalty. - **The message carries the next step.** Instead of naming the plugin architecture ("no session action hook installed"), the command prints the prompt itself: `The prompt was not sent. Run it in the session by hand: …`. - **A script can tell.** A new exit code 5 (`CommandResult.promptNotSent`) means "session open, prompt not sent", declared on `open`, `start` and `analyze`. A failed join still exits 1. The `SetupOnly` branch — silent prompt loss on any repository with an `.envrc` or a zvec-grep index — was the worse of the two cases and is fixed by the same condition. ## Defects fixed | Phase | Defect | PR | |-------|--------|----| | 1 | `--prompt` with no action hook drops the prompt, skips the join, and exits 0 (`NoHooks`) | #564 | | 2 | A setup hook fires and `--prompt` is dropped in silence (`SetupOnly`) | #576 | ## Testing - `core/test/OpenHarnessTest.scala`, `core/test/StartHarnessTest.scala` — the prompt is printed, the session is joined, and the exit code is 5; a failed attach still exits 1; a setup hook with no prompt attaches silently. - `test/open-prompt.bats`, `test/start-prompt.bats`, `test/analyze.bats` — the wiring smoke tests follow the new message and exit code. - `docs/api/SessionHooks.md` corrected to describe what the branches now do. Reproduce with `IW_PLUGINS_DISABLED=1` and `IW_HOOK_CLASSES` unset — on a developer machine the `kanon` plugin supplies an action hook for `open` and hides the symptom. ## Release notes `project-management/issues/IW-555/release-notes.md` (Czech, user-facing). ## Follow-ups filed - #577 — `IW_CORE_JAR` is exported into every `iw open` session and makes one worktree run another worktree's jar (found while comparing against a baseline; see `LESSONS.md`). Closes #555 🤖 Generated with [Claude Code](https://claude.com/claude-code)
open --prompt with no session hook drops the prompt and the session, and still exits 0

Artifacts:
- analysis.md

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011M2HjEYoJpcfD43KYP6zxt
open --prompt with no session hook drops the prompt and the session, and still exits 0

Artifacts:
- tasks.md
- review-state.json (tasks_ready)

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011M2HjEYoJpcfD43KYP6zxt
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011M2HjEYoJpcfD43KYP6zxt
Issue: IW-555
Phase: 1 - `--prompt` with no action hook drops the prompt, skips the join, and exits 0 (`NoHooks`)

This commit marks the checkpoint for phase 1 context generation.
Use dx-fix IW-555 to return to this point.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
`--prompt` with no action hook drops the prompt, skips the join, and exits 0 (`NoHooks`)

Artifacts:
- phase-01-tasks.md

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
`phase-merge` merged pull request #564 on the forge, then failed to check out
IW-555 because a stale index entry for review-state.json looked like a local
change. The advance that follows the merge did not run, so the card still said
`ci_failed` and the phase index still had phase 1 open.

This writes what a successful advance writes: the merged card, and the phase 1
box checked.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0179JhvXg4eopsQNmDLUSuim
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0179JhvXg4eopsQNmDLUSuim
Issue: IW-555
Phase: 2 - A setup hook fires and `--prompt` is dropped in silence (`SetupOnly`)

This commit marks the checkpoint for phase 2 context generation.
Use dx-fix IW-555 to return to this point.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
A setup hook fires and `--prompt` is dropped in silence (`SetupOnly`)

Artifacts:
- phase-02-tasks.md

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
`phase-merge` merged pull request #576 and then failed the same way it failed on
phase 1: it checks out the feature branch while the gate's card write is still
uncommitted. This writes what a successful advance writes.

It also corrects the follow-up that recorded the defect. The first reading
blamed a stale git index. That was wrong: `ci-gate` writes review-state.json
with `ReviewStateWrite.tryUpdate`, which does not commit, so the checkout
refuses on a real local change. The commit that clears it runs after the
advance, not before.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0179JhvXg4eopsQNmDLUSuim
kanon 1.72.0 made CI the only full-suite run, and put the policy in the three
implementer agent prompts. Phase 2 of IW-555 ran under it and ignored it: four
suite runs over the same ground, for a phase that changed no production code.

The policy reached the agent and lost to this file. The test section led with
`./iw ./test` and offered nothing narrower than `unit`, which is two whole
modules — so the policy asked for a run the documentation gave no command for.

This adds "How much to run" at the head of the menu, moves the full-suite block
to the end as the exception, and adds two narrow commands, both verified: one
test class through Mill, and one BATS file through `bats` with `IW_CORE_JAR`
set. It also records that `./iw ./test e2e` takes no file argument.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0179JhvXg4eopsQNmDLUSuim
Follow-ups filed: 3 (#577, #578, #579), commented: 0, struck: 1
Lessons: 0 approved, 1 rejected, 0 still pending

Rejected:
- An absolute jar-path override makes one checkout run another checkout's build: the trap is removable and is filed as #577

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
docs(IW-555): add release notes
Some checks failed
CI / changes (pull_request) Successful in 3s
CI / contract (pull_request) Has been skipped
CI / format (pull_request) Successful in 13s
CI / lint (pull_request) Successful in 14s
CI / test (pull_request) Has been cancelled
CI / dashboard-build (pull_request) Has been cancelled
CI / compile (pull_request) Has been cancelled
3a64e863f5
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
chore(IW-555): update review-state to all_complete
All checks were successful
CI / changes (pull_request) Successful in 3s
CI / contract (pull_request) Has been skipped
CI / format (pull_request) Successful in 11s
CI / lint (pull_request) Successful in 10s
CI / compile (pull_request) Successful in 1m24s
CI / dashboard-build (pull_request) Successful in 1m18s
CI / test (pull_request) Successful in 16m23s
a585543126
mph merged commit c78392a8bc into main 2026-09-21 07:33:04 +00:00
Sign in to join this conversation.
No description provided.