Repository navigation
Commit 58fe982
committed
feat(core): restore session move and disable it for models only
The fork removed upstream's session move in 9c9ef04 when it added
session roots. Move is part of upstream's core session engine (a saved
`session.moved` event, a `move` inbox item, runner and execution
handoff, bus routing to both locations), so it cannot live in a plugin,
and upstream keeps changing it. In the last upstream merge about 12 of
27 conflicts came from the removal. Roots and move do not compete:
roots add folders a session can use, move changes its working folder.
This restores move exactly as upstream has it and keeps roots on top,
so the fork now only adds to upstream code in this area.
Restored from upstream (files now match upstream/dev)
- core: session/move.ts, runner/index.ts + runner/llm.ts (DrainResult.Moved,
move delivered at a safe step boundary), execution.ts (re-drain at
the new Location), inbox.ts (moveIDs), websearch.ts (forget affinity
on move)
- core tests: session-move, session-runner move scenarios,
subagent-lifetime, websearch
- schema: session-inbox.ts (move item no longer "replay-only")
- plugin-browser connection.ts (close on session.moved), sdk
`sessions.move` + its test
- app: move-based recovery on the missing-location screen, en.ts
strings, `session.moved` activity, and the two e2e specs
- gui-plugins details menu ("Move session to") and its i18n strings
- tui: dialog-open (keeps moved sessions in the open list),
location-missing recovery by moving, storybook story,
working-directory actions, tests for dialog-open and config
- script/drive/subagent-eviction.ts
Merged by hand (move added back next to the fork's roots code)
- schema/session-event.ts: `Moved` is back in `Definitions` (a public
event again); event-manifest test matches upstream
- core/session.ts: `move: moves.move` and SessionMove.node next to
addRoot/removeRoot and SessionDestination. destination.ts now imports
the three Destination*Error classes from move.ts instead of defining
duplicates with the same tags.
- tool/plugin/opencode.ts: upstream's `session_move` tool definition is
back next to `session_root_add` / `session_root_remove`. The system
hint still points models at roots.
- protocol + server: `POST /api/session/:id/move` and its handler are
back next to the root endpoints. Regenerated protocol openapi.json
and the client (move and root methods both present).
- plugin API (effect/promise SessionDomain, promise adapter), plugin
host, test host: `move` restored next to `root`
- client/solid/data.ts: upstream's `session.moved` reducer restored
next to the root reducers
- tui: `session.moved` handlers in app.tsx and session-tabs.tsx,
"Manage workspaces" command and shell `cd` moving an existing
session (prompt/index.tsx), `session.move` keybind (v2 and v1 map),
app-lifecycle and session-tabs tests
- tui workspaces dialog: `ctrl+m` moves again
(`dialog.move_session.move`); adding a root moves to `ctrl+y`
(`dialog.workspaces.add_root`). prompt-move.test is upstream's plus a
ctrl+y add-root test. data.test keeps the roots test and gets
upstream's moved test back. keybinds.mdx lists both.
Disabled for models only
- New fork plugin `custom.tool.session-move.disable`
(plugin/custom/disable-session-move.ts) removes the
`opencode_session_move` Code Mode tool. Custom plugins load after the
builtin opencode tools, so the removal wins. Users can still move
sessions from the TUI, app, API and SDK. A config permission rule
would also work, but a user rule could override it; this plugin
cannot be overridden by config.
- Test in tool-opencode.test.ts: the tool exists after the opencode
tools load, is gone after the plugin loads, and session_root_add stays.
make tests
- Added session-move.test.ts and tool-opencode.test.ts to
CORE_FORK_TESTS.
- `make tests` now runs each package's `test` script instead of bare
`bun test`. For core that is script/test.ts, which gives tests a
temporary HOME. Bare `bun test` loaded the real ~/.config/opencode
and ~/.claude skills, and with the fork's custom plugins active that
extra background work sometimes queried a test database after it had
closed ("RangeError: Cannot use a closed database"), failing a random
Session.move test. The same pair of files passed 5/5 with the
isolated script and failed about half the time without it.
Docs
- PATCH.md: "Session Roots (Move Removed)" becomes "Session Roots",
describes move as upstream's and unchanged plus the ctrl+m / ctrl+y
keys, and adds "Session Move Disabled for Models".
- tools.mdx keeps describing the root tools, since models in this fork
cannot see session_move.
Not changed on purpose
- `session.fork({ directory })` stays (fork feature, additive).
- The GUI details menu now moves again; it no longer adds roots.
Roots are still available from the TUI, Code Mode tools, API, client
and plugin APIs.
Verification
- bun turbo typecheck: 35/35 packages
- oxlint: 0 errors (its unrelated --fix rewrites were reverted)
- bun script/migration.ts --check: no schema changes
- make tests: tui 186, core 446, schema 7, sdk 3 pass, 0 fail
(core list run 2 more times: 446/0 each)1 parent 5898181 commit 58fe982
124 files changed
Lines changed: 2317 additions & 230 deletions
File tree
- packages
- app
- e2e/regression
- src
- runtime
- i18n
- server
- session/composer
- client/src
- effect
- api
- generated
- promise/generated
- solid
- core
- src
- plugin
- custom
- session
- runner
- tool/plugin
- test
- plugin
- gui-plugins/src/details
- i18n
- plugin-browser/src
- plugin/src
- effect
- promise
- protocol
- src/groups
- schema
- src
- test
- sdk
- src/effect
- test
- server/src/handlers
- tui
- src
- component
- prompt
- config
- v1
- context
- feature-plugins/system/storybook
- routes/session
- ui
- test
- cli/tui
- context
- script/drive
- services/www/src/docs/content/cli
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
140 | | - | |
| 140 | + | |
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
146 | | - | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
147 | 153 | | |
148 | 154 | | |
149 | 155 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
69 | 325 | | |
70 | 326 | | |
71 | 327 | | |
| |||
125 | 381 | | |
126 | 382 | | |
127 | 383 | | |
128 | | - | |
| 384 | + | |
129 | 385 | | |
130 | 386 | | |
131 | 387 | | |
132 | 388 | | |
133 | 389 | | |
134 | 390 | | |
135 | | - | |
| 391 | + | |
136 | 392 | | |
137 | 393 | | |
138 | 394 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
218 | 218 | | |
219 | 219 | | |
220 | 220 | | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
221 | 265 | | |
222 | 266 | | |
223 | 267 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | | - | |
| 29 | + | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
0 commit comments