Fix/修复测试用例竞态等问题 #571

Merged
k88936 merged 8 commits from fix/test-concurrent-problem into master 2026-10-02 01:51:59 +08:00

8 Commits

Author SHA1 Message Date
k88936 716ea9d410 Merge remote-tracking branch 'origin/master' into fix/test-concurrent-problem
Project CI / AI game creator shell Rust crates (pull_request) Successful in 1m41s
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 2m14s
Project CI / Backend tests (pull_request) Successful in 4m28s
Project CI / Native shell tests (pull_request) Successful in 6m4s
Project CI / Frontend tests (pull_request) Successful in 2m13s
Project CI / AI game creator shell web tests (pull_request) Successful in 1m53s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Successful in 10m23s
Project CI / Repository checks (pull_request) Successful in 2m24s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Successful in 10m57s
# Conflicts:
#	docs/project-memory/shared-memory/pitfalls.md
2026-10-02 01:35:26 +08:00
k88936 6cfc69abf5 Merge remote-tracking branch 'origin/master' into fix/test-concurrent-problem
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Failing after 1m44s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Failing after 2m57s
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 1m48s
Project CI / AI game creator shell Rust crates (pull_request) Successful in 1m15s
Project CI / Backend tests (pull_request) Failing after 18s
Project CI / Repository checks (pull_request) Failing after 22s
Project CI / Frontend tests (pull_request) Successful in 2m31s
Project CI / AI game creator shell web tests (pull_request) Successful in 2m24s
Project CI / Native shell tests (pull_request) Successful in 6m53s
# Conflicts:
#	docs/project-memory/shared-memory/pitfalls.md
2026-10-01 19:50:10 +08:00
k88936 348d20bf55 AGC 壳后台 Runtime 用例的等待预算覆盖分片 2 的假红面
Project CI / AI game creator shell Rust crates (pull_request) Successful in 1m14s
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 2m40s
Project CI / Backend tests (pull_request) Failing after 44s
Project CI / Frontend tests (pull_request) Successful in 2m2s
Project CI / Repository checks (pull_request) Failing after 17s
Project CI / AI game creator shell web tests (pull_request) Successful in 1m40s
Project CI / Native shell tests (pull_request) Successful in 5m47s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Successful in 10m52s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Successful in 12m22s
- tests/mod.rs 已有的 MOCK_PROVIDER_REQUEST_TIMEOUT / AGENT_RUNTIME_TERMINAL_WAIT_BUDGET 现向 runtime_actions 子模块导出(support.rs)
- project_tools.rs:background_agent_runtime_can_create_checkpoint_before_file_write 的三处 mock provider 等待由 2s/2s/10s 改为统一预算
- action_execution.rs:background_agent_runtime_can_schedule_ready_manifest_tasks 的两处等待同上
- tool_planning.rs:background_agent_runtime_loads_same_agent_continuity_through_tool_observation 的五处等待同上
- task_lifecycle.rs:background_agent_runtime_can_cancel_active_task_and_retry_it 的取消收口轮询由固定 50×20ms 改为终态预算,并同步放宽首条请求等待
- 依据:origin/master 的 run 3143 与 run 3141 在同一 lane(分片 2/4)分别红了这四条用例,现场全是 2 秒预算或多轮轮询被 CI 分片并发放大,链路本身正常
- 验证:本机 4 条用例串行通过;两 lane 并发下连跑 6 次全绿;分片 1/2/3/4 全量 ok
2026-10-01 19:22:08 +08:00
k88936 7db769c5bb 并发追加指令用例不再钉死败者错误文案
Project CI / AI game creator shell Rust crates (pull_request) Successful in 1m29s
Project CI / Backend tests (pull_request) Failing after 16s
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 1m58s
Project CI / Frontend tests (pull_request) Successful in 2m11s
Project CI / Repository checks (pull_request) Failing after 17s
Project CI / AI game creator shell web tests (pull_request) Successful in 1m44s
Project CI / Native shell tests (pull_request) Successful in 5m43s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Successful in 11m51s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Failing after 10m47s
- runtime_protocol/steering.rs:concurrent_distinct_frozen_root_steers_create_only_one_replacement 的败者断言改为「根 Run 已被接管」类错误收口,覆盖三种真实交错(替代 Run 已写回 session 状态 / 仅终止旧根 Run / 状态切换中途)
- 该用例要守的结构不变量保持不变:恰好一次成功、一次失败、只产生一个替代 Run
- 该断言此前在分片里约三成概率因文案不同而假红,而三种文案都由生产侧抢占顺序决定,不是用例要测的结构语义
2026-10-01 18:28:54 +08:00
k88936 ac0b69875f 删除已退役 Supervisor 的持久进程协作治理用例
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Has been cancelled
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Has been cancelled
Project CI / AI game creator shell Rust smoke (pull_request) Has been cancelled
Project CI / AI game creator shell Rust crates (pull_request) Has been cancelled
Project CI / Backend tests (pull_request) Has been cancelled
Project CI / Native shell tests (pull_request) Has been cancelled
Project CI / Frontend tests (pull_request) Has been cancelled
Project CI / Repository checks (pull_request) Has been cancelled
Project CI / AI game creator shell web tests (pull_request) Has been cancelled
- tests/command_runtime.rs:删除 `process_session_supervisor_collaboration_blocks_stdin_but_allows_poll_and_terminate_in_isolated_registry`——Supervisor 已于 2026-09-21 永久退役(项目对话收敛为 DirectProject 与 Design Agent,前端零引用),这条用例不再有现役调用方
- tests/mod.rs:同批删除它唯一的夹具 `process_session_supervisor_collaboration_governance_fixture`(256 行)
- 保留 `process_session_agent_runtime_*_isolated_registry` 两条兄弟用例:它们走的是未退役的 `code-prototype` 路径,且仍是通用 process_session 收口的守门人
- 该用例也是分片偶发假红的来源:慢容器上 terminate 收口按设计翻成 needs-reconciliation(finalize_live_process_session 的 2 秒排水窗口),退役面不值得继续钉
- 验证:用例总数 3154 → 3153;两条兄弟用例通过;无新增编译告警;check:encoding、git diff --check 通过
2026-10-01 18:17:30 +08:00
k88936 bdd315f12f AGC 壳 Rust 单测统一 mock provider 请求预算,修掉分片 4 第二次往返超时
Project CI / AI game creator shell Rust crates (pull_request) Successful in 2m1s
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 2m37s
Project CI / Backend tests (pull_request) Successful in 3m54s
Project CI / Frontend tests (pull_request) Successful in 1m54s
Project CI / Native shell tests (pull_request) Successful in 5m53s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Successful in 9m53s
Project CI / Repository checks (pull_request) Successful in 2m28s
Project CI / AI game creator shell web tests (pull_request) Successful in 1m52s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Failing after 11m53s
- tests/mod.rs 新增 MOCK_PROVIDER_REQUEST_TIMEOUT(30 秒),作为「等一条 mock provider 请求到达」的唯一预算
- tests/sessions.rs 的 7 处 recv_timeout 由散落的 2 秒 / 10 秒改为引用该常量,确认「不会有下一个请求」的 200ms 负向断言保持不变
- wait_for_captured_mock_request 的内联 10 秒预算改为引用同一常量
- pitfalls 记录该超时是 CI 分片并发放大所致,而非产品缺陷,并附本次复核证据
2026-10-01 17:16:16 +08:00
k88936 a7cc28134d AGC Rust 分片失败复核改按名单精确匹配,覆盖 bin 目标用例名
- run-rust-shell-test-shards.mjs:extractFailingTestNames 改为按本片名单精确匹配用例名,不再用 `tests::` / `process_session::tests::` 前缀白名单——bin 目标的 `agent::…::tests::…` 原先永远进不了复核,偶发假红直接判红
- run-rust-shell-test-shards.mjs:复核也失败时同时保留首次失败现场,不再只留复核那一次
- run-rust-shell-test-shards.test.mjs:新增「命名空间用例名也会进复核」的回归用例
- 验证:node --test apps/ai-game-creator-shell/scripts/run-rust-shell-test-shards.test.mjs 3 项通过
2026-10-01 17:16:16 +08:00
k88936 c177dde5c3 AGC 壳通知计数按线程隔离,修掉跨用例后台广播串台
- runtime_driver/entrypoints.rs:测试通知计数从进程级 AtomicU64 改成线程作用域 Cell,只统计本测试线程发出的通知
- runtime_driver/entrypoints.rs:`--test-threads=1` 只串行测试线程,前一个用例放行留下的后台回合仍在宿主 async runtime 工作线程上广播「运行中的项目」通知,不再是断言的取样来源
- thread_manager/mod.rs:同步用例注释,说明计数为何按线程隔离,断言语义(放行 1 / 内容变化 1 / 重复进度 0 / 收口 1)不变
- pitfalls:记录现场、根因、现行口径与验证(修复前 5 次红 3 次,修复后 CI 那一片连跑 18 次全绿)
2026-10-01 17:16:16 +08:00