Repository navigation
harden(local-agents): fix a2a DM route + pod roster in get_context + sharper skill - #622
Merged
Merged
Conversation
…, sharpen skill Surfaced by pre-beta smoke testing of local wrapper agents (BYO codex/claude): 1. a2a DM was broken. commonly_dm_agent (MCP) POSTed to /agents/runtime/room — an agent-ROOM (the operator 1:1 channel), which BLOCKS bot senders — so an autonomous local agent could open the DM but never post to it. Repointed it at /agents/runtime/agent-dm (the a2a route cloud agents use), added an optional originPodId, and updated the description. Verified end-to-end: two local wrapper agents (solo↔duo) held a real multi-turn a2a DM. MCP → 0.1.5. 2. get_context didn't return members. Its tool description promises "members," but PodContextService.getPodContext never included them — so agents had no way to see who they could @mention or DM (a real reason "they don't ping"). Added a resolved `members` roster (name, isAgent, self) to both return paths, honoring the documented contract. Serves MCP and wrapper agents alike. 3. Skill hardening (docs/agents/skills/commonly/SKILL.md): a "reach out, don't work alone" section — when to proactively ping a teammate (feedback / domain check / handoff / sync), the members roster as the who-to-ping list, the fixed a2a-DM two-step, and a "don't double-post / don't narrate that you posted" rule (the wrapper posts your output; a narration becomes a 2nd msg and re-pings mentioned agents). Human→agent DM was verified working already (daemon polls the dm.message-typed chat.mention event; a local agent replies with no @mention needed).
lilyshen0722
added a commit
that referenced
this pull request
Jul 4, 2026
…I to 0.1.1 The #622 members roster fed pod.members straight into User.find({_id:{$in}}) — a stray non-ObjectId value (corrupt data, or the test fixture's 'user-1') threw a Mongoose CastError and took down the entire get_context response. main was red on podContextService.test.js. Filter to 24-hex ObjectIds before the query (works live where ids are real ObjectIds; degrades to [] otherwise). Test green. Bump @commonlyai/cli 0.1.0 -> 0.1.1 so the skill-mount + double-post detection in this PR reach users on the next publish.
lilyshen0722
added a commit
that referenced
this pull request
Jul 5, 2026
…+ kill double-post via self-post detection (#624) * fix(cli): honor NO_REPLY so the wrapper stops duplicating agent posts The double-post wasn't "too many messages" — intentional updates ("on it" → "done") are good. It was mechanism duplication: an agent posts via commonly_post_message (MCP), then the wrapper ALSO posts the CLI's final text (usually a restatement), re-firing any @mention. The agent had no way to say "I already posted, stay quiet" — the wrapper ignored NO_REPLY and would post the literal string. Now the wrapper skips its post when the agent's output is empty or exactly NO_REPLY (the established platform sentinel; mixed content still posts verbatim). So an agent that owns its turn via the tool — one message, or a deliberate sequence — ends with NO_REPLY and the wrapper stays out. Agents that don't post via the tool are unaffected: their reply is still posted as before. Skill updated to match: intentional updates are encouraged; end a tool-posted turn with NO_REPLY to avoid the echo. * fix(cli): mount the behavior skill by default + detect self-posts to kill double-post Round-two smoke testing showed the NO_REPLY sentinel alone doesn't fix the double-post: a wrapper agent (even with the skill mounted) posts its reply via commonly_post_message AND then narrates ("Posted to the pod: …"), which the wrapper echoed as a second message — Claude doesn't reliably end on NO_REPLY. Two changes make wrapper agents behave consistently: 1. Bundle the commonly behavior skill in the CLI package (cli/skills/commonly) and mount it via the default attach environment (skills.claude), so a fresh `commonly agent attach claude` gives the agent the house rules — not just the MCP tools. Without it, wrapper-spawned CLIs fly blind (some narrate, some default to NO_REPLY on a normal question). prepublishOnly keeps the bundled copy in sync with docs/agents/skills/commonly/SKILL.md. 2. Detect self-posts: snapshot the pod's message ids before the spawn; if a new message appeared during it, the agent posted via the tool, so DON'T echo its CLI output. Automatic — no reliance on NO_REPLY or the skill loading. Verified live: a fresh agent asked "12 × 12" now posts exactly one message (was two). NO_REPLY + empty-output are still honored as explicit/secondary signals. * fix(context): guard members roster against non-ObjectId ids + bump CLI to 0.1.1 The #622 members roster fed pod.members straight into User.find({_id:{$in}}) — a stray non-ObjectId value (corrupt data, or the test fixture's 'user-1') threw a Mongoose CastError and took down the entire get_context response. main was red on podContextService.test.js. Filter to 24-hex ObjectIds before the query (works live where ids are real ObjectIds; degrades to [] otherwise). Test green. Bump @commonlyai/cli 0.1.0 -> 0.1.1 so the skill-mount + double-post detection in this PR reach users on the next publish. * test(mcp): update commonly_dm_agent test for the /agent-dm route (a2a fix) The #622 a2a-DM fix repointed commonly_dm_agent from /room to /agent-dm with a nested target — but the .mjs test still asserted the old /room route + flat body, so main was red (my grep missed the .mjs extension in #622). Update the assertion to the new route/shape. * test(cli): mock the /messages route in the route-aware run-loop test The double-post detection snapshots pod messages before/after each spawn. The route-aware mock's else-branch (which consumes the event queue) was catching those GETs and advancing the event counter, breaking session-reuse sequencing. Answer /messages explicitly with an empty list. CLI suite green locally (155).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pre-beta smoke testing of local wrapper agents (BYO codex/claude via
commonly agent run) surfaced two real bugs and a skill gap:1. Agent-to-agent DM was broken.
commonly_dm_agentposted to/agents/runtime/room(an agent-room — the operator 1:1 channel, which blocks bot senders). A local agent could open the DM but never post to it. Repointed at/agents/runtime/agent-dm(the a2a route cloud agents already use) + optionaloriginPodId. Verified end-to-end: two local wrapper agents (solo↔duo) held a real multi-turn a2a DM. MCP bumped 0.1.4 → 0.1.5 (needsnpm publish).2.
get_contextdidn't return members. The tool description promisesmembers, but the endpoint never included them — so agents had no way to see who they could ping (a concrete reason "they don't ping"). Added a resolvedmembersroster (name, isAgent, self) to both return paths. Serves MCP + wrapper agents.3. Skill hardened — a "reach out, don't work alone" section (when to proactively ping: feedback / domain check / handoff / sync), the roster as the who-to-ping list, the fixed a2a-DM flow, and a "don't double-post / don't narrate that you posted" rule.
Human→agent DM verified already working (daemon polls the
dm.messageevent; agent replies with no @mention).Deploy notes: #2 needs
Deploy Devto take effect; MCP 0.1.5 needs annpm publish.🤖 Generated with Claude Code
https://claude.ai/code/session_01MnRCAFgjrrGZxo9VRCmCm9