Skip to content

Reject ambiguous session navigation targets #897

Description

@benvinegar

Problem

hunk session navigate does not consistently enforce one complete navigation mode across the CLI and daemon API.

Two invalid or ambiguous requests currently pass validation:

  1. Directional navigation can be combined with absolute targets, for example:

    hunk session navigate <session-id> --next-comment --file src/app.ts --hunk 2

    Directional navigation wins and the file/hunk arguments are silently ignored.

  2. The daemon accepts absolute hunk or line navigation without filePath. It dispatches the command, but the live terminal cannot resolve an absolute target without a file.

These behaviors predate the comment-ID cleanup in #896, but that work makes the remaining validation gap explicit at the broker boundary.

Expected behavior

Navigation should select one complete mode:

  • comment ID: commentId only;
  • direction: commentDirection only;
  • absolute location: filePath plus either a hunk number or complete side/line coordinates.

For compatibility, a raw API request containing complete line coordinates alongside a hunk number may continue to prefer the exact line, but this precedence should be explicit and tested.

Acceptance criteria

  • Reject directional navigation combined with file, hunk, or line targets in both CLI and daemon validation.
  • Require filePath for daemon hunk and line navigation.
  • Preserve the documented exact-line precedence for compatible raw API requests.
  • Add CLI and broker regression tests for accepted and rejected mode combinations.
  • Keep the terminal bridge as a pass-through adapter.
  • Add a patch Changeset for the validation fix.

Context

This comment was generated by Pi using GPT-5.6 Sol

Metadata

Metadata

Assignees

No one assigned

    Labels

    agentsAgent-to-hunk communication (MCP, selections, comments)bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions