mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-11 11:10:13 +01:00
fix: recognise --session-id= and --resume= forms
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
40b1fbb898
commit
c140df6d43
3 files changed
+10
-5
No files matched your search
@@ -58,7 +58,9 @@ process.stdout.write(JSON.stringify({ capture: resolveEvalModel('capture'),
|
||||
fallback: await argv({}, undefined), env: await argv({}, 'env-model'), explicit: await argv({ model: 'opts-model' }, 'env-model'),
|
||||
extra: await argv({ extraArgs: ['--model', 'override'] }, undefined),
|
||||
pinned: await argv({ extraArgs: ['--session-id', '11111111-2222-4333-8444-555555555555'] }, undefined),
|
||||
resumed: await argv({ extraArgs: ['--resume', 'prior'] }, undefined) }));
|
||||
resumed: await argv({ extraArgs: ['--resume', 'prior'] }, undefined),
|
||||
pinnedEq: await argv({ extraArgs: ['--session-id=11111111-2222-4333-8444-555555555555'] }, undefined),
|
||||
resumedEq: await argv({ extraArgs: ['--resume=prior'] }, undefined) }));
|
||||
`);
|
||||
const run = (hermetic: string) => {
|
||||
const result = spawnSync(process.execPath, [worker], { cwd: join(import.meta.dir, '../..'), encoding: 'utf8', timeout: 30_000,
|
||||
@@ -81,6 +83,8 @@ process.stdout.write(JSON.stringify({ capture: resolveEvalModel('capture'),
|
||||
expect(sessionIds(hermetic.extra)).toHaveLength(1);
|
||||
expect(sessionIds(hermetic.pinned)).toEqual(['11111111-2222-4333-8444-555555555555']);
|
||||
expect(sessionIds(hermetic.resumed)).toEqual([]);
|
||||
expect(hermetic.pinnedEq.filter((arg: string) => arg.startsWith('--session-id'))).toEqual(['--session-id=11111111-2222-4333-8444-555555555555']);
|
||||
expect(sessionIds(hermetic.resumedEq)).toEqual([]);
|
||||
expect(sessionIds(run('0').fallback)).toEqual([]);
|
||||
} finally { rmSync(dir, { recursive: true, force: true }); }
|
||||
}, 60_000);
|
||||
|
||||
@@ -290,9 +290,10 @@ function prepareLaunch(opts: ClaudePtyOptions): LaunchSetup {
|
||||
const hermetic = isHermeticEnabled();
|
||||
if (hermetic) args.push('--strict-mcp-config');
|
||||
const extra = opts.extraArgs ?? [];
|
||||
const resumes = extra.some(arg => ['--resume', '-r', '--continue', '-c'].includes(arg));
|
||||
let sessionId = extra.includes('--session-id') ? extra[extra.indexOf('--session-id') + 1] : undefined;
|
||||
if (hermetic && !sessionId && !resumes) args.push('--session-id', sessionId = randomUUID());
|
||||
const resumes = extra.some(arg => /^(--resume|--continue|-r|-c)(=|$)/.test(arg));
|
||||
const pinned = extra.findIndex(arg => /^--session-id(=|$)/.test(arg));
|
||||
let sessionId = pinned < 0 ? undefined : extra[pinned].startsWith('--session-id=') ? extra[pinned].slice('--session-id='.length) : extra[pinned + 1];
|
||||
if (hermetic && pinned < 0 && !resumes) args.push('--session-id', sessionId = randomUUID());
|
||||
if (opts.extraArgs) args.push(...opts.extraArgs);
|
||||
|
||||
// Hermetic by default (test/helpers/hermetic-env.ts): operator session
|
||||
|
||||
Reference in new issue
Block a user