fix: consolidate bug fixes from PR #9 and PR #15#16
fix: consolidate bug fixes from PR #9 and PR #15#16Longado wants to merge 1 commit intoHKUDS:mainfrom
Conversation
Combines the best of both open PRs, resolving their overlapping approaches and applying all 6 fixes that are not yet in main: **mailbox.py** - broadcast(): resolve logical agent names to inbox directory names before exclusion check, so the sender is not delivered their own broadcast when inboxes use user-prefixed format (e.g. "alice_worker" vs "worker") [from PR HKUDS#15] - receive() / peek(): replace bare list comprehension with _parse_messages() helper that wraps each message in try/except, so a single corrupted file no longer crashes the entire fetch [from PR HKUDS#9] **transport/file.py** - fetch(consume=True): atomically rename msg file to .consumed before reading, so concurrent callers cannot both receive the same message [from PR HKUDS#15] **cli/commands.py** - config set / config get: derive valid_keys from ClawTeamConfig.model_fields instead of a hardcoded 3-item set, making all 7 config keys accessible; handle boolean fields (skip_permissions) correctly [from PR HKUDS#15] - approve-join: return an error and exit(1) when no matching join request is found, instead of silently fabricating an agent name [from PR HKUDS#9] - launch_team: read skip_permissions from config and pass it to be.spawn(), matching the behaviour of the standalone spawn command [from PR HKUDS#15] Note: the plans-cleanup fix (PR HKUDS#9 subdirectory approach, PR HKUDS#15 member-filter approach) was already merged via PR HKUDS#6 using the subdirectory strategy, so it is intentionally excluded here. All 135 existing tests pass. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Eddylin03 <79293834+Eddylin03@users.noreply.github.com>
Co-authored-by: Eddylin03 <ylin474@wisc.edu>
Thanks for putting this together. I didn’t merge this PR as-is because it no longer applies cleanly on top of current The fixes now in
Merged into
Thanks again — this PR was useful and directly informed the fixes that are now in Closing this PR since the relevant fixes have now been absorbed into |
Co-authored-by: Eddylin03 <ylin474@wisc.edu>
…r increment + turn_id dedupe - 9 tests covering D-14..D-17 + Pitfall HKUDS#2/HKUDS#3/HKUDS#16 invariants - Module import fails at RED (ModuleNotFoundError) - Covers: 0/1/2 no-progress turns, TaskCompleted reset, net-positive artifact delta, per-agent isolation, turn_id dedupe, question file write, ForcedProgressTriggered emit
Context
Two open PRs (#9 and #15) fix overlapping bugs with different approaches. This PR consolidates the best of both, resolves their conflicts, and applies all 6 fixes not yet in `main`.
The one area of overlap — plans cleanup — was already merged via PR #6 using the subdirectory strategy (PR #9's cleaner approach). It is intentionally excluded here.
Changes
`clawteam/team/mailbox.py`
Bug 1 — broadcast sender exclusion broken (from PR #15)
`broadcast()` compared inbox directory names (e.g. `alice_worker`) against logical agent names (e.g. `worker`) in the exclude set. These never matched, so the sender always received their own broadcast.
Fix: resolve each logical name to its inbox directory name via `TeamManager.resolve_inbox()` before building the exclusion set.
Bug 2 — receive() / peek() crash on corrupted messages (from PR #9)
A single invalid JSON file in an inbox raised an exception that aborted the entire fetch, losing all subsequent valid messages (with `consume=True`, already-deleted messages were gone too).
Fix: extract a `_parse_messages()` helper that wraps each message in `try/except`, silently skipping corrupted entries.
`clawteam/transport/file.py`
Bug 3 — fetch(consume=True) has a race condition (from PR #15)
When two processes call `fetch(consume=True)` concurrently, both could `read_bytes()` the same file before either called `unlink()`, resulting in duplicate message delivery.
Fix: atomically `rename()` the file to `.consumed` before reading. Only one process can win the rename; others get `OSError` and skip the message.
`clawteam/cli/commands.py`
Bug 4 — config set/get only accept 3 of 7 valid keys (from PR #15)
Both commands hardcoded `{"data_dir", "user", "default_team"}`, making `transport`, `workspace`, `default_backend`, and `skip_permissions` impossible to set or get via CLI (even though `config show` displays all 7).
Fix: derive `valid_keys` dynamically from `ClawTeamConfig.model_fields`. Handle boolean fields (`skip_permissions`) with an explicit string→bool conversion.
Bug 5 — approve-join silently fabricates an agent name (from PR #9)
When no matching join request is found, `team approve-join` fabricated a name (`agent-{id[:6]}`) and proceeded to add a spurious team member.
Fix: return an error message and `exit(1)` when the join request cannot be found.
Bug 6 — launch does not pass skip_permissions to spawned agents (from PR #15)
`clawteam spawn` correctly reads `skip_permissions` from config and passes `--dangerously-skip-permissions` to Claude. `clawteam launch` did not, so agents spawned via templates always ran without the flag regardless of config.
Fix: read `skip_permissions` from config via `get_effective()` and forward it to `be.spawn()`.
Relationship to PR #9 and PR #15
If this PR is merged, both #9 and #15 can be closed as superseded (or cherry-picked for anything missed).
Test plan
pytest tests/ -q)config set transport fileandconfig set skip_permissions trueworkteam approve-joinwith an invalid request ID returns an errorclawteam launch hedge-fundrespectsskip_permissionsconfig🤖 Generated with Claude Code