Skip to content

Commit-message Cancel silently no-ops when clicked before the generation process spawns #10855

Closed

Description

@nwparker

Summary

Cancel on commit-message generation silently no-ops if clicked before the generation process spawns. This affects the ordinary single-repo path, not just folder workspaces.

Mechanism

The cancel token is installed into the lane map only after the child process is spawned:

src/main/text-generation/commit-message-text-generation.ts:639

cancelTokensByLane.set(laneKey, cancelToken)

Everything before that point is awaited work — runtime git target resolution, settings resolution, the staged-context read, env prep. On a large staged diff, a cold SSH connection, or a slow provider-settings read, that window is comfortably long enough to click Cancel in.

Cancellation looks the token up by cwd lane:

commit-message-text-generation.ts:535

cancelTokensByLane.get(localLaneKey('commit-message', cwd))?.()

The ?. means a miss is indistinguishable from success. Every caller is fire-and-forget, so nothing surfaces the miss: the button appears to work, the spinner keeps going, and the draft lands anyway.

Repro

  1. Stage a large diff (enough that context assembly takes a beat), ideally over SSH.
  2. Click Generate commit message.
  3. Click Cancel immediately — before the model starts streaming.
  4. The generation completes and overwrites the commit message box.

Expected

A Cancel issued at any point after Generate should stop the generation, including before spawn.

Suggested direction

Either install the cancel token before the pre-spawn awaits (so it exists for the whole lifetime of the request), or record a pending-cancel flag on the lane that the spawn step consumes and aborts on. The second avoids a token that can't yet do anything; the first is simpler if the token can be made a no-op-until-armed.

Worth covering in tests: cancel before spawn, cancel during spawn, and cancel after spawn all reaching the same terminal state.

Provenance

Found while reviewing #10819 (folder-workspace git routing). Confirmed pre-existing and out of that PR's scope — git diff origin/main..HEAD is empty for this file, and origin/main has the identical post-spawn cancelTokensByLane.set at the same line. Filing separately because the fix touches shared generation lifecycle rather than folder-workspace routing.

Made with Orca 🐋

Activity

  1. added a commit that references this issue on Nov 15, 2026
    458b0f0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions