Reclaim own port holders before agent start and install #456

Merged
weichen merged 4 commits from fix/svc-reclaim-own-port into main 2026-10-12 09:01:00 +00:00
Owner

Summary

  • Add reclaim_own_port: if the service addr is held by a process whose cmdline ancestry matches pidcheck/ENV_BIN, stop it before start/install
  • Wire into do_stop / do_stop_quiet, check_port_free, and install_artifacts (refuse overwrite while own orphan holds the port)
  • Distinguish error text: own residual vs foreign occupant

Why

genui update cleared svc.pid without killing the process, cp left exe (deleted), and start failed with a false 「非本服务」.

Ops

  • Orphan on 8973 killed; genui redeployed to dev@4c5dd3d (running).

Evidence

  • make test-governance SELF receipt /tmp/svc-reclaim-governance2.json exit=0 (task card)

Test plan

  • test_start_reclaims_own_orphan_without_pidfile
  • test_start_rejects_foreign_port_occupant
  • full make test-governance
## Summary - Add `reclaim_own_port`: if the service addr is held by a process whose cmdline ancestry matches `pidcheck`/`ENV_BIN`, stop it before start/install - Wire into `do_stop` / `do_stop_quiet`, `check_port_free`, and `install_artifacts` (refuse overwrite while own orphan holds the port) - Distinguish error text: own residual vs foreign occupant ## Why `genui` update cleared `svc.pid` without killing the process, `cp` left `exe (deleted)`, and start failed with a false 「非本服务」. ## Ops - Orphan on 8973 killed; `genui` redeployed to `dev@4c5dd3d` (running). ## Evidence - `make test-governance` SELF receipt `/tmp/svc-reclaim-governance2.json` exit=0 (task card) ## Test plan - [x] `test_start_reclaims_own_orphan_without_pidfile` - [x] `test_start_rejects_foreign_port_occupant` - [x] full `make test-governance`
weichen added 4 commits 2026-10-12 08:59:25 +00:00
Why: establish the authorized task workspace and its initial baseline.

Evidence: preserved precheck receipt in .task/fix-svc-reclaim-own-port.md; R0=8504b88ace66d709f27339887d6d9ecff610f77c.

Impact: task metadata only; the feature workspace starts at 8504b88ace.

Refs: .task/fix-svc-reclaim-own-port.md
Why: genui update cleared svc.pid without killing the process, then
overwrote the binary and failed start with a false "non-ours" port error.
Evidence: make test-governance (receipt /tmp/svc-reclaim-governance.json)
Impact: reclaim_own_port walks ss listener ancestry; stop/check_port/install
wire it; orphans matching pidcheck are stopped, foreign occupants still refused
Refs: fix/svc-reclaim-own-port

Co-authored-by: Cursor <cursoragent@cursor.com>
Why: bind the task validation checkpoint to the latest integration baseline.

Evidence: SELF recursive component checks; sync_base=8504b88ace66d709f27339887d6d9ecff610f77c; candidate=7c608b6afee39d547ad62013f31d2e2c80a3d047.

Impact: task metadata only.

Refs: .task/fix-svc-reclaim-own-port.md
Record governance evidence after sync
ci / test-pg (pull_request) Successful in 1m41s
ci / test (pull_request) Failing after 2m41s
8ca5b87b1e
Why: task-sync warned prior receipt predates non-card changes.
Evidence: make test-governance receipt /tmp/svc-reclaim-governance2.json exit=0
Impact: Task card SELF evidence aligned with tested_head
Refs: fix/svc-reclaim-own-port
Co-authored-by: Cursor <cursoragent@cursor.com>
weichen merged commit 2723e45244 into main 2026-10-12 09:01:00 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: weichen/Agent-System-Dev#456