mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-26 02:05:31 +00:00
Honor the working directory when resuming Codex (#10390)
Codex loads configuration and starts MCP servers while restoring the thread. Send the session directory during resume so those steps use the requested workspace. Closes #7699 Co-authored-by: tabulius-ux <252143044+tabulius-ux@users.noreply.github.com>
This commit is contained in:
co-authored by
tabulius-ux
parent
1fe7bf1ccc
commit
4c0bf97dbf
@@ -2522,6 +2522,24 @@ describe("Codex app-server provider", () => {
|
||||
appServer.assertNoErrors();
|
||||
});
|
||||
|
||||
test("passes a cwd override when loading a persisted Codex thread", async () => {
|
||||
const appServer = createFakeCodexAppServer();
|
||||
const provider = createProviderWithFakeAppServer(appServer);
|
||||
const cwd = "/workspace/new-directory";
|
||||
const session = await provider.resumeSession(
|
||||
{ sessionId: "saved-thread", metadata: { cwd: "/workspace/old-directory" } },
|
||||
{ cwd },
|
||||
);
|
||||
|
||||
try {
|
||||
const resume = appServer.requests().find((request) => request.method === "thread/resume");
|
||||
expect(resume?.params).toMatchObject({ threadId: "saved-thread", cwd });
|
||||
appServer.assertNoErrors();
|
||||
} finally {
|
||||
await session.close();
|
||||
}
|
||||
});
|
||||
|
||||
test("reopening an agent whose timeline Paseo still holds does not read Codex history", async () => {
|
||||
const codex = createReopenableCodexAgent({
|
||||
"saved-thread": [
|
||||
@@ -6836,7 +6854,11 @@ describe("Codex app-server provider", () => {
|
||||
{ method: "thread/loaded/list", params: {} },
|
||||
{
|
||||
method: "thread/resume",
|
||||
params: { threadId: "archived-thread-id", excludeTurns: true },
|
||||
params: {
|
||||
threadId: "archived-thread-id",
|
||||
cwd: "/tmp/codex-question-test",
|
||||
excludeTurns: true,
|
||||
},
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -4524,7 +4524,11 @@ export class CodexAppServerAgentSession implements AgentSession {
|
||||
private async ensureThreadLoaded(): Promise<void> {
|
||||
if (!this.client || !this.currentThreadId) return;
|
||||
// Paseo reads history only when it replays it; the resume response needs no turns.
|
||||
const params: Record<string, unknown> = { threadId: this.currentThreadId, excludeTurns: true };
|
||||
const params: Record<string, unknown> = {
|
||||
threadId: this.currentThreadId,
|
||||
cwd: this.config.cwd ?? null,
|
||||
excludeTurns: true,
|
||||
};
|
||||
if (this.deps.customCodexConfig) {
|
||||
// Resume otherwise prefers the provider stored on the thread, including
|
||||
// the unnamespaced key emitted by earlier Paseo versions.
|
||||
|
||||
Reference in New Issue
Block a user