Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion frontend/src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1137,6 +1137,11 @@
"installFailed": "Install failed.",
"fileTooLarge": "That file is over the 256KB import ceiling — trim it or paste the relevant part.",
"importFailed": "Import failed."
},
"listen": {
"title": "One more step, or it can't answer you",
"body": "The snippet above lets you use Commonly from your editor. It does not make this agent answer @mentions here — nothing is listening yet. For that, run the wrapper on the machine your agent lives on:",
"note": "Leave it running. It polls Commonly and replies as {{name}}. Without it, {{name}} appears in your team but stays silent when mentioned."
}
},
"agentProfile": {
Expand Down Expand Up @@ -1410,7 +1415,8 @@
"justNow": "Just now",
"minutesAgo": "{{count}}m ago",
"hoursAgo": "{{count}}h ago",
"daysAgo": "{{count}}d ago"
"daysAgo": "{{count}}d ago",
"neverConnected": "Never connected"
},
"runtime": {
"native": "Native",
Expand Down
8 changes: 7 additions & 1 deletion frontend/src/i18n/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -1133,6 +1133,11 @@
"installFailed": "安装失败。",
"fileTooLarge": "该文件超过 256KB 的导入上限——请精简,或只粘贴相关部分。",
"importFailed": "导入失败。"
},
"listen": {
"title": "还差一步,否则它无法回复你",
"body": "上面的配置让你可以在编辑器里调用 Commonly。但它不会让这个 agent 回复这里的 @提及 —— 现在还没有任何程序在监听。要做到这一点,在 agent 所在的机器上运行:",
"note": "保持它运行。它会轮询 Commonly 并以 {{name}} 的身份回复。不运行的话,{{name}} 会出现在你的团队里,但被提及时始终沉默。"
}
},
"agentProfile": {
Expand Down Expand Up @@ -1406,7 +1411,8 @@
"justNow": "刚刚",
"minutesAgo": "{{count}} 分钟前",
"hoursAgo": "{{count}} 小时前",
"daysAgo": "{{count}} 天前"
"daysAgo": "{{count}} 天前",
"neverConnected": "从未连接"
},
"runtime": {
"native": "原生",
Expand Down
65 changes: 65 additions & 0 deletions frontend/src/v2/__tests__/V2ConnectHonesty.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import en from '../../i18n/locales/en.json';
import zhCN from '../../i18n/locales/zh-CN.json';
import fs from 'fs';
import path from 'path';

/**
* The connect flow used to promise more than it delivered.
*
* Measured on production 2026-08-09: 4 of 6 human @mentions in ten days got no
* reply. The cause was not user error — the web BYO flow wires MCP, which lets
* an agent CALL Commonly from the user's editor, and nothing in that path
* listens for mentions. `commonly agent run` (the wrapper that polls) was a
* footnote. Users finished in two minutes, saw the agent in Your Team, spoke to
* it, and got silence. See #887.
*
* These pin the two claims that fix it, in both languages, because both users
* who hit this were writing Chinese.
*/

const read = (p: string) => fs.readFileSync(path.join(__dirname, p), 'utf8');

describe('the connect flow states what it does not do', () => {
describe.each([['en', en as any], ['zh-CN', zhCN as any]])('%s', (_locale, bundle) => {
const listen = bundle.agentByo?.listen;

test('a listening step exists at all', () => {
expect(listen?.title).toBeTruthy();
expect(listen?.body).toBeTruthy();
expect(listen?.note).toBeTruthy();
});

test('it says plainly that MCP alone will not answer mentions', () => {
const all = `${listen.title} ${listen.body} ${listen.note}`;
// The whole point: name the gap rather than only describing the fix.
expect(all).toMatch(/@|提及/);
expect(all.length).toBeGreaterThan(60);
});

test('the note names the agent, so the consequence is concrete', () => {
expect(listen.note).toMatch(/\{\{name\}\}/);
});
});

test('an agent that never connected does not read as merely quiet', () => {
// Conflating them is how 13 unreachable installs sat in Your Team looking
// healthy next to working agents.
expect(en.yourTeam.activity.neverConnected).toBeTruthy();
expect(zhCN.yourTeam.activity.neverConnected).toBeTruthy();
expect(en.yourTeam.activity.neverConnected).not.toBe(en.yourTeam.activity.noRecent);
expect(zhCN.yourTeam.activity.neverConnected).not.toBe(zhCN.yourTeam.activity.noRecent);
});

test('Your Team renders the never-connected state for a null heartbeat', () => {
const src = read('../components/V2YourTeamPage.tsx');
// `lastHeartbeatAt` is derived from heartbeat events, so null means the
// wrapper was never started — not that the agent is idle.
expect(src).toMatch(/if \(!iso\) return t\('yourTeam\.activity\.neverConnected'\)/);
});

test('the BYO page ships the command that makes an agent listen', () => {
const src = read('../components/V2AgentBYO.tsx');
expect(src).toMatch(/commonly agent run/);
expect(src).toMatch(/agentByo\.listen\.title/);
});
});
32 changes: 32 additions & 0 deletions frontend/src/v2/components/V2AgentBYO.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,12 @@ const V2AgentBYO: React.FC = () => {
? `claude mcp add commonly \\\n -e COMMONLY_API_URL=${apiUrl} \\\n -e COMMONLY_AGENT_TOKEN=${issued.token} \\\n -- npx -y @commonlyai/mcp`
: '';

// The command that makes the agent LISTEN. Everything above is the calling
// direction only; this is the one that answers @mentions.
const listenSnippet = issued
? `export COMMONLY_API_URL=${apiUrl}\nexport COMMONLY_AGENT_TOKEN=${issued.token}\ncommonly agent run ${issued.agentName}`
: '';

const cursorSnippet = issued
? JSON.stringify({
mcpServers: {
Expand Down Expand Up @@ -340,6 +346,32 @@ const V2AgentBYO: React.FC = () => {
<pre className="v2-byo__pre">{cursorSnippet}</pre>
</div>

{/*
The MCP snippets above make the agent able to CALL Commonly from the
user's editor. They do not make it answer @mentions here — nothing
polls. Users finished this flow, saw the agent in Your Team,
mentioned it, and got silence; 4 of 6 mentions in 10 days went
unanswered for exactly this reason (#887). The consequence belongs
at the point of the promise, not in a footnote.
*/}
<div className="v2-byo__snippet v2-byo__snippet--listen">
<div className="v2-byo__snippet-head">
<span>{t('agentByo.listen.title')}</span>
<button
type="button"
onClick={() => copy('listen', listenSnippet)}
className="v2-byo__copy"
>
{copied === 'listen' ? t('agentByo.actions.copied') : t('agentByo.actions.copy')}
</button>
</div>
<p className="v2-byo__listen-body">{t('agentByo.listen.body')}</p>
<pre className="v2-byo__pre">{listenSnippet}</pre>
<p className="v2-byo__listen-note">
{t('agentByo.listen.note', { name: issued.agentName })}
</p>
</div>

<div className="v2-byo__snippet">
<div className="v2-byo__snippet-head">
<span>{t('agentByo.snippets.memory')}</span>
Expand Down
7 changes: 6 additions & 1 deletion frontend/src/v2/components/V2YourTeamPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,12 @@ const formatRelative = (
iso: string | null | undefined,
t: (key: string, opts?: Record<string, unknown>) => string,
): string => {
if (!iso) return t('yourTeam.activity.noRecent');
// An agent that has NEVER been seen is not the same as a quiet one, and
// conflating them is how 13 unreachable installs sat in Your Team looking
// healthy. `lastHeartbeatAt` is derived from heartbeat events, so a BYO
// agent whose wrapper was never started has none at all — the user wired up
// MCP, saw the agent appear here, @mentioned it, and got silence (#887).
if (!iso) return t('yourTeam.activity.neverConnected');
const ms = Date.now() - new Date(iso).getTime();
if (Number.isNaN(ms)) return t('yourTeam.activity.noRecent');
const min = Math.floor(ms / 60000);
Expand Down
Loading