fix: don't let --continue access subagent session (#2091)

This commit is contained in:
Aiden Cline
2025-08-19 22:40:07 -05:00
committed by GitHub
parent 574be9febf
commit a2db58f125
2 changed files with 22 additions and 10 deletions

View File

@@ -67,11 +67,17 @@ export const RunCommand = cmd({
await bootstrap({ cwd: process.cwd() }, async () => {
const session = await (async () => {
if (args.continue) {
const list = Session.list()
const first = await list.next()
await list.return()
if (first.done) return
return first.value
const it = Session.list()
try {
for await (const s of it) {
if (s.parentID === undefined) {
return s
}
}
return
} finally {
await it.return()
}
}
if (args.session) return Session.get(args.session)

View File

@@ -82,11 +82,17 @@ export const TuiCommand = cmd({
const result = await bootstrap({ cwd }, async (app) => {
const sessionID = await (async () => {
if (args.continue) {
const list = Session.list()
const first = await list.next()
await list.return()
if (first.done) return
return first.value.id
const it = Session.list()
try {
for await (const s of it) {
if (s.parentID === undefined) {
return s.id
}
}
return
} finally {
await it.return()
}
}
if (args.session) {
return args.session