Skip to content

fix(manager): add safe worker deletion wrapper - #969

Open
RerankerGuo wants to merge 2 commits into
agentscope-ai:mainfrom
RerankerGuo:fix/issue-967-delete-worker-loop
Open

fix(manager): add safe worker deletion wrapper#969
RerankerGuo wants to merge 2 commits into
agentscope-ai:mainfrom
RerankerGuo:fix/issue-967-delete-worker-loop

Conversation

@RerankerGuo

@RerankerGuo RerankerGuo commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a worker-management delete wrapper that calls hiclaw delete worker <name> with the valid positional CLI syntax
  • return structured JSON so you only report deletion after command success
  • add a records-only cleanup path for state.json, worker-lifecycle.json, and workers-registry.json
  • update Worker management guidance to use the wrapper while retaining the current remote-Worker install flow

Fixes #967.

Verification

  • bash -n manager/agent/skills/worker-management/scripts/delete-worker.sh manager/tests/test-delete-worker-script.sh
  • PATH=/tmp/AgentTeams-pr969-bin:$PATH bash manager/tests/test-delete-worker-script.sh with jq 1.7.1 (10 passed, 0 failed)
  • git diff --check

Rebase note

Rebased onto current main (6f0c7da) and preserved the upstream remote-Worker lifecycle guidance. The changelog now adds only this PR's entry.

CI note

The refreshed matrix has 18 passing checks and 2 skips. Its only failure is
the known SHARD_A test-06-multi-worker setup case where the Manager never
created bob; the deterministic bob setup is covered independently by #985.
No worker-deletion path from this PR is involved.

Temporary dependency

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

❌ Integration Tests Failed (llm-interaction / mgr=copaw / wk=hermes)

Commit: 602e96e
Workflow run: #1397

Test Results
No test output captured.
Debug Log (tail)
No debug logs available.

📦 Download full debug logs & test artifacts

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

📊 CI Metrics Report

Summary

Metric Current Baseline Change
LLM Calls 84 81 +3 ↑ +3.7%
Input Tokens 2612701 2803871 -191170 ↓ -6.8%
Output Tokens 18268 16791 +1477 ↑ +8.8%
Total Tokens 2630969 2820662 -189693 ↓ -6.7%

By Role

Role Metric Current Baseline Change
🧠 Manager LLM Calls 54 68 -14 ↓ -20.6%
Input Tokens 1845148 2502214 -657066 ↓ -26.3%
Output Tokens 12099 13725 -1626 ↓ -11.8%
Total Tokens 1857247 2515939 -658692 ↓ -26.2%
🔧 Workers LLM Calls 30 13 +17 ↑ +130.8%
Input Tokens 767553 301657 +465896 ↑ +154.4%
Output Tokens 6169 3066 +3103 ↑ +101.2%
Total Tokens 773722 304723 +468999 ↑ +153.9%

Per-Test Breakdown

Test Mgr Calls Wkr Calls Δ Calls Mgr In Wkr In Mgr Out Wkr Out Δ Tokens Trend
02-create-worker 4 0 -8 ↓ -66.7% 114230 0 921 0 -243471 ↓ -67.9% ✅ improved
03-assign-task 10 5 0 — 0% 277501 116886 1704 529 -77036 ↓ -16.3% — unchanged
04-human-intervene 10 0 -3 ↓ -23.1% 232176 0 1674 0 -199148 ↓ -46.0% ✅ improved
05-heartbeat 4 0 -3 ↓ -42.9% 106143 0 1175 0 -167934 ↓ -61.0% ✅ improved
06-multi-worker 26 25 +17 ↑ +50.0% 1115098 650667 6625 5640 +497896 ↑ +38.9% ⚠️ regressed

Trends

3 test(s) improved (fewer LLM calls)
⚠️ 1 test(s) regressed (more LLM calls)


Generated by HiClaw CI on 2026-07-13 15:28:15 UTC


📦 Download debug logs & test artifacts

@RerankerGuo
RerankerGuo force-pushed the fix/issue-967-delete-worker-loop branch from 602e96e to 6283d69 Compare July 8, 2026 05:47
@RerankerGuo

Copy link
Copy Markdown
Contributor Author

@shiyiyue1102 Hi! This PR addresses #967. Just rebased onto current main (was conflicting) — CI is now green (18/18). Adds a safe hiclaw delete worker <name> wrapper that cleans state.json / worker-lifecycle.json / workers-registry.json so Manager stops looping on bad delete commands. Could you take a look when convenient?

@RerankerGuo
RerankerGuo force-pushed the fix/issue-967-delete-worker-loop branch from 6283d69 to ffcf4b4 Compare July 13, 2026 05:13
@github-actions

Copy link
Copy Markdown
Contributor

❌ Integration Tests Failed (llm-interaction / mgr=openclaw / wk=openclaw)

Commit: ffcf4b4
Workflow run: #1596

Test Results
No test output captured.
Debug Log (tail)
No debug logs available.

📦 Download full debug logs & test artifacts

@RerankerGuo
RerankerGuo force-pushed the fix/issue-967-delete-worker-loop branch from ffcf4b4 to f154dc7 Compare July 13, 2026 14:42
@shiyiyue1102

Copy link
Copy Markdown
Collaborator

A safe Worker deletion wrapper is useful, but the current PR is too broad for the core problem and conflicts with main. It combines the CLI wrapper, structured output, records-only cleanup, multiple state files, and agent-facing behavior in more than 300 added lines. Please rebase and split the minimal valid hiclaw delete worker wrapper from any local-record recovery or cleanup feature. Each path needs focused tests proving that failed deletion never reports success and that records-only cleanup cannot remove live Worker state.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

关于移除worker陷入死循环

2 participants