Skip to content

feat: background task mode with job persistence / 后台任务模式 + Job 持久化 #50

Description

@raysonmeng

Background / 背景

当前 AgentBridge 所有操作都是前台阻塞的。codex-plugin-cc 支持把耗时任务(code review、rescue task)扔到后台,用户可以继续工作,稍后轮询结果。

What to borrow / 借鉴内容

后台任务模式

  • --background 参数,任务在 detached worker 中执行
  • 立即返回 job ID
  • 用户通过 /codex:status <job-id> 查进度
  • 用户通过 /codex:result <job-id> 获取结果

Job 持久化

  • Job 状态写入 JSON 文件(~/.codex/companion/state/<workspace>/jobs/
  • 状态机:queued → running → completed/failed/cancelled
  • 会话重启后可恢复
  • 参考:codex-plugin-cc/plugins/codex/scripts/lib/tracked-jobs.mjsjob-control.mjs

Value / 价值

  • 长时间任务(如大型 code review)不再阻塞用户
  • 会话意外断开后任务不丢失
  • 支持"fire and forget"工作模式

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions