Files
vscode/src
Don Jayamanne ed12abf557 agent-host: complete the turn when /compact finishes (#320544)
* agent-host: complete the turn when `/compact` finishes

`/compact` in AHP Copilot sessions short-circuited `send()` by calling
`rpc.history.compact()` and returning early without driving an SDK turn.
Turn completion is only emitted from the SDK's `onIdle` event, so the
turn opened by the server was never closed and the UI spun "working
forever" (#320152).

Mirror the generic `/rename` handling: after the compact RPC resolves,
emit a brief acknowledgement response and complete the active turn so
the session returns to idle. This routes through the same
`_runTurnCompleteSideEffects` path as normal `onIdle` completion, so
queued-message draining and turn telemetry are unaffected. The error
path is unchanged (re-throws → `SessionError` ends the turn).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* agent-host: emit `/compact` acknowledgement and assert no SDK send

Address Copilot review on #320544:
- Emit the acknowledgement `SessionResponsePart` before completing the
  turn (the previous commit assigned `success` but never used it, which
  also left it unused for `noUnusedLocals`). This restores the
  `/rename`-style inline acknowledgement.
- Assert the failed-compaction test does not fall through to
  `session.send()`.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* agent-host: don't emit response content for `/compact`

Per review feedback, `/compact` should silently complete its turn rather
than emitting a markdown acknowledgement into the session transcript. The
compact RPC result is no longer inspected; the turn is completed inline so
the session returns to idle. Tests updated to assert no SessionResponsePart
is emitted.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-06-09 05:45:37 +00:00
..