core: agent silently stays in old directory when session_move fails ("Unable to move session to <dir>")
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 70/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- git, typescript
- Área
- tooling
Línea de trabajo
La asignación genérica de errores está en packages/core/src/tool/plugin/opencode.ts, en el Effect.mapError de la herramienta session_move. Compárala con la asignación de errores tipados en el manejador HTTP session.move y con worktree_remove en el mismo archivo. Reproduce el problema llamando a session_move en Code Mode con un directorio que no existe. Estará terminado cuando el fallo de la herramienta indique la causa, por ejemplo que el directorio no existe, en lugar de solo 'Unable to move session to ...'.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Description
After creating a worktree, the agent can end up working in the old directory without anyone noticing: session_move failed, the agent couldn't tell why, and it carried on by cd-ing into the worktree in every shell call. The session stayed in the old directory, so the worktree's AGENTS.md was never loaded and relative paths in read/edit/glob resolved against the wrong root.
How it happened (2.0.30, Sonnet 5.5): in one turn the model ran git fetch && git worktree add ../repo-x in a shell call and called tools.opencode.session_move to ../repo-x as a parallel tool call. The move ran ~100 ms after the shell started, before the fetch had finished, so the directory didn't exist yet. Rejecting the move was correct. But the tool result was only:
Unable to move session to /…/repo-x
so the model had no reason to retry. Calling session_move again once the directory existed worked.
Two things would make this recoverable:
- Say why the move failed.
packages/core/src/tool/plugin/opencode.ts(same ondev) maps every error to one message:Effect.mapError( (error) => new ToolFailure({ message: `Unable to move session to ${input.directory}`, error }), ),SessionMovealready fails with typed errors (DestinationNotFoundError,DestinationNotDirectoryError,DestinationUnavailableError,NotFoundError). Thesession.moveHTTP handler maps them to specific messages, andworktree_removein the same file maps its own errors, so the same pattern fits here. WithDirectory does not exist: …the model would most likely have retried. - Say when to call it. The injected hint ("When you create a worktree outside the current working directory … consider using
executeto calltools.opencode.session_move") and the tool description ("do not run destination-dependent tools in the same execute call") don't say the directory must exist first. Adding "call it after the command that creates the directory has finished, not in parallel with it" would likely have prevented this.
Plugins
No response
OpenCode version
2.0.30
Steps to reproduce
- In Code Mode:
await tools.opencode.session_move({ directory: "/tmp/does-not-exist" })
→Unable to move session to /tmp/does-not-exist(caught error:name: "Error", nocause) - Same move over HTTP:
opencode api post /api/session/<sessionID>/move --data '{"directory":"/tmp/does-not-exist"}'
→400 {"_tag":"InvalidRequestError","message":"Directory does not exist: /tmp/does-not-exist"} opencode.loghas no entry for the failed tool call.
Screenshot and/or share link
No response
Operating System
No response
Terminal
No response
- Lenguaje dominante
- TypeScript
- Estrellas
- 213k
- Forks
- 28.4k
- Merge medio
- 8 h 58 min
- PR fusionados (30 d)
- 251
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de anomalyco/opencode
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
anomalyco/opencode#56002 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
app: keybinds match the produced character, so Ctrl+F and other letter shortcuts fail on non-Latin layoutsPosiblemente ocupada @ZXLyyds100 la tomó hace 1 día. Abiertoreproduced
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
anomalyco/opencode#55676 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
tui: NumPad End/Home ignored under kitty keyboard protocol (Windows Terminal reports KP_END 57424)Posiblemente ocupada @argszero la tomó hoy. Abiertoreproduced
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
anomalyco/opencode#55533 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
anomalyco/opencode#55383 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
web: second Firefox tab never connects to /api/event - Cache-Control: no-cache lets Firefox's HTTP cache block concurrent SSE requestsPosiblemente ocupada @zonemeen la tomó hace 2 días. Abiertoreproduced
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
anomalyco/opencode#55369 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de anomalyco/opencode
Issues similares
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 75/100
siyuan-note/siyuan#20629 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Volume eject does not refuse system, root or /home mountsPosiblemente ocupada @bernardopg la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
spacedriveapp/spacedrive#3159 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
melgarafael/DeskcommCRM#3000 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
callstackincubator/simlock#639 ·
Los mantenedores suelen responder en 1 día