Own turn lifecycle in durable-queue tests

未关闭
#1,398 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
重构
描述清晰度
基本清楚
活跃度
停滞
技术栈
redis, sql, typescript

调研方向

从 packages/junior/tests/integration/durable-queue.test.ts 开始,并阅读 packages/junior/src/chat/task-execution/README.md 以及 policies/testing.md。运行现有的 durable-queue 集成测试,然后覆盖所列出的 live Slack-to-worker 结果,不要预先创建 checkpoint,也不要替换由 Junior 所有的运行时组件;完成的标准是对终态、SQL 历史、回复和后续 mention 都进行断言。

由索引模型根据 Issue 内容生成。

描述

Turn lifecycle coverage is split across durable-queue, agent-continue-slack, heartbeat, and large component suites. Several “integration” cases seed Redis/SQL or replace the agent runner, so they miss path bugs (accept-then-timeout, multi-slice continue).

packages/junior/tests/integration/durable-queue.test.ts should own the product outcomes below. Drive live Slack ingress → worker → real agent. Fake only the model stream and Slack HTTP. Assert user-visible replies, turn terminal state, SQL history, and that a later mention still works.

Product outcomes

Outcome User-visible result Live drive
Happy path One mention → one reply → turn completed → mailbox empty Mention → run
Long turn survives host limit Deadline mid-work parks at a safe boundary; fresh wake finishes with one final reply; history kept Model does tool work, spend deadline, next queue wake finishes
Accepted reply is terminal After Slack accepts a tool-free reply, turn completes once; no second post; assistant stays in SQL Hold chat.postMessage past deadline (and/or lose lease after accept)
Worker dies mid-run (no accept) Turn fails once; committed history kept; next mention works Start run, expire lease before accept
Transient agent failure Fail before input commit → retry, no Slack post; retry limit → at most one fallback Throw before commit / until limit
Mid-turn steer Second @ mention folds into the same turn; still one final reply Hold active run, second mention, release

Every terminal case must leave the conversation able to take a new user mention.

Harness rules

  • Start from webhook ingress or a real queue wake after a live park. Do not seed turn checkpoints for these product contracts once the live path can create the state.
  • Do not replace Junior-owned runtime, resume, checkpoint, worker, lease, mailbox, or queue routing.
  • Custom agentRunner only for edges the model stream cannot express (e.g. throw before input commit). Prefer stream + real durability otherwise.
  • Disrupt from outside: hold Slack HTTP, spend the host deadline, expire the lease, send a second mention.

Out of scope here

  • Reply chunking / fallback copy → finalized-reply-behavior
  • Cross-actor steer policy → conversation-turn-steering-behavior
  • OAuth link UX / credential copy → oauth-resume-slack
  • Heartbeat only enqueueing a wake for stale paused rows → heartbeat
  • Cursor schema / append-only history rules → component tests

Current gaps (as of #1397)

  • Have live: happy path; accept during deadline (first slice); retry / retry-limit; steer (agent hold).
  • Missing live spine: long turn that times out mid-work, parks, resumes on a fresh wake, and finishes (production multi-slice shape).
  • Still seeded: lease loss after accept; worker disappear mid-run; timeout-pause “leave host request.”
  • Owned elsewhere / weak here: auth park+resume.

Related

Requested by David Cramer.

--

View Junior Session [Sentry]

主要语言
TypeScript
星标
397
派生
43
平均合并
7 小时 55 分钟
30 天内合并 PR
661

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

getsentry/junior 的其他 Issue

查看 getsentry/junior 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。