Skip to content

fix(service): let waiting Team runs resume a blocked root despite newer direct runs - #4075

Open
linlihuiyang wants to merge 3 commits into
agentscope-ai:2.0.xfrom
linlihuiyang:fix/team-blocked-root-resume
Open

linlihuiyang wants to merge 3 commits into
agentscope-ai:2.0.xfrom
linlihuiyang:fix/team-blocked-root-resume

Conversation

@linlihuiyang

@linlihuiyang linlihuiyang commented Nov 8, 2026 •

Copy link
Copy Markdown

Fixes #4074

Problem

A Team root Issue blocked on human input could never reach in_review again:

  1. Adaptive Team run waits (waiting) while the root is blocked; every comment mention on the root creates a newer direct run.
  2. The only resume path, completedTeamCanResumeRoot, requires the converging run to be the root's newest run of any mode.
  3. When the Team run finally completes, the newest run is always one of those comment-driven direct runs, so the guard rejects the resume.
  4. The direct runs already declined at their own convergence (mode != adaptive), leaving the root permanently blocked after the coordinator and all children finish.

Fix

  • Keep root resume restricted to the owning adaptive Team Run; direct Runs do not own this lifecycle transition.
  • Add optional Mode filtering to OrchestrationRunFilter, implemented before limit/pagination in both memory and PostgreSQL stores.
  • Select the latest adaptive Run with Limit: 1, so any number of newer comment-driven direct Runs cannot strip its resume eligibility.
  • Preserve the existing guard against an older adaptive Run advancing a root owned by a newer adaptive Run.
  • Reject terminal adaptive Run replays when the root Issue changed after completion, so a newer human block remains authoritative.

Tests

  • TestAdaptiveTeamRunResumesBlockedRootDespiteNewerDirectRuns uses 50 newer comment-driven direct Runs; it failed with blocked before this revision and now reaches in_review.
  • TestOlderAdaptiveRunDoesNotResumeRootOwnedByNewerTeamRun still protects a newer adaptive Run.
  • TestCompletedAdaptiveRunDoesNotResumeRootBlockedAgainByHuman verifies that completion followed by a human re-block and an old adaptive replay leaves the root blocked.
  • make build, make vet, and make test pass for aistio (locally with GOFLAGS=-buildvcs=false because the worktree has a parent SVN checkout).

Out of scope

  • If the Team Run has already terminated before the last child reaches a terminal state, and no later Run converges, recovery needs a separate trigger when the child terminates. This PR does not add direct-Run delegation or change Worker scanning for that distinct timing variant.
  • convergeFailedIssueTree has a similar newest-run-of-any-mode guard; it only gates failure projection and is unchanged.
  • Aligning terminal summary text with the actual Issue status is a separate cosmetic fix.

@jujn jujn added the P1 紧急不重要 label Nov 10, 2026

@juruoO-o juruoO-o left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

在当前提交的隔离副本上用内存 store 复现了以下五个场景。原始 orchestration 包测试通过。建议先修复恢复资格与触发条件,再合入。

}
return nil, nil
}
if controlmodel.IsOrchestrationRunTerminal(latestAdaptive.State) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] IsOrchestrationRunTerminal 包含 failed 和 cancelled。用本 PR 的内存 store 场景,将协调节点置为成功、Team Run 置为 failed,关闭最后一个子 Issue,再让后续 direct Run 成功收敛,根 Issue 实际进入了 in_review。建议对被代理的 Team Run 也检查 succeeded / partial_succeeded,并覆盖 failed 和 cancelled 两个分支。这里本地复现的是 failed。

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已移除 direct Run 代恢复路径,completedTeamCanResumeRoot 重新要求当前收敛 Run 为 adaptive。历史 failed/cancelled Team Run 不会再通过该兜底把根 Issue 推进到 in_review,对应扩展测试也已删除。

