Skip to content

feat(tasks): reuse existing sessions in new groups - #1

Open
jerryccan wants to merge 1 commit into
keyou:masterfrom
jerryccan:feat/attach-existing-task-group
Open

jerryccan wants to merge 1 commit into
keyou:masterfrom
jerryccan:feat/attach-existing-task-group

Conversation

@jerryccan

@jerryccan jerryccan commented Sep 4, 2026

Copy link
Copy Markdown

Summary

Extend newgroup so an idle, unbound App Server Session can be reused in a new Feishu group without creating or forking a Session.

  • Feishu: /newgroup [title] --session <session-id> [--agent <name>]
  • CLI: agentbot task newgroup [task] [title] --session <session-id> [--agent <standard-name>]
  • Accept raw Session IDs and codex://threads/<id> references.
  • Preserve the existing new-task behavior when --session is omitted.
  • Use --agent only to disambiguate the same Session ID across App Server Agents.

Behavior

Session state Result
Idle and unbound Create a group and atomically bind the exact existing Session.
Found on multiple Agents Reject until --agent selects the owner.
Already bound or archived Reject without changing the existing binding.
Active Reject to avoid taking over in-flight work.
Identity or availability changes during group creation Abort the binding and attempt to dissolve the new group once.

Session attachment is serialized per Agent and Session within a Worker, then enforced across processes by the existing SQLite uniqueness constraint. The remote Session is checked again after group creation before the local binding is committed. If the immediate group cleanup fails, the existing audit store marks the group fail-closed so incoming messages cannot silently create a different task. No persistent cleanup worker, retry loop, or new state table is introduced.

Session mode cannot be combined with --dir or --nodir. Mixed CLI/Worker versions fail before group creation instead of falling back to fresh-task behavior.

Validation

  • npm run verify — unit/integration: 1074 passed, 3 skipped; process: 9 passed; render: 7 passed
  • npm run build
  • npm run package:smoke
  • git diff --check origin/master...HEAD

@_user_1 please review.

@jerryccan
jerryccan force-pushed the feat/attach-existing-task-group branch from 91599d4 to 3ca5560 Compare September 5, 2026 10:59
@jerryccan jerryccan changed the title feat(tasks): attach existing sessions to new groups feat(tasks): reuse existing sessions in new groups Sep 5, 2026
@jerryccan
jerryccan force-pushed the feat/attach-existing-task-group branch 4 times, most recently from ef7c434 to 2c95387 Compare September 5, 2026 12:26
Co-authored-by: TRAE CLI <traecli@bytedance.com>
@jerryccan
jerryccan force-pushed the feat/attach-existing-task-group branch from 2c95387 to b2fd55c Compare September 10, 2026 03:09
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.

1 participant