Repository navigation
fix(server): reject prompts when the session directory no longer exists - #52106
craigmoliver wants to merge 3 commits into
Conversation
Sessions persist their directory. If it is moved, renamed, or deleted, prompt_async returns 204 and then dies inside filesystem resolution, so clients see nothing happen. Check the directory up front for prompt, prompt_async, command, and shell and return a NotFoundError with a message the app surfaces in its "Prompt send failed" toast. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Lnd6NhhWiX7Z168fTNWnhM
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
The following comment was made by an LLM, it may be inaccurate: |
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused validation and regression test correctly address the reported silent failure.
Review effort: Balanced
Findings: None
What changed in this PR
Rejects runnable session operations when their persisted directory is missing, allowing clients to surface a clear 404 error.
Changes:
- Adds shared directory validation for prompt, async prompt, command, and shell handlers.
- Adds regression coverage for renamed session directories.
| File | Description |
|---|---|
packages/opencode/src/server/routes/instance/httpapi/handlers/session.ts |
Validates persisted session directories before execution. |
packages/opencode/test/server/httpapi-session.test.ts |
Tests the prompt_async 404 response. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
|
This branch has been upgraded to V2. We're no longer taking PRs for V1. If you think this is still relevant, please port it over and open it for V2. — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊 |
Issue for this PR
Closes #52108
Type of change
What does this PR do?
Sessions store their directory. If that folder is renamed, moved, or deleted,
prompt_asyncreturns 204 and the run then dies inFileSystem.realPathwith ENOENT, so the app shows nothing at all.This adds a
requireRunnableSessioncheck to theprompt,prompt_async,command, andshellhandlers. If the session directory is gone, the request fails up front with aNotFoundError("Session directory no longer exists: …"). The app's submit path already shows a "Prompt send failed" toast usingdata.message, so no app changes are needed.How did you verify your code works?
prompt_async, and expects a 404 with that messagebun test test/server/httpapi-session.test.ts: 22 passbun run typecheck: cleanScreenshots / recordings
N/A, server-side change.
Checklist