// adaptive Run once that owner has terminated. Returns nil when no adaptive
// Run may resume on behalf of this convergence.
func (e *Engine) resumeOwnerRun(ctx context.Context, run *controlmodel.OrchestrationRun) (*controlmodel.OrchestrationRun, error) {
runs, err := e.Store.Orchestration().ListRuns(ctx, store.OrchestrationRunFilter{Tenant: run.Tenant, Namespace: run.Namespace, RootIssueID: run.RootIssueID, Limit: 50})

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Limit: 50 在按 mode 筛选前生效。把新增正向测试中的 1 个较新 direct Run 改成 50 个,完成协调节点并调用 ReconcileRun 后,根 Issue 仍为 blocked。建议先按 adaptive 筛选再取最新一条,或持续分页直到找到负责该任务的 Team Run。

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已给 OrchestrationRunFilter 增加可选 Mode,memory 和 PostgreSQL 都在 Limit 前筛选 adaptive,再以 Limit 1 取最新 Team Run。正向回归测试已改为 50 个较新的 comment direct Run;修改前根 Issue 保持 blocked,修改后进入 in_review。

time.Sleep(5 * time.Millisecond)
direct, err := st.Orchestration().CreateRun(ctx, &controlmodel.OrchestrationRun{
Tenant: "tenant-a", Namespace: "ns-a", RootIssueID: issue.ID,
Mode: controlmodel.RunModeDirect, State: controlmodel.RunRunning,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] 这个 direct Run 没有设置 TriggerType。将它改成实际评论使用的 "comment",且不赋予它拥有根任务生命周期的 Task,执行同一用例后根 Issue 仍是 blocked:convergeCompletedIssue 的 ownsLifecycle 检查会提前返回。建议补上成员评论场景,保留原权限边界,由有资格的 Team Run 重新检查自己的等待条件。

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已删除 direct Run 代恢复及其测试,保留 comment Run 的 ownsLifecycle 权限边界。根 Issue 恢复只由最新的 adaptive Team Run 在满足原协调节点和子 Issue 条件时触发。

func (e *Engine) completedTeamCanResumeRoot(ctx context.Context, run *controlmodel.OrchestrationRun, issue *controlmodel.Issue) (bool, error) {
if run.Mode != controlmodel.RunModeAdaptive || issue.AssigneeType != controlmodel.AssigneeTeam || issue.ArchivedAt != nil {
if issue.AssigneeType != controlmodel.AssigneeTeam || issue.ArchivedAt != nil {
return false, nil
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] 选出历史 Team Run 后,还需要确认根 Issue 当前的阻塞属于该 Run 的这次等待。我先让 Team 成功进入 in_review,再通过协作服务由用户手动设为 blocked(等待新的审批)。此后重新收敛旧 direct Run,或让另一条符合兜底条件的 direct Run 完成,两种情况下根任务都会回到 in_review,覆盖用户的新决定。请校验本次等待的归属,补上人工重新阻塞后重复收敛的测试。

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已移除历史 Team Run 的 direct Run 代恢复逻辑,旧 direct Run 不会再将人工重新 blocked 的根 Issue 推进到 in_review。本 PR 收窄为只修复 #4074 中 adaptive Run 的恢复资格判断。

controlmodel.IssueCancelled, controlmodel.Actor{Type: controlmodel.ActorHuman, Ref: "owner"}, "skipped"); err != nil {
t.Fatal(err)
}
// A later direct Run converges on the same root after the Team Run ended.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] 关闭最后一个子 Issue 后,测试额外造了一条 direct Run 才触发恢复。改为通过 collaboration.Service.TransitionIssue 取消最后一个子 Issue,随后只执行 Worker.ReconcileOnce,根任务仍为 blocked。此时 Team Run 已终止,Worker 只扫描活跃 Run。建议让子 Issue 进入终态时触发父 Team 重新检查,并覆盖没有任何后续 Run 的情况。

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已移除该扩展场景及 direct Run 兜底测试。本 PR 聚焦 #4074 的 adaptive Run 最后完成场景;Team Run 已终止后子 Issue 才结束且没有后续 Run 的时序变体留作独立后续修复,需要子 Issue 进入终态时主动触发父 Team 重检,PR 描述已注明该边界。

xzxiaoshan added a commit that referenced this pull request Nov 12, 2026
#4149)

## Summary

Scanned the last 5 pages of PRs (#3941–#4147, 125 PRs): 14 had red CI,
and 9 of those failed on exactly one OS while the other OS stayed green
on the same commit — the classic `-T1C` parallel-build starvation
signature (the both-OS failures were compile/spotless issues and are out
of scope). This PR fixes every distinct flaky test class found that way,
plus two narrowly-scoped hardenings the fixes depend on.

| Test / class | Failed OS | Victim PRs | Evidence | Fix |
|---|---|---|---|---|
| `AguiMvcControllerTest#eventStreamSignals…` | ubuntu ×2 | #4112, #4143
| 5s latch deadline hit while sibling tests in the class ran 5–9s under
the same load | shared 30s await constant (all waits in the class share
the same executor starvation exposure) |
| `SubagentRunIdChainTest` (both methods) | windows ×3 | #4091, #4025,
#4142 | blocking read starved just past 10s (10.04–10.84s elapsed); same
test 0.414s on ubuntu | block budget 10s → 30s |
| `InboxMiddlewareTest#notificationReaches…` | ubuntu ×2 | #3991, #4093
| assertion matched the memory-consolidation prompt instead of the
reasoning request | `MockModel` recordings made thread-safe (see below)
|
| `GatewayEventsWebSocketTest#sameOrigin…` | windows ×2 | #4072, #4094 |
~0.1s clean close with no frames; job log shows the preceding 403'd
upstream upgrade left a dying pooled socket (`Connection prematurely
closed BEFORE opening handshake is complete`) that the next proxied
socket reused | stand-in control plane now answers rejected upgrades
with `Connection: close` so the gateway pool discards the socket |
| `TurnLeaseServiceTest#heartbeatErrors…` | windows | #4075 |
`await(70ms) isFalse` anchored to when the starved test thread resumes,
not to lease acquisition | bounds re-anchored to
elapsed-time-since-acquisition (fires within 2s, not before 120ms;
deadline 150ms, ticks 50ms) |
| `SandboxConnectorRedirectTest#commandWaits…` | windows | #4058 |
capability probe inherited the 200ms command-transport budget and died
at 199ms before any command was submitted | probe budget floor (see
CommandExecutor below) |
| `GracefulShutdownManager` singleton leak | local | found during
verification | `resetForTesting()` reset every field except `config`, so
a `PT0.1S` config leaked across tests and failed `defaultConfig`
whenever filesystem class order placed it after `shutdownTimeoutSignal`
| reset now also restores `GracefulShutdownConfig.DEFAULT` |

## Shared test-util fix

`MockModel` recorded calls from whichever thread drives the agent — the
turn thread and background memory maintenance — into a plain `ArrayList`
plus unsynchronized `int`/`last*` fields. Two concurrent adds race the
`elementData[size] / size++` update and can silently drop an entry; that
is exactly the #4093/#3991 signature (the reasoning request vanished,
only the post-call consolidation request survived). Recordings are now a
`CopyOnWriteArrayList` with `AtomicInteger`/`volatile` siblings —
order-preserving, atomic per add, stable to iterate while a call is in
flight. Complements the iteration fix proposed in #4133.

## Non-test changes (called out explicitly)

- **`CommandExecutor`** — the `/capabilities` pre-flight probe now uses
`max(configured per-attempt, 2s)` for its budgets. Strictly a widening:
identical for default (60s) and ≥2s configurations; only sub-2s configs
change, and only for the probe — command exchanges keep the configured
budget. Side benefit: the old code passed the same 200ms as the shared
exchange deadline, which made the intended `CAPABILITY_MAX_ATTEMPTS = 3`
retry dead code; the floor lets the retry actually run. The test-only
alternative (raising the test's 200ms config and the server delays to
match) would add ~1.5–2s of real test wall time, so the 2-line
production fix is the smaller change.
- **`GracefulShutdownManager.resetForTesting`** — one added line
restoring `config` to default, inside a method documented "Intended for
testing and demo purposes only" (no production callers; production code
never calls `setConfig`).

## Constraint compliance

- **No happy-path slowdown:** every widened number is a failure-path
deadline only; all awaits/latches return the moment the signal arrives,
and no sleeps were added (`TurnLeaseServiceTest` actually drops a forced
70ms wait).
- **Minimal widenings, anchored to measurements:** 5s→30s (deadline hit
twice; repo precedent from #3726 for CI-starvation waits), 10s→30s (3×
the observed 10.04–10.84s), probe floor 2s (10× the 199ms miss),
TurnLease window [120ms, 2s] (bug population ~50ms vs legitimate
≥150ms).

## Test plan

- [x] Full reactor `mvn -B -T2C clean verify` green locally (4m38s wall
clock; all seven fixed areas' suites green)
- [x] `JsonFileAgentStateStoreTest` (8 symlink cases) excluded locally
only — pre-existing Windows-symlink-privilege limitation, reproduced
identically on a pristine `main` baseline, unrelated to this diff
- [ ] CI on both OSes

Follow-up noted during review: the production control-plane hub behind
`/api/v1/events` lives outside this repo; if it also answers rejected
upgrades with a keep-alive 403 and closes, the gateway can still poison
a subsequent proxied socket in production — worth checking against the
real hub separately.

@juruoO-o juruoO-o left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

复审 head fcba1cb,比较基线 main@c627cc7c9。

已确认:direct Run 代恢复路径已删除;memory/PostgreSQL 的 Mode 筛选位于 Limit 前,50 个更新的 comment direct Run 场景已覆盖。相关 orchestration、memory 包测试通过;真实 PostgreSQL 测试因未配置 CONTROL_PLANE_TEST_POSTGRES_DSN 跳过。

但原 review 的“人工重新 blocked 后,旧执行不能覆盖新决定”仍未完全解决:旧 adaptive Run 的重放仍可把 blocked 改回 in_review,下方探针实测失败。仅撤回本 PR 新增的 Mode 筛选,同一探针通过。子 Issue 在 Team Run 终止后才结束、没有后续触发的场景目前明确延期,不能视为已修复。

另有集成阻碍:最新 main 已在 #4154 移除 agentscope-service;本 PR 的 engine.go 及三个 store 文件均出现 modify/delete 冲突。需要先明确承接仓库/目标分支,再整合,不能直接恢复已移除模块。

func (e *Engine) completedTeamCanResumeRoot(ctx context.Context, run *controlmodel.OrchestrationRun, issue *controlmodel.Issue) (bool, error) {
if run.Mode != controlmodel.RunModeAdaptive || issue.AssigneeType != controlmodel.AssigneeTeam || issue.ArchivedAt != nil {
return false, nil
}
latest, err := e.Store.Orchestration().ListRuns(ctx, store.OrchestrationRunFilter{Tenant: run.Tenant, Namespace: run.Namespace, RootIssueID: run.RootIssueID, Limit: 1})
latest, err := e.Store.Orchestration().ListRuns(ctx, store.OrchestrationRunFilter{Tenant: run.Tenant, Namespace: run.Namespace, RootIssueID: run.RootIssueID, Mode: controlmodel.RunModeAdaptive, Limit: 1})

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] 限定 adaptive 后仍须校验当前 blocked 是否属于该 Run 的这次等待。

实测:使用 setupBlockedTeamRoot(..., true) 完成 Team,使根 Issue 进入 in_review;通过 collaboration.Service.TransitionIssue 由人类重新设为 blocked(新审批);再创建更新的 succeeded comment direct Run,并 ReconcileRun 旧 adaptive Run。根 Issue 被改回 in_review,覆盖用户的新决定。仅去掉本行新增的 Mode: RunModeAdaptive 后,同一探针通过,因为更新的 direct Run 会挡住旧 Run。删除 direct Run 代恢复逻辑没有保护 adaptive Run 的重放。请记录/校验本次等待的归属或等效状态版本边界,并补“完成后人工重新阻塞 + 旧 adaptive 重放”的回归。

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已改目标分支为 2.0.x,并基于该分支重新构建 PR head,不再包含之前的 main 合并历史;当前为 2 个 commits、5 个文件,代码位于 agentscope-service/aistio/。

P1 已在 bf76ec029 修复。completedTeamCanResumeRoot 新增完成时间边界:对于已终态的 adaptive Run,如果 root Issue 在 run.CompletedAt 之后发生更新,则拒绝再次恢复;Run 等待期间的评论和 direct Run 不受影响,未引入 schema 变更。

新增 TestCompletedAdaptiveRunDoesNotResumeRootBlockedAgainByHuman,覆盖“完成进入 in_review → 人工重新 blocked → 新 comment direct Run → 旧 adaptive Run 重放”。修改前复现为错误进入 in_review,修改后保持 blocked;原有两个恢复/ownership 测试也通过。

本地 GOFLAGS=-buildvcs=false make build vet test 全量通过。请基于 2.0.x 最新 head 帮忙复审。

xzxiaoshan added a commit that referenced this pull request Nov 20, 2026
…#4274)

## Background

Swept the last 125 PRs (#4272→#4075) for single-OS CI failures under
`mvn -B -T1C clean verify` (one build OS red, the other green on the
same commit = flake suspect). Cross-PR repeats and main's own red run on
2026-11-19 (ubuntu, run 44516464414) pinpoints four still-broken test
classes; all fixes are test-side only (no `src/main` changes).

## Fixes and evidence

| Test class | Victims | Signature | Fix |
|---|---|---|---|
| `RocketMqExecutionTest` | #4182, #4192, #4103 + main run 44516464414
(2026-11-19, ubuntu) | `turn reaches SUCCEEDED did not become true
within 10s` while the turn kept progressing (modelCalls complete, acks
climbing, lastFailure=none) — deadline breakthrough under starvation,
not a lost turn | shared `waitUntil` deadline 10s→30s (repo tier
#3726/#3774) |
| `AgentScopeAdapterTest` | #4204 (same-commit re-run green = confirmed
flake), #4191, #4246 | `Timed out observing Turn` at 6.7–8.5s elapsed;
resume/recovery one step from terminal | `turn.await(5s)`→30s at all 3
sibling sites via `TURN_DEADLINE`, outer `get` budgets +5s margin |
| `WorkerRuntimeTest` | #4219, #4224, #4255 (windows) | (a) `Worker
lease lost` after 2.4s — 1s claim leases expired between claim and
release; (b) `renewed.await(5s)` missed at 6.5s while the recovery lane
was healthy; (c) `Interrupted sleep interrupted` —
`WorkerRuntime.process()` interrupts the calling thread on lease-renewal
failure and manual `tick()` runs it on the test thread | (a) claim
leases 1s→30s (staleness under test still comes from `release(ZERO)` +
re-claim); (b) latches 5s→30s; (c) raw `Thread.sleep`→interrupt-proof
`pause()` at 5 sites, mirroring the #4176 fix for the same signature in
`ProcessRecoveryTest` |
| `ChatSessionsTest.await` (shared with `ChatControllerTest`) | #4233,
#4182 (stuck-RUNNING at 40.8s/46.4s), #4268, #4163 (poll threw `Durable
database transaction failed`) | two surfaces of one cause: every
snapshot poll opens a writing sqlite transaction contending with the
runtime's own writes, and windows runners starve turns past 30s (same
file already measured 56.6s starvation and uses 120s elsewhere, #3726) |
deadline 30s→120s (aligned tier) + tolerate transient `UNAVAILABLE`
store exceptions while polling; persistent failure rethrows at the
deadline, FAILED-turn fast-fail unchanged |
| `CommandExecutorTest.missingExitCodeIsUnknown` | local -T2C full-repo
stress (2026-11-19; pristine-main baseline of the same class green) |
the 2s network budget fired on scheduler starvation before the instant
fake response was processed, misclassifying the failure as a deadline
miss instead of a missing exit code (2.97s elapsed) | budget 2s→30s for
this non-deadline-semantics test; the two deadline-semantics tests keep
their tight budgets |

## Constraint compliance

- Happy path zero cost: every change only extends failure-path deadlines
or hardens helpers; no new sleeps, no weakened assertions.
- Minimal widening anchored to measured data (each comment cites victims
+ measured values); 30s follows the repo's established deflake tier,
120s follows this file's own previously measured starvation tier.
- Structural hardening preferred: `pause()` helper, transient-lock
retry, lease decoupling from the tested invariant.
- No `src/main` changes.

## Observed but deliberately not fixed here

-
`ProcessRecoveryTest.replacementCollectsOriginalResultWithoutRepeatingEffect`
(#4214: `expected: 2 but was: 3`): recovery-semantics race (model re-run
without effect re-run after abrupt halt) — a product question for the
durable recovery work, not a deadline flake.
-
`JevEvidenceProcessorTest.filterFailureIsWithheldButRankFailureFollowsScoredEvidence`
(#4265: delivered `[]` on a 25×-slowed runner): root cause not
established; single occurrence.
- Already fixed upstream, victims predate the fix:
`AgentScopeAgentExecutorInputRequiredTest` (#4157/#4187/#4152 all
predate #4176's `BaseReActAgentRunner` change), `InboxMiddlewareTest`
(#4093 predates #3738), `HarnessAgentSubagentStreamEventsTest` (#4183
predates #2917).
- `SkillBoxTest$UploadContainment` quartet (#4201/#4202/#4212/#4229):
test does not exist on main (fork stack only); deterministic cross-drive
path bug, not load flakiness.
- #4184/#4185: both-OS compile breaks from dependency major bumps
(dependabot), out of scope.

Also applied during review: sibling sites with the identical measured
mechanism were widened in the same pass — the remaining 1s fixture claim
leases in `WorkerRuntimeTest` (fenced begin/update/release sequences,
same #4219 signature), the start/PAUSED 5s budgets in the same
`AgentScopeAdapterTest` method as the victims, and the 5s/4s observe
budgets in
`completeLocalBackendRunsNativeAgentWhileManagedObserverIsBlocked`.

## Test plan

- [x] Full local `mvn -B -T2C clean verify` green (stricter than CI's
-T1C). Locally excluded, each verified to fail identically on pristine
main on this machine (Windows/git-bash) while passing on CI:
`JsonFileAgentStateStoreTest` (symlink permissions), the
`agentscope-extensions-durable-sandbox` trio plus
`ToolInSandboxExampleTest`/`SandboxRoundTripTest` (sandbox shell heredoc
incompatible with local git-bash python3), and the
`AgentScopeAdapterTest`/`ProcessRecoveryTest`/`HarnessExternalToolProcessRecoveryTest`
trio (durable-adapter classes whose Windows runs are skipped on CI; the
same named tests fail on pristine main locally).
- [ ] CI green on both OS.
@linlihuiyang
linlihuiyang changed the base branch from main to 2.0.x November 21, 2026 03:34
@linlihuiyang
linlihuiyang force-pushed the fix/team-blocked-root-resume branch from fcba1cb to 7565d75 Compare November 21, 2026 04:16

@juruoO-o juruoO-o left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感谢补上人工重新阻塞的回归测试。复审 bf76ec0 时确认,Team 完成后,用户手动将根 Issue 重新设为 blocked,重放旧 Run 会保留这个决定。等待期间出现 50 个评论触发的 direct Run,Team 也仍能正常恢复。

[P1] 仅修改根 Issue 的标题,也会阻止已完成的 Team 推进到 in_review。 我在内存存储上做了一个定向测试:在 Run 的成功状态写入后、根 Issue 状态推进前,通过 UpdateIssue 只修改标题,保留原状态。随后连续调用两次 ReconcileRun,根 Issue 都停在 blocked。同一用例换回 2.0.x 的协调逻辑后,能正常进入 in_review。

completedTeamCanResumeRoot 用 issue.UpdatedAt.After(*run.CompletedAt) 判断是否出现了新的阻塞决定,但改标题也会刷新 UpdatedAt。请将判断限定到实际的阻塞状态变更,并保留两个回归场景:人工重新阻塞后应保留该决定,仅编辑标题后仍应继续推进。这个对照测试使用内存存储,尚未在真实 PostgreSQL 上验证。

@linlihuiyang

Copy link
Copy Markdown
Author

已在 fe3c7e06d 修复最新 P1。

  • completedTeamCanResumeRoot 不再以 Issue.UpdatedAt 判断新的人工阻塞,改为分页检查已有的 issue.status_changed 活动;只有 run.CompletedAt 之后实际迁移到 blocked 才拒绝旧 Team Run 恢复。普通 issue.updated(例如仅改标题)不影响恢复,无需 schema 变更。
  • 新增 TestCompletedAdaptiveRunResumesBlockedRootAfterTitleOnlyUpdate:在 Run 成功状态写入后、根 Issue 收敛前调用 UpdateIssue 仅修改标题,连续两次 ReconcileRun 后应进入 in_review。修改前该测试复现为停留在 blocked,修改后通过。
  • 原有“人工重新 blocked 后保持该决定”“50 个较新的 comment direct Run”“较新 adaptive Run 所有权”回归测试均通过。

验证:

  • go test ./internal/orchestration ./internal/store/memory -count=1
  • 标题更新与人工重新阻塞两个关键测试 -count=20 通过
  • GOFLAGS=-buildvcs=false make build vet 通过
  • GOFLAGS=-buildvcs=false make test 全量重跑通过。首次运行遇到未改动的 qoder provider 时序测试 TestRunStopsChildWhenApprovalTransportFails 失败,该测试单独重跑及全量重跑均通过。

真实 PostgreSQL 集成测试未执行,本地未配置 CONTROL_PLANE_TEST_POSTGRES_DSN。请基于 2.0.x 最新 head 帮忙复审。

This branch has not been deployed

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

Labels

P1 紧急不重要

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[service] Team root Issue 永久卡死在 blocked:adaptive run 的恢复资格被 waiting 期间衍生的 direct run 顶掉

3 participants