Commit 76a9f18
test(java): re-enable ModeHandlers exit_plan_mode E2E assertions (#2032)
* test(java): re-enable ModeHandlers exit_plan_mode E2E assertions
Remove the CLI 1.0.57 @disabled workaround and assert the canonical
action order (autopilot, interactive, exit_only) plus recommendedAction,
matching the other language SDKs after snapshot updates.
Fixes #1547
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix(java): use agentMode instead of mode for exit_plan_mode E2E test
The test was using MessageOptions.setMode("plan") which sets the
wire-protocol 'mode' field (prompt formatting only, e.g. the [[PLAN]]
prefix). The field that actually switches the CLI's active agent mode
and exposes the exit_plan_mode tool to the model is 'agentMode', set
via MessageOptions.setAgentMode(AgentMode.PLAN) - matching how the
Node.js and .NET reference E2E tests invoke this same scenario.
This was root-caused by capturing the Node SDK's actual outgoing
session.send payload and comparing it against Java's: Node sends
agentMode: "plan", Java was only sending mode: "plan". Without
agentMode set, the CLI never enters plan UI mode, so
exit_plan_mode is not registered as an available tool and the model's
tool call is rejected by the real (non-replayed) CLI, causing the
replay-proxy snapshot mismatch failure seen in CI.
Reproduced the original failure locally, confirmed this fix resolves
it, and validated on both JDK 25 and JDK 17 per java/README.md's
two-step build/test process.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Steve Sanderson <SteveSandersonMS@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 5b1381b commit 76a9f18
1 file changed
Lines changed: 8 additions & 5 deletions
Lines changed: 8 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
16 | | - | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
68 | 69 | | |
69 | 70 | | |
70 | 71 | | |
71 | | - | |
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | | - | |
| 102 | + | |
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
107 | | - | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
108 | 109 | | |
109 | 110 | | |
110 | 111 | | |
111 | 112 | | |
| 113 | + | |
112 | 114 | | |
113 | 115 | | |
114 | 116 | | |
115 | 117 | | |
| 118 | + | |
116 | 119 | | |
117 | 120 | | |
118 | 121 | | |
| |||
0 commit comments