Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

internal/session: TestWorkNoWorkerCanDoStopsARunningWorkerAndLandsOnThePerson races a 30 s wall and fails beside another suite

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

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
go
领域
testing-qa

调研方向

Start with TestWorkNoWorkerCanDoStopsARunningWorkerAndLandsOnThePerson and the eight time.After(30 * time.Second) sites in internal/session/task_divide_sketch_test.go. Run the focused session test beside the internal/tui3 suite with GOMAXPROCS=4 to reproduce the race, then inspect the held completer and worker-stop acknowledgement. Done means no fixed 30-second waits remain, waits respect owned synchronization or the test deadline, and the concurrent -count=5 run passes.

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

描述

area:session area:tests bug sev:papercut

What happened

2026-09-21, dev@17ae56d34 plus the seven-plus-six commits of #1336 (which touch nothing in the task harness), running the repository's own gate on a laptop while a second full suite and a read-only reviewer were also running:

make pr-ready
…
--- FAIL: TestWorkNoWorkerCanDoStopsARunningWorkerAndLandsOnThePerson (37.55s)
    task_divide_sketch_test.go:594: the worker was never stopped for work only a person can do
FAIL
FAIL	github.com/Agent-Field/codeaf/internal/session	799.740s

The package took 800 s against the 210 s constrained-runner baseline in CLAUDE.md. CI's touched packages job on the same head passed. The same test on a quiet box:

go test -count=3 -run '^TestWorkNoWorkerCanDoStopsARunningWorkerAndLandsOnThePerson$' ./internal/session/
ok  	github.com/Agent-Field/codeaf/internal/session	0.879s

So it is the shape CLAUDE.md says is a bug report and not a known one: a session test that fails only when other suites run beside it.

Replication

Deterministic (no model). Run the session suite while another heavy suite runs beside it, on a box with a few cores:

GOMAXPROCS=4 go test -count=1 -timeout 15m ./internal/tui3/ &
GOMAXPROCS=4 go test -count=1 -timeout 15m -run 'TestWork' ./internal/session/

What a developer sees today, some of the time: the --- FAIL above after 30 s of waiting. On a quiet box it passes in well under a second.

Field (real models). Not applicable: this is a test's own wall, no product door.

Where

TestWorkNoWorkerCanDoStopsARunningWorkerAndLandsOnThePerson in internal/session/task_divide_sketch_test.go, and its siblings in the same file: each waits on a channel with case <-time.After(30 * time.Second) (search that string; eight sites). The worker being stopped is real work driven by a held completer (completer.hold); on a loaded box the stop lands after the thirty seconds have gone.

The fix

A test in this package should not lose a race against wall time. Either the wait is on a sync point the harness owns (the held completer's release, the worker's own stop acknowledgement) with no timer at all, or the ceiling is the test's deadline (t.Deadline() minus a margin) rather than a fixed thirty seconds. CLAUDE.md's learned preference already says it: deterministic clocks over real sleeps.

Acceptance

  • e2e: not applicable — nothing crosses a product door; the defect is the test's own timer.
  • Unit: every wait in task_divide_sketch_test.go is either a sync point with no timer or bounded by the test deadline; grep -c 'time.After(30' internal/session/task_divide_sketch_test.go is 0.
  • Unit: the test passes with -count=5 while go test ./internal/tui3/ runs beside it on a 4-core box.
  • No manual page or change entry is involved.
主要语言
Go
星标
115
派生
14
平均合并
9 小时 37 分钟
30 天内合并 PR
755

环境准备

我们还没有检查这个项目的环境配置文件。先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

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

Agent-Field/CodeAF 的其他 Issue

查看 Agent-Field/CodeAF 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

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