Skip to content

Fix/inbox send stdin content#9

Open
Fiooodooor wants to merge 2 commits into
Fiooodooor:mainfrom
Alan5168:fix/inbox-send-stdin-content
Open

Fix/inbox send stdin content#9
Fiooodooor wants to merge 2 commits into
Fiooodooor:mainfrom
Alan5168:fix/inbox-send-stdin-content

Conversation

@Fiooodooor
Copy link
Copy Markdown
Owner

Summary

  • Problem:
  • Why it matters:
  • What changed:
  • What did NOT change (scope boundary):

Change Type

  • Bug fix
  • Feature
  • Refactor
  • NIC porting slice (specify phase + role below)
  • Docs
  • Security hardening
  • Chore/infra

Scope

  • ClawTeam CLI / orchestration
  • Spawn / backends
  • Skills / tool execution
  • MCP server / transport
  • Task board / inbox
  • NIC porting agents / identities
  • Templates / profiles
  • Tests
  • CI/CD / infra
  • Docs

NIC Porting Context (if applicable)

Field Value
Driver
Target OS
Phase
Role
Board Task ID

Gate Checklist (NIC porting PRs)

  • native_score >= 98.0 (no framework/non-native API calls)
  • portability_score >= 95.0 (cross-compile matrix clean)
  • test_pass_rate = 100% (all TDD tests green)
  • build_status = green (Linux + FreeBSD compile)
  • critical_risks = 0 (no open critical risks in register)
  • Zero-copy verified (no memcpy in hot paths)
  • DMA sync discipline followed (PREWRITE/POSTREAD bracketing)
  • Checker agent PASS verdict attached

Linked Issue/PR

  • Closes #
  • Related #
  • This PR fixes a bug or regression

Root Cause / Regression History (if applicable)

  • Root cause:
  • Missing detection / guardrail:
  • Prior context:
  • Why this regressed now:

Risk Register Impact

  • No new risks introduced
  • New risk(s) added to register with mitigation owner
  • Existing risk(s) mitigated or closed (specify IDs):

Regression Test Plan

For bug fixes, name the test(s) that would have caught this. For porting slices,
list the TDD tests that validate the change. Otherwise write N/A.

  • Coverage level that should have caught this:
    • Unit test
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
  • Target test or file:
  • Scenario the test should lock in:
  • Why this is the smallest reliable guardrail:
  • Existing test that already covers this (if any):
  • If no new test is added, why not:

User-visible / Behavior Changes

List user-visible changes (including defaults/config).
If none, write None.

Diagram (if applicable)

For UI changes or non-trivial logic flows, include a small ASCII diagram reviewers can scan quickly. Otherwise write N/A.

Before:
[user action] -> [old state]

After:
[user action] -> [new state] -> [result]

Security Impact (required)

  • New permissions/capabilities? (Yes/No)
  • Secrets/tokens handling changed? (Yes/No)
  • New/changed network calls? (Yes/No)
  • Command/tool execution surface changed? (Yes/No)
  • Data access scope changed? (Yes/No)
  • If any Yes, explain risk + mitigation:

Repro + Verification

Environment

  • OS:
  • Runtime/container:
  • Model/provider:
  • Integration/channel (if any):
  • Relevant config (redacted):

Steps

Expected

Actual

Evidence

Attach at least one:

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

What you personally verified (not just CI), and how:

  • Verified scenarios:
  • Edge cases checked:
  • What you did not verify:

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.

Compatibility / Migration

  • Backward compatible? (Yes/No)
  • Config/env changes? (Yes/No)
  • Migration needed? (Yes/No)
  • If yes, exact upgrade steps:

Risks and Mitigations

List only real risks for this PR. Add/remove entries as needed. If none, write None.

  • Risk:
    • Mitigation:

Alan Li added 2 commits March 20, 2026 00:27
… IPC

- Add strict whitelist protection mode for workspace pruning
- Implement symlink-based dependency sharing (node_modules, .venv)
- Add headless worker wrapper script for non-interactive execution
- Fix environment variable inheritance bug
- 98.8% workspace size reduction for multi-agent teams

Tested with:
- Tavily search API (real-time data, no cache)
- Swarm inbox IPC communication
- Multi-agent team deployments
When clawteam inbox send is called from a subprocess or shell
script (e.g., via runtime watch --exec), the content argument can
be lost. This fix makes content an optional argument that falls
back to reading from stdin, enabling reliable script integration.

Fixes HKUDS#130
Copilot AI review requested due to automatic review settings May 9, 2026 16:43
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to improve message delivery to the team inbox (notably by allowing clawteam inbox send to take message content from stdin when the positional CONTENT argument is omitted). It also introduces a new OpenClaw worker wrapper script and makes substantial workspace/prompt behavior changes.

Changes:

  • Make clawteam inbox send accept message content from stdin when CONTENT is not provided.
  • Add scripts/openclaw_worker.sh to run an OpenClaw worker and forward results to a team inbox.
  • Modify workspace creation to aggressively delete non-whitelisted files and symlink dependency directories; adjust agent prompt examples to send to a hardcoded "leader" inbox.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 8 comments.

File Description
scripts/openclaw_worker.sh Adds a worker wrapper script that runs openclaw agent and forwards output to clawteam inbox send.
clawteam/workspace/manager.py Adds post-worktree “whitelist delete” cleanup, symlink-based dependency sharing, and required-file self-checks.
clawteam/spawn/prompt.py Changes prompt examples to send messages to a constant "leader" recipient instead of the configured leader name.
clawteam/cli/commands.py Makes inbox CONTENT optional and reads message content from stdin when omitted.

Comment thread clawteam/cli/commands.py
Comment on lines +85 to +145
# 🚀 绝对白名单保护模式 v3.0
# --------------------------
# 【绝对不能删的白名单】
KEEP_ALWAYS = [
# 核心命脉
"openclaw.json",
".env",
".env.local",

# 认知系统
"SOUL.md",
"AGENTS.md",
"TOOLS.md",
"MEMORY.md",
"HEARTBEAT.md",
"IDENTITY.md",
"USER.md",

# 技能和工具
"skills/",
"scripts/",
".openclaw/",
".clawhub/",

# 环境配置
"node_modules/",
"venv/",
".venv/",
"poetry.lock",
"pyproject.toml",
"requirements.txt",

# git工作树必须保留
".git",
]

# 遍历目录删除
for item in wt_path.iterdir():
# 检查是否在白名单
keep = False
for pattern in KEEP_ALWAYS:
if pattern.endswith("/"):
# 目录匹配
if item.is_dir() and item.name == pattern.rstrip("/"):
keep = True
break
else:
# 文件匹配
if item.is_file() and item.name == pattern:
keep = True
break

# 不在白名单就删除
if not keep:
try:
if item.is_file() or item.is_symlink():
item.unlink()
elif item.is_dir():
shutil.rmtree(item)
except Exception as e:
logger.warning(f"删除文件失败 {item}: {e}")
Comment thread clawteam/workspace/manager.py
Comment thread clawteam/spawn/prompt.py
Comment thread scripts/openclaw_worker.sh
Comment thread scripts/openclaw_worker.sh
Comment thread scripts/openclaw_worker.sh
Comment thread clawteam/workspace/manager.py
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.

2 participants