mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-14 18:39:33 +01:00
fix: refuse one-shot prompts on an adopted session (release review)
`POST /api/sessions/:id/run` had no adopted gate, so while the wrapper had no attached PTY it spawned `claude -p --dangerously-skip-permissions <prompt>` in /tmp, a launch every other adopted route refuses. The route answers INVALID_INPUT, and `runPrompt()` refuses too, which also covers the legacy `sendInput()` path and leaves no direct spawn in Session that an adopted session can reach. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7e70f6f0c3
commit
2c084966f1
6 files changed
+43
-5
No files matched your search
@@ -2070,6 +2070,15 @@ export function registerSessionRoutes(
|
||||
const { prompt } = parseBody(RunPromptSchema, req.body);
|
||||
const session = findSessionOrFail(ctx, id, req);
|
||||
|
||||
// Its own check: `runPrompt` starts a new local claude, and the answer has to say so
|
||||
// here rather than as a `session:error` after a success.
|
||||
if (session.isAdopted) {
|
||||
return createErrorResponse(
|
||||
ApiErrorCode.INVALID_INPUT,
|
||||
'One-shot prompts are not available for adopted sessions: Codeman did not start this agent'
|
||||
);
|
||||
}
|
||||
|
||||
if (session.isBusy()) {
|
||||
return createErrorResponse(ApiErrorCode.SESSION_BUSY, 'Session is busy');
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user