mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-05 06:24:37 +00:00
Hub already passes access.sessionId on resume (#1088); Cursor CLI still ignored it (Codex-only). Parse/pass the flag for cursor and lock in reuse-without-ready-wait tests. Co-authored-by: Debian <heavygee@oos-linux.in.lockhouse> Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Debian
Cursor
parent
fee853766a
commit
40314237ae
@@ -13,6 +13,7 @@ export type ParsedCursorCommandOptions = {
|
||||
cursorAddDirs?: string[]
|
||||
permissionMode?: CursorPermissionMode
|
||||
resumeSessionId?: string
|
||||
existingSessionId?: string
|
||||
model?: string
|
||||
}
|
||||
|
||||
@@ -84,6 +85,12 @@ export function parseCursorCommandArgs(commandArgs: string[]): ParsedCursorComma
|
||||
} else {
|
||||
unknownArgs.push(arg)
|
||||
}
|
||||
} else if (arg === '--existing-session-id') {
|
||||
const hapiSessionId = commandArgs[++i]
|
||||
if (!hapiSessionId || hapiSessionId.startsWith('-')) {
|
||||
throw new Error('Missing --existing-session-id value')
|
||||
}
|
||||
options.existingSessionId = hapiSessionId
|
||||
} else if (arg === '--continue') {
|
||||
unknownArgs.push(arg)
|
||||
} else if (arg === '--hapi-starting-mode') {
|
||||
|
||||
@@ -119,7 +119,7 @@ describe('buildCliArgs', () => {
|
||||
|
||||
|
||||
|
||||
it('does not pass Codex-only existing session id flag to non-Codex agents', () => {
|
||||
it('does not pass existing session id flag to agents that do not reuse HAPI rows', () => {
|
||||
const args = buildCliArgs('claude', {
|
||||
directory: '/tmp',
|
||||
resumeSessionId: 'claude-session-1',
|
||||
@@ -131,6 +131,18 @@ describe('buildCliArgs', () => {
|
||||
expect(args).not.toContain('hapi-session-1')
|
||||
})
|
||||
|
||||
it('passes --existing-session-id for cursor resume when sessionId is set (#991)', () => {
|
||||
const args = buildCliArgs('cursor', {
|
||||
directory: '/tmp',
|
||||
resumeSessionId: 'cursor-csid-1',
|
||||
sessionId: 'hapi-session-991',
|
||||
})
|
||||
expect(args).toContain('--existing-session-id')
|
||||
expect(args).toContain('hapi-session-991')
|
||||
expect(args).toContain('--resume')
|
||||
expect(args).toContain('cursor-csid-1')
|
||||
})
|
||||
|
||||
it('validates all known permission modes', () => {
|
||||
for (const mode of ['default', 'acceptEdits', 'auto', 'bypassPermissions', 'plan', 'ask', 'debug', 'autoReview', 'read-only', 'safe-yolo', 'yolo']) {
|
||||
const args = buildCliArgs('claude', {
|
||||
|
||||
@@ -1115,7 +1115,10 @@ export function buildCliArgs(
|
||||
}
|
||||
}
|
||||
args.push('--hapi-starting-mode', 'remote', '--started-by', 'runner');
|
||||
if (agent === 'codex') {
|
||||
// Codex import/resume (#1088) and Cursor ACP remote resume (#991) both reuse
|
||||
// the original HAPI row via --existing-session-id so the hub does not depend
|
||||
// on session-ready over a remote socket before merge.
|
||||
if (agent === 'codex' || agent === 'cursor') {
|
||||
const existingSessionId = options.existingSessionId ?? options.sessionId;
|
||||
if (existingSessionId) {
|
||||
args.push('--existing-session-id', existingSessionId);
|
||||
|
||||
Reference in New Issue
Block a user