Skip to content

fix(worker): keep live OpenClaw token out of bulk file sync - #983

Open
RerankerGuo wants to merge 1 commit into
agentscope-ai:mainfrom
RerankerGuo:fix/issue-809-openclaw-token-merge
Open

fix(worker): keep live OpenClaw token out of bulk file sync#983
RerankerGuo wants to merge 1 commit into
agentscope-ai:mainfrom
RerankerGuo:fix/issue-809-openclaw-token-merge

Conversation

@RerankerGuo

@RerankerGuo RerankerGuo commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #809 by preventing the manual OpenClaw Worker file-sync path from ever replacing the live openclaw.json with the stale MinIO copy, even briefly.

The previous flow copied the live file aside, bulk-mirrored the remote workspace over it, and merged the saved local copy afterward. OpenClaw watches this file, so the stale Matrix token could be observed during that overwrite window and used on reconnect.

Changes

  • fetch remote openclaw.json into a Worker-specific temporary file;
  • exclude the live openclaw.json from the bulk mc mirror;
  • merge Manager-owned remote fields into the untouched local config after the mirror;
  • preserve the existing local-first merge contract, including the local Matrix accessToken;
  • add a focused behavior test with a mock mc implementation.

The behavior test reads the live token inside the mocked bulk-mirror operation. It fails if openclaw.json was not excluded or if the stale remote token became visible. It also verifies that Manager-owned model/channel fields are updated, Worker-owned fields remain, other workspace files are pulled, and the temporary remote config is removed.

Scope

This PR contains only:

  • manager/agent/worker-agent/skills/file-sync/scripts/agentteams-sync.sh
  • manager/tests/test-agentteams-sync.sh
  • the required bilingual changelog entry

The previously stacked integration-test commits are no longer part of the branch.

Verification

  • bash -n manager/agent/worker-agent/skills/file-sync/scripts/agentteams-sync.sh manager/tests/test-agentteams-sync.sh
  • bash manager/tests/test-agentteams-sync.sh
  • git diff --check

Impact

  • Breaking change: no
  • Affected runtime: OpenClaw Worker manual/on-demand file sync
  • Performance: one object mc cp replaces the previous local backup copy; bulk mirror scope is reduced by one file

@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

📊 CI Metrics Report

Summary

Metric Current Baseline Change
LLM Calls 125 81 +44 ↑ +54.3%
Input Tokens 3877136 2803871 +1073265 ↑ +38.3%
Output Tokens 34121 16791 +17330 ↑ +103.2%
Total Tokens 3911257 2820662 +1090595 ↑ +38.7%

By Role

Role Metric Current Baseline Change
🧠 Manager LLM Calls 68 68 0 — 0%
Input Tokens 2491377 2502214 -10837 ↓ -0.4%
Output Tokens 14683 13725 +958 ↑ +7.0%
Total Tokens 2506060 2515939 -9879 ↓ -0.4%
🔧 Workers LLM Calls 57 13 +44 ↑ +338.5%
Input Tokens 1385759 301657 +1084102 ↑ +359.4%
Output Tokens 19438 3066 +16372 ↑ +534.0%
Total Tokens 1405197 304723 +1100474 ↑ +361.1%

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% 107567 0 605 0 -250450 ↓ -69.8% ✅ improved
03-assign-task 11 10 +6 ↑ +40.0% 363587 206629 1943 2009 +100512 ↑ +21.2% ⚠️ regressed
04-human-intervene 18 11 +16 ↑ +123.1% 521528 232467 3131 1818 +325946 ↑ +75.3% ⚠️ regressed
05-heartbeat 7 6 +6 ↑ +85.7% 251661 154395 1850 1061 +133715 ↑ +48.6% ⚠️ regressed
06-multi-worker 28 30 +24 ↑ +70.6% 1247034 792268 7154 14550 +780872 ↑ +61.0% ⚠️ regressed

Trends

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


Generated by HiClaw CI on 2026-07-13 16:41:34 UTC


📦 Download debug logs & test artifacts

@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

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

Commit: 0a2c186
Workflow run: #1652

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 8, 2026

Copy link
Copy Markdown
Contributor

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

Commit: 0a2c186
Workflow run: #1652

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

📦 Download full debug logs & test artifacts

