Skip to content

feat(task): add --resume-id <threadId> option for explicit thread resumption#231

Open
hirotomoyamada wants to merge 5 commits intoopenai:mainfrom
hirotomoyamada:feat/resume-thread-id
Open

feat(task): add --resume-id <threadId> option for explicit thread resumption#231
hirotomoyamada wants to merge 5 commits intoopenai:mainfrom
hirotomoyamada:feat/resume-thread-id

Conversation

@hirotomoyamada
Copy link
Copy Markdown

@hirotomoyamada hirotomoyamada commented Apr 15, 2026

Summary

  • Add --resume-id <threadId> value option to the task command for resuming a specific thread by ID
  • Existing --resume (boolean) and --resume-last behavior is unchanged

Using a separate --resume-id flag instead of overloading --resume preserves backward compatibility with the rescue command routing that uses bare --resume as a boolean continue signal.

Closes #230

Changes

  • handleTask(): add --resume-id as a value option, extract resumeId
  • buildTaskRequest(): pass resumeId through the request object
  • executeTaskRun(): use resumeId directly when provided, fall back to resolveLatestTrackedTaskThread() for --resume-last
  • Usage text updated to show --resume-id <threadId>

Test plan

  • task --resume-id <valid-threadId> "prompt" resumes the specified thread
  • task --resume "prompt" still works as boolean resume (unchanged)
  • task --resume-last "prompt" still resumes the latest thread (unchanged)
  • task --resume-id <id> --fresh throws an error
  • task --resume-id <id> --background works correctly
  • task "prompt" without resume flags creates a new thread (unchanged)

@hirotomoyamada hirotomoyamada requested a review from a team April 15, 2026 04:17
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 04b059a3e9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread plugins/codex/scripts/codex-companion.mjs Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 76c0aae9f9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread plugins/codex/scripts/codex-companion.mjs Outdated
@hirotomoyamada hirotomoyamada changed the title feat(task): add --resume <threadId> option for explicit thread resumption feat(task): add --resume-id <threadId> option for explicit thread resumption Apr 15, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2ce86d41f8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread plugins/codex/scripts/codex-companion.mjs Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 943aab3340

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread plugins/codex/scripts/codex-companion.mjs Outdated
@yaronhuang
Copy link
Copy Markdown

+1 from a parallel use case — happy to see this PR exists.

We're building a Claude Code subagent (worker-codex) that wraps the codex-companion task runtime so multiple parallel teammates can each maintain their own Codex thread. Without --resume-id, our workaround is to override CODEX_COMPANION_SESSION_ID per teammate and emit a ===worker-codex thread: <uuid>=== sentinel as the shim's first stdout line, so the wrapper agent can recover the UUID from its own conversation history and pass it back. It works, but it's a brittle dance: env-var override is undocumented surface, and the sentinel can be lost to transcript truncation or wrapper drift.

--resume-id <threadId> is the right primitive — it lets the wrapper track and pass the thread ID explicitly without env-var hacks. The implementation here looks clean (preserves backward-compat with --resume-last, threads resumeId straight through buildTaskRequest()executeTaskRun()).

Happy to test the branch locally against our parallel-teammate workflow if useful for review evidence. Tracking on our side: yaronhuang/kai#360.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add --resume-id <threadId> option to task command

2 participants