-
Notifications
You must be signed in to change notification settings - Fork 604
task --resume-last ignores current-session scoping and can resume another Claude session's task #81
Description
Summary
task-resume-candidate --json is scoped to the current Claude session, but task --resume-last is not. In a multi-session workspace, the CLI can report that there is no resumable task for the current session and then still resume a different session's persisted Codex thread.
The same helper also lets an active task from another Claude session block --resume-last, even when /codex:status for the current session shows no running jobs.
Reproduction
- Start a repository with the plugin state directory available.
- Run one successful
taskcommand under Claude sessionsess-otherso it persists a completed task thread. - In a separate Claude session
sess-current, run:node scripts/codex-companion.mjs task-resume-candidate --jsonnode scripts/codex-companion.mjs task --resume-last "follow up"
- Observe that
task-resume-candidatereportsavailable: false, but--resume-laststill resumes the older thread fromsess-other. - Alternatively, leave a
runningtask owned bysess-otherin state and runtask --resume-lastfromsess-current.
Expected
- Implicit resume selection should use the same current-session visibility rules as
task-resume-candidate. - If
CODEX_COMPANION_SESSION_IDis set and the current session has no resumable task,task --resume-lastshould fail with "No previous Codex task thread was found for this repository.". - A running task from another session should not block
--resume-lastfor the current session.
Actual
task-resume-candidatesays there is no resumable task in the current session.task --resume-laststill resumes another session's completed thread.- A running task from another session can also block
--resume-lastwithTask ... is still running. Use /codex:status before continuing it.even though/codex:statusfor the current session shows no running jobs.
Suspected Cause
resolveLatestTrackedTaskThread(...) scans all persisted task jobs in the workspace and only excludes the current job id. It does not apply current-session filtering before choosing a completed thread or before checking for active tasks.
Suggested Fix
Thread the same session-aware filtering used by task-resume-candidate into the implicit --resume-last path, and only fall back to findLatestTaskThread(...) when there is no Claude session id in scope.