Skip to content

Support task IDs with chat --resume#40

Closed
temp-deepshard wants to merge 3 commits into
deepshard:mainfrom
temp-deepshard:codex/run-resume-aliases
Closed

Support task IDs with chat --resume#40
temp-deepshard wants to merge 3 commits into
deepshard:mainfrom
temp-deepshard:codex/run-resume-aliases

Conversation

@temp-deepshard

@temp-deepshard temp-deepshard commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

Extend the existing truffile chat --resume flag to accept an optional task ID, and make recent-task selection consistently use the most recently updated chats.

This keeps one chat command instead of adding parallel run or resume commands. The existing chat engine, task streams, picker, one-shot path, and compatibility flags remain in place.

Behavior

truffile chat                               # interactive new chat
truffile chat "summarize this" --json       # existing one-shot chat
truffile chat --resume                      # interactive recent-task picker
truffile chat --resume TASK_ID              # reopen this task interactively
truffile chat --resume TASK_ID "follow up"  # continue this task one-shot
truffile chat --resume-last "follow up"     # continue the most recently updated task

--task-id remains supported for compatibility. Supplying conflicting IDs through --resume and --task-id fails during argument parsing.

Implementation

  • let the existing chat --resume parser accept an optional task ID
  • normalize that ID onto the existing task_id field consumed by the chat engine
  • keep exact-ID resume interactive when attached to a TTY with no prompt
  • reuse the existing one-shot continuation path when a prompt, stdin, prompt file, or JSON output is requested
  • let the existing interactive resume block open either the selected picker task or an exact task ID
  • normalize the task-info response to newest-updated first and exactly the requested count
  • ignore *.whl so local build artifacts cannot be staged accidentally

The ordering normalization is necessary because the device returns max_before + 1 records in oldest-to-newest order. Without it, --resume-last could select an older task, the picker opened on the oldest visible task, and --list-tasks N returned N+1 rows.

No wheel, generated protobuf, copied runtime, packaging configuration, or unrelated CLI files are included.

Validation

  • focused resume and task-history tests: 8 passed
  • full suite: 161 passed, 1 subtests passed
  • Ruff passes for the changed tests and critical-error rules pass for all touched Python modules
  • git diff --check passes
  • built the exact branch as a wheel outside the repository and installed it into a fresh virtual environment
  • installed-wheel help documents chat --resume [TASK_ID]
  • physical truffle-6239 continuity test:
    • created disposable chats A and B with distinct context tokens
    • chat --list-tasks 1 --json returned exactly B as the newest task
    • chat --resume-last reused B's task ID and recovered B's context token
    • interactive chat --resume A_TASK_ID reopened A and recovered A's context token after a live follow-up
    • chat --resume placed the most recently updated task first in the picker
    • both disposable tasks were deleted and verified absent

@temp-deepshard
temp-deepshard force-pushed the codex/run-resume-aliases branch from db77d67 to 3efa5fa Compare July 15, 2026 01:56
@temp-deepshard
temp-deepshard force-pushed the codex/run-resume-aliases branch from 3efa5fa to db8bef3 Compare July 15, 2026 02:01
@temp-deepshard temp-deepshard changed the title Add run and resume CLI aliases Support task IDs with chat --resume Jul 15, 2026
@temp-deepshard
temp-deepshard marked this pull request as ready for review July 15, 2026 02:32
@temp-deepshard
temp-deepshard marked this pull request as draft July 15, 2026 04:39
@temp-deepshard
temp-deepshard marked this pull request as ready for review July 15, 2026 04:40
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.

2 participants