Skip to content

fix(core): explain session move failures - #56059

Open
1052326311 wants to merge 2 commits into
anomalyco:devfrom
1052326311:session-move-reason
Open

1052326311 wants to merge 2 commits into
anomalyco:devfrom
1052326311:session-move-reason

Conversation

@1052326311

@1052326311 1052326311 commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #56038

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

session_move now reports the typed reason for a failed move to Code Mode, matching the existing HTTP messages. A missing worktree directory therefore tells the model what failed and can be retried after creation. The tool description and worktree hint say to wait for directory creation to finish. Unexpected failures remain defects.

How did you verify your code works?

The new owner-level test failed on the original generic message and passed after the fix. It checks the model-facing result, two other typed failures, and a successful retry after creating the destination.

  • cd packages/core && bun run script/test.ts test/tool-opencode.test.ts test/session-move.test.ts (20 passed)
  • cd packages/core && bun typecheck
  • bun x prettier --check and bun x oxlint on the three changed TypeScript files
  • cd packages/core && bun run build
  • git diff --check

Root bun run check was attempted but did not complete: @opencode/stats-app#typecheck could not resolve @solidjs/start after the dependency installation hit ENOSPC.

Screenshots / recordings

Not a UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Added by the opencode bot (AI-generated).

Related: #55035

@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified: I ran the #56038 reproduction (simulated model, Code Mode session_move to a missing directory) from source. On the base the model gets Unable to move session to …. With this PR it gets Directory does not exist: …. The core tests closest to the change pass and packages/core type-checks.

The public API is unchanged. Only the model-facing tool description, system hint and error messages differ.

Two small points are inline: using catchTag keeps the error mapping checked by the compiler instead of falling through to Effect.die, and the reworded hint drops why to move the session.

Related: #55035

@1052326311

Copy link
Copy Markdown
Contributor Author

Updated at cb07d5f: session_move now calls the typed core Session service and maps its four declared errors with catchTag, so future error variants fail typecheck rather than falling into Effect.die. The worktree hint again says why to move the session and waits for creation to finish. Verified 20 core tests across tool-opencode and session-move, core typecheck, core build, scoped oxlint and Prettier, and git diff --check. The root aggregate check remains incomplete because the earlier ENOSPC install left stats-app without @solidjs/start; it has not been rerun.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

core: agent silently stays in old directory when session_move fails ("Unable to move session to <dir>")

1 participant