@RerankerGuo

Copy link
Copy Markdown
Contributor Author

@shiyiyue1102 Hi! SHARD_A openclaw/openclaw failed on this PR's CI. Same pattern as #984 — in the copaw/hermes case the hiclaw-worker-bob session directory does not exist at all and Manager never invoked hiclaw create worker --name bob. The flake has now been observed on copaw/hermes, copaw/copaw, and openclaw/openclaw across multiple PRs (#972, #973, #975, #976, #984, this one), and #976 is a docs-only PR with no runtime changes — confirming it's a test infrastructure flake rather than a branch-local regression.

This PR only touches the Worker hiclaw-sync shell script and a regression test; it does not affect Manager agent runtime or worker-create code paths. Could you re-run CI or merge if you agree the flake is unrelated?

@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

❌ Integration Tests Failed (controller-cr-2 / mgr=copaw / wk=copaw)

Commit: 0a2c186
Workflow run: #1652

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-809-openclaw-token-merge branch 2 times, most recently from 1bd7d85 to 0a2c186 Compare July 14, 2026 11:16
@github-actions

Copy link
Copy Markdown
Contributor

❌ Integration Tests Failed (controller-cr / mgr=copaw / wk=copaw)

Commit: 0a2c186
Workflow run: #1652

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

📦 Download full debug logs & test artifacts

@github-actions

Copy link
Copy Markdown
Contributor

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

Commit: 0a2c186
Workflow run: #1652

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

📦 Download full debug logs & test artifacts

@github-actions

Copy link
Copy Markdown
Contributor

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

Commit: 0a2c186
Workflow run: #1652

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

📦 Download full debug logs & test artifacts

@github-actions

Copy link
Copy Markdown
Contributor

❌ Integration Tests Failed (controller-cr / mgr=openclaw / wk=openclaw)

Commit: 0a2c186
Workflow run: #1652

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

📦 Download full debug logs & test artifacts

@github-actions

Copy link
Copy Markdown
Contributor

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

Commit: 0a2c186
Workflow run: #1652

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

📦 Download full debug logs & test artifacts

@github-actions

Copy link
Copy Markdown
Contributor

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

Commit: 0a2c186
Workflow run: #1652

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

📦 Download full debug logs & test artifacts

@github-actions

Copy link
Copy Markdown
Contributor

❌ Integration Tests Failed (controller-cr / mgr=copaw / wk=hermes)

Commit: 0a2c186
Workflow run: #1652

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

📦 Download full debug logs & test artifacts

@shiyiyue1102

Copy link
Copy Markdown
Collaborator

Preventing a stale MinIO copy of openclaw.json from briefly overwriting the live Worker token is valuable. The current PR cannot be reviewed independently because it conflicts with main and includes stacked #985 and #1015 test commits. Please rebase onto the latest main branch and rebuild the PR so the diff contains only the file-sync change, its focused regression, and the required changelog entry. A behavioral test that proves the bulk mirror never replaces the local token would be stronger than only checking for an exclude string.

@RerankerGuo
RerankerGuo force-pushed the fix/issue-809-openclaw-token-merge branch from 0a2c186 to 94550bc Compare July 31, 2026 02:09
@RerankerGuo RerankerGuo changed the title fix(worker): keep openclaw config local during sync fix(worker): keep live OpenClaw token out of bulk file sync Jul 31, 2026
@RerankerGuo

Copy link
Copy Markdown
Contributor Author

Rebased and rebuilt the PR on current main as requested (94550bc).

  • Removed the stacked test: make multi-worker bob setup deterministic #985/test: nudge team leader to coordinate in team room #1015 commits; the branch now has one focused commit and a three-file diff.
  • Updated the renamed runtime path to agentteams-sync.sh.
  • Replaced the static exclude-string assertion with manager/tests/test-agentteams-sync.sh, which executes the sync script against a mock mc backend and reads the live token during the bulk mirror. The test fails if the stale remote token is ever exposed.
  • Kept a required bilingual changelog entry.

Verification:

  • bash -n manager/agent/worker-agent/skills/file-sync/scripts/agentteams-sync.sh manager/tests/test-agentteams-sync.sh
  • bash manager/tests/test-agentteams-sync.sh
  • git diff --check

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