{"summary_schema":1,"source":"SELF","timestamp":"2026-10-21T03:04:28.871393+00:00","command":"sh -c 'set -e; echo \"[1] target test on a clean host:\"; PYTHONDONTWRITEBYTECODE=1 python3 -m unittest tests.test_svc.SvcDbRecoveryTests.test_static_fresh_deploy_registers_pidcheck_and_starts 2>&1 | tail -3; echo; echo \"[2] same test while the legacy hard-coded port is held by a foreign process:\"; bash /tmp/occupy-port.sh 18951 env PYTHONDONTWRITEBYTECODE=1 python3 -m unittest tests.test_svc.SvcDbRecoveryTests.test_static_fresh_deploy_registers_pidcheck_and_starts 2>&1 | tail -4; echo; echo \"[3] whole module tests.test_svc:\"; PYTHONDONTWRITEBYTECODE=1 python3 -m unittest tests.test_svc 2>&1 | tail -3; echo; echo \"[4] legacy port released again:\"; (ss -ltn | grep -q \":18951 \" && echo LEAK) || echo released'","exit_code":0,"cwd":"/home/weichen/projects/Agent-System-Dev-wt-fix-svc-static-deploy-test-port-flake","before_head":"d0b217d3a486d32db91d69539c39d07ed9dbdae0","after_head":"d0b217d3a486d32db91d69539c39d07ed9dbdae0","branch":"fix/svc-static-deploy-test-port-flake","target_branch":"main","target_head":"a496ea0f0249b2b412354677ef97612ccd692d25","root_target":"main","immediate_target":"main","before_tracked_diff_sha256":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","after_tracked_diff_sha256":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","output_tail":["OK","","[2] same test while the legacy hard-coded port is held by a foreign process:","----------------------------------------------------------------------","Ran 1 test in 0.599s","","OK","","[3] whole module tests.test_svc:","Ran 23 tests in 29.185s","","OK","","[4] legacy port released again:","released"],"output_sha256":"d8f352a6d39b09c2fca2e868a40723780fa8c7cf3ea4ab79600d894d2069db9f","receipt_sha256":"314db6279eec9bfc2666b2533347df850ada748e6e99c481bc1633f3faf34c4d","receipt_path":"/home/weichen/.cache/agent-system-dev/evidence/314db6279eec9bfc2666b2533347df850ada748e6e99c481bc1633f3faf34c4d.json"}
Why: establish the authorized task workspace and its initial baseline.
Evidence: preserved precheck receipt in .task/fix-svc-static-deploy-test-port-flake.md; R0=a9566a68505ac97dead15ed3b5672954f15cea1c.
Impact: task metadata only; the feature workspace starts at a9566a6850.
Refs: .task/fix-svc-static-deploy-test-port-flake.md
Why: the task card needs the host-captured run that shows the fixed test passes
both on a clean host and while the legacy hard-coded port is held by a foreign
process, so the review and merge gate can re-check the claim instead of trusting
the worker's self-report.
Evidence: receipt 314db6279eec9bfc (SELF), tested head d0b217d3, exit 0.
Impact: task card only.
Refs: fix/svc-static-deploy-test-port-flake
Why: include the current integration baseline before verification.
Evidence: fetched origin/main=a496ea0f0249b2b412354677ef97612ccd692d25.
Impact: integrate upstream changes without rewriting task history.
Refs: task-sync
Why: test_static_fresh_deploy_registers_pidcheck_and_starts hardcoded
port 18951, so any process already holding that port made svc.sh refuse
to bind (correct behaviour) and the test failed for a reason unrelated to
what it guards. Host reproduced this deterministically: with 18951
occupied the case failed, on a clean host it passed 10/10.
Evidence: fix/svc-static-deploy-test-port-flake @ 4ebf9e1, SELF receipts
7dfe7b09 (target case clean, target case while 18951 is held, whole
tests.test_svc module 23 tests) and the earlier 518-test test-affected
run; independent review session (pi/glm-5.3-flash, fresh process)
concluded PASS.
Impact: tests/test_svc.py only. All eight assertions kept verbatim;
svc.sh is untouched, and the tests/test_svc.py:753-754 register_pg
fixture is deliberately left alone.
Refs: tests/test_svc.py:989
Why: the first CI wait on 996cbf0 failed in the test job, but the failure
is `npm ci` losing its TLS connection to registry.npmjs.org while fetching
zrender, not anything in this change. The card must say so plainly instead
of leaving CI as NOT_RUN.
Evidence: run 4592, job 7579. Same log shows the Python governance suite
at 518 tests OK (skipped=35), so the target case passed in CI.
Impact: task card only.
Refs: PR #668
Why: three consecutive CI attempts on this branch failed for reasons outside
the diff (two npm registry ECONNRESETs, one real-RDM fixture startup exit),
and the run-level rerun endpoint is now exhausted. Merging needs all three
required jobs green on the exact head, so the task stops here rather than
looping on retries.
Evidence: runs 4592 (job 7579), 4594 (jobs 7586, 7590) at head 01b6745; the
`test` job, which is the one that runs tests/test_svc.py, passed on 01b6745.
Impact: task card only. Code stays as reviewed.
Refs: PR #668
Why: include the current integration baseline before verification.
Evidence: fetched origin/main=2fd11effd9ccb0ae35ae5a47caccefccbbb05a8e.
Impact: integrate upstream changes without rewriting task history.
Refs: task-sync
Why: the previous "blocked" reason (CI infrastructure failures) was
externally resolved by the Backend ResolveHITL fix (PR #237) and its
Dev gitlink repin (PR #674 -> 2fd11eff). Re-review against the
post-Repin baseline PASSes; the card needed to reflect that.
Evidence:
/tmp/svc-flake-sync-20261021.json: sync to 2fd11eff
/tmp/svc-flake-finish-test-20261021.json: target test green
/tmp/svc-flake-svc-tests-20261021.json: 213 svc tests OK (18 skipped)
/tmp/svc-flake-review-r1-20261021.json: pi-glm, success (review PASS)
/tmp/multi-instance-with-be-fix-20261021.json: root-cause fix
/tmp/repin-maketest5-20261021.json: Dev make test green post-Repin
Impact: card metadata only; no behaviour change.
Refs: PR #668; fix/svc-static-deploy-test-port-flake
Why: close the task card inside its own PR so landing it needs no post-merge backfill or separate close PR.
Evidence: .task/fix-svc-static-deploy-test-port-flake.md -> .task/archive/fix-svc-static-deploy-test-port-flake.md; status 已完成(合入前闭合); PR #668https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Dev/pulls/668.
Impact: task metadata only; the card is archived within PR #668 and lands with its merge commit.
Refs: task.sh close --self
weichen
merged commit 444fb1dee2 into main2026-10-21 10:14:53 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
fix/svc-static-deploy-test-port-flake 任务卡
任务主记录:<PR 链接,交付前填写>;状态:进行中;owner:weichen
权威仓:ssh://git@192.168.3.2:2222/weichen/Agent-System-Dev.git;目标分支:main;R0(initial_base_sha)=
a9566a6850工作区:/home/weichen/projects/Agent-System-Dev-wt-fix-svc-static-deploy-test-port-flake(worktree);分支:fix/svc-static-deploy-test-port-flake
分支类型:standalone;root_target:main;immediate_target:main;accepting_requirements:false
需求分流:verdict=NEW;selected_initiative=无;requirement_sha256=9dd8c0eec3933926486dbc7537df17ada16cbe48d6151410626f43be81914353;triage_receipt=/tmp/svc-flaky-triage.json;receipt_sha256=7e0e09ea9fd8067ba091a3b657f7930bac6d5eceb08da1a0a2c86c415a4c2c7a
授权与交付终点:修复
tests/test_svc.py中因硬编码端口导致的偶发失败用例,standalone 直达 main(PR + 完整 CI + 独立 Review)。不含scripts/svc.sh改动、不含其它用例的端口治理、不含发布/部署。交付模式:goal-first(目标、范围和交付终点一次确认;范围内连续推进)
实施执行:agent-per-unit(配置:AGENT-EXECUTION.md)
合入执行:agent(已授权交付范围内,Review 通过、冲突解决且当前 HEAD 的 CI 通过后合入)
流程依据:仓库根目录 policy/delivery.md(归档后仍按仓库根目录定位)
目标与非目标
tests/test_svc.py的SvcDbRecoveryTests.test_static_fresh_deploy_registers_pidcheck_and_starts不再因端口占用而偶发失败;该用例守护的语义(static 首启探活不得把http.server判成「进程即退」)保持不变。port = 18951。只要机器上任何进程占用该端口,scripts/svc.sh的check_port_free就会正确拒绝(「端口被占用(非本服务)」、退出 1),用例因此失败。host 实测:占用 18951 时该用例稳定失败(AssertionError: 1 != 0),不占用时 10/10 通过。tests/test_svc.py(测试代码)。产品侧scripts/svc.sh不改——其拒绝占口的行为是正确的。scripts/svc.sh;不改tests/test_svc.py:753-754的register_pg("pg1", 18951, ...)夹具(只写svc.env文本、从不绑端口,与本问题无关);不重构测试类;不新增跨用例端口管理框架(TOCTOU 套件级解法属独立增量)。Agent 实施收据
路由与 fail-stop 规则见根目录 AGENT-EXECUTION.md 与 policy/delivery.md;每次尝试一行,原始日志留在源码外收据路径。
tests/test_svc.py单文件:硬编码端口 → 内核分配空闲端口cursor-agent-stable,model auto;session f4bd5b1f-6258-48f5-bcbd-442e1f8a66f2)agent-exec apply快进入分支pi,zai-coding-cn/glm-5.3-flash,session not-observable)同步记录
a9566a6850a9566a6850a496ea0f024ebf9e1b47证据(Evidence)
结果与验证(完成后填写)
tests/test_svc.py:989的硬编码port = 18951换成socket.bind(("127.0.0.1", 0))内核分配空闲端口(3 增 1 删,单文件单 hunk)。用例的 8 条断言一条未删未弱化。tests.test_svc全模块 23 项 OK(被测 HEAD 4ebf9e1,SELF,收据 7dfe7b09)make test-affected BASE=main全量 518 项 OK(被测 HEAD d0b217d3,SELF;同步后非卡片变更触发 WARN,该收据按治理规则作废并以4ebf9e1重跑,见上)test/test-pg/svc-realcombo)——合入前由make ci-wait取得 GATEsvc.sh真正 bind 之间存在 TOCTOU 窗口。失效模式是响亮失败(check_port_free报错退出),不会静默假绿;且与本仓既有 5 处同类夹具(test_svc_recover.py:187、test_svc.py:366、test_task_pr_check.py:100、test_task_triage.py:230、test_svc_realcombo.py:128)风险同级。套件级解法属独立增量,不在本任务扩围。合入与清理
pi(zai-coding-cn/glm-5.3-flash),非 host 主模型、非实施会话,未使用--continue/--resume/既有 session id,session 身份 not-observable。base=origin/main a496ea0f,head=0bd5a4b(同步前)/ 4ebf9e1(同步后)。核对项:动态取端口写法与仓内 5 处既有夹具惯例一致且socket已在:12导入;逐条核对 8 条断言未删未弱化;diff 仅tests/test_svc.py单 hunk,:753-754夹具未动;TOCTOU 与既有惯例同级、非阻塞;无回归面。重放依据:host 已在4ebf9e1独立重跑目标用例(含占端口一腿)与全模块,收据 7dfe7b09;审阅原始输出在仓外/tmp/svc-flake-review-final.log。make task-sync纳入 origin/main a496ea0f(仅并入另一任务的归档卡与 spec,无代码变更、无组件 pin 变动);同步导致被测 HEAD 变化,关键检查已在4ebf9e1重跑。| 同步(记录前对象) |
a496ea0f02|bbb9024e97| 2026-10-21T03:16:00Z |