Preserve Codex cwd on turns
This commit is contained in:
@@ -270,9 +270,11 @@ func (c *Client) StartTurn(ctx context.Context, threadID, cwd, model, reasoningE
|
|||||||
params := map[string]any{
|
params := map[string]any{
|
||||||
"threadId": threadID,
|
"threadId": threadID,
|
||||||
"input": input,
|
"input": input,
|
||||||
"cwd": cwd,
|
|
||||||
"approvalPolicy": "on-request",
|
"approvalPolicy": "on-request",
|
||||||
"sandboxPolicy": SandboxPolicy(sandbox, cwd),
|
}
|
||||||
|
if strings.TrimSpace(cwd) != "" {
|
||||||
|
params["cwd"] = cwd
|
||||||
|
params["sandboxPolicy"] = SandboxPolicy(sandbox, cwd)
|
||||||
}
|
}
|
||||||
if model != "" {
|
if model != "" {
|
||||||
params["model"] = model
|
params["model"] = model
|
||||||
|
|||||||
@@ -710,7 +710,7 @@ func (b *Bot) continueThread(ctx context.Context, message *Message, session stor
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
thread, workspace, err := b.ensureThread(ctx, userID, chatID, session)
|
thread, _, err := b.ensureThread(ctx, userID, chatID, session)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -723,7 +723,7 @@ func (b *Bot) continueThread(ctx context.Context, message *Message, session stor
|
|||||||
}
|
}
|
||||||
|
|
||||||
b.registerOutput(thread.CodexThreadID, chatID)
|
b.registerOutput(thread.CodexThreadID, chatID)
|
||||||
turn, err := b.codex.StartTurn(ctx, thread.CodexThreadID, workspace.Path, session.Model, session.ReasoningEffort, session.Sandbox, input)
|
turn, err := b.codex.StartTurn(ctx, thread.CodexThreadID, "", session.Model, session.ReasoningEffort, session.Sandbox, input)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
b.clearOutput(thread.CodexThreadID)
|
b.clearOutput(thread.CodexThreadID)
|
||||||
return b.sendError(ctx, chatID, "Codex turn failed", err)
|
return b.sendError(ctx, chatID, "Codex turn failed", err)
|
||||||
|
|||||||
Reference in New Issue
Block a user