Skip to content

Commit 870a554

Browse files
committed
Add in-app Claude Code and Codex telemetry setup guide
1 parent a7b2d2f commit 870a554

13 files changed

Lines changed: 679 additions & 15 deletions

‎frontend/docs/validation-review.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Frontend validation and independent review
22

3+
## In-app agent telemetry setup guide (2026-10-12)
4+
5+
Agents now has a **Set up telemetry** panel, also linked from the **Get started** connection step and the Agents empty state. It generates copyable Claude Code JSON, Codex TOML and a coding-agent brief using an editable collector base URL. Content flags default off and reset when changing providers; the guide explains that metadata and some tool snippets may still be exported. It links to collector ingestion setup, documents required span mappings and distinguishes receiving telemetry from complete run compatibility.
6+
7+
Claude configuration uses per-signal logs/traces destinations without disabling existing metrics. Existing configuration must be merged in place, including Codex inline exporters and tables. The panel remains available on discovery errors, preserves filters and frozen time bounds, and uses `setup=1` for direct links/reload. This transient parameter is excluded from remembered observability filters.
8+
9+
Final follow-up checks pass: TypeScript/production build, **62 focused unit tests**, **28 application tests**, **8 production mount tests** and **22 relevant Storybook tests**. New cases cover copying both configurations/agent brief, content opt-in, invalid URLs, clipboard failure, empty/error states, stable query counts and filters, keyboard/mobile accessibility, and `/` + `/next` mounts. All four generated JSON/TOML variants also pass real parsers. A host build initially encountered root-owned generated files from previous container runs; the pinned Playwright container completed the final build and tests. The full application suite was not repeated for this follow-up, and no live Claude Code/Codex exporter integration is claimed.
10+
11+
The [Mayfly UI decision and screenshot demo](https://mayfly-celld.tail835e0d.ts.net/w/46ncdGypknzAj7dnRkJ8bQ?page=6345efc5-183e-4dce-8f81-dbd4cd83ee1d) records the three placement options, selected design, setup flow, provider references and four screenshots. Sol 6.1 implemented the component and unit coverage; Two Opus 5.5 reviews checked provider correctness and follow-up corrections; the final review confirmed all five initial findings fixed with no remaining regressions or blockers. Evaluations and cost estimates remain deferred.
12+
313
## Agents run dashboard (2026-10-12)
414

515
Implemented on `feat/agent-runs-dashboard` from `origin/main` `06030daa`. The [Mayfly Agents record](https://mayfly-celld.tail835e0d.ts.net/w/46ncdGypknzAj7dnRkJ8bQ?page=b3577b4a-031d-46d3-827a-df813856231a) lives beneath the existing native-screens page. Sol 6.1 implementation and integration reviewers, Opus 5.5 telemetry/browser/final reviewers, and Luna wiki discovery contributed to this change.

‎frontend/e2e-prod/mounts.spec.ts‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,30 @@ function problems(page: Page): string[] {
1313

1414
for (const mount of ['', '/next']) {
1515
test.describe(`the production build mounted at ${mount || '/'}`, () => {
16+
test('opens the shared agent setup guide from Get started under its mount', async ({
17+
page,
18+
}) => {
19+
const failed = problems(page);
20+
await page.addInitScript(() => sessionStorage.setItem('parseable-mode', 'demo'));
21+
await page.goto(`${mount}/onboarding`);
22+
await page.getByRole('link', { name: 'Set up Claude Code or Codex' }).click();
23+
await expect(page).toHaveURL(`${mount}/agents?setup=1`);
24+
const guide = page.getByRole('dialog', { name: 'Set up agent telemetry' });
25+
await expect(guide).toBeVisible();
26+
await guide.getByRole('tab', { name: 'Codex', exact: true }).click();
27+
await expect(guide.getByLabel('Codex settings', { exact: true })).toContainText(
28+
'[otel.trace_exporter.otlp-http]',
29+
);
30+
await expect(
31+
guide.getByRole('link', { name: 'View collector and ingestion setup' }),
32+
).toHaveAttribute('href', `${mount}/add-data`);
33+
await page.reload();
34+
await expect(guide).toBeVisible();
35+
await guide.getByRole('button', { name: 'Close dialog' }).click();
36+
await expect(page).toHaveURL(`${mount}/agents`);
37+
expect(failed).toEqual([]);
38+
});
39+
1640
test('loads lazy pages on deep routes from its own mount', async ({ page }) => {
1741
const failed = problems(page);
1842
const paths: string[] = [];

‎frontend/e2e/agent-setup.spec.ts‎

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
import AxeBuilder from '@axe-core/playwright';
2+
import { expect, test, type Page } from '@playwright/test';
3+
import { agentDemoFields, agentDemoRows } from '../src/lib/agents';
4+
5+
async function serve(page: Page, options: { empty?: boolean; error?: boolean } = {}) {
6+
const mutations: string[] = [];
7+
const queries: unknown[] = [];
8+
await page.route('**/api/**', async (route) => {
9+
const req = route.request();
10+
const path = new URL(req.url()).pathname;
11+
if (req.method() !== 'GET' && path !== '/api/v1/query') mutations.push(path);
12+
if (path === '/api/v1/logstream')
13+
return route.fulfill(
14+
options.error
15+
? { status: 503, body: 'Discovery unavailable' }
16+
: { json: options.empty ? [] : [{ name: 'agent_telemetry' }] },
17+
);
18+
if (path.endsWith('/schema'))
19+
return route.fulfill({ json: { fields: agentDemoFields.map((name) => ({ name })) } });
20+
if (path.endsWith('/info'))
21+
return route.fulfill({
22+
json: { telemetryType: 'traces', logSource: [{ log_source_format: 'otel-traces' }] },
23+
});
24+
if (path === '/api/v1/query') {
25+
queries.push(req.postDataJSON());
26+
return route.fulfill({ json: agentDemoRows(Date.parse('2026-10-12T16:00:00.000Z')) });
27+
}
28+
if (path === '/api/v1/about') return route.fulfill({ json: { capabilities: {} } });
29+
return route.fulfill({ status: 404, body: 'No fixture' });
30+
});
31+
await page.addInitScript(() => {
32+
Object.defineProperty(navigator, 'clipboard', {
33+
configurable: true,
34+
value: {
35+
writeText: async (value: string) => {
36+
(window as unknown as { copied: string }).copied = value;
37+
},
38+
},
39+
});
40+
});
41+
return { mutations, queries };
42+
}
43+
const guide = (page: Page) => page.getByRole('dialog', { name: 'Set up agent telemetry' });
44+
const copied = (page: Page) =>
45+
page.evaluate(() => (window as unknown as { copied: string }).copied);
46+
47+
test('Get started opens the shared guide and copies provider configs with explicit content choice', async ({
48+
page,
49+
}) => {
50+
const { mutations } = await serve(page, { empty: true });
51+
await page.goto('/onboarding');
52+
await page.getByRole('link', { name: 'Set up Claude Code or Codex' }).click();
53+
await expect(page).toHaveURL('/agents?setup=1');
54+
const panel = guide(page);
55+
await expect(panel).toBeVisible();
56+
await expect(panel.getByRole('checkbox')).not.toBeChecked();
57+
await panel.getByLabel('Collector base URL').fill('https://collector.example/otel/');
58+
await panel.getByRole('button', { name: 'Copy Claude Code settings' }).click();
59+
const config = JSON.parse(await copied(page));
60+
expect(config.env.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT).toBe(
61+
'https://collector.example/otel/v1/traces',
62+
);
63+
expect(config.env.OTEL_EXPORTER_OTLP_LOGS_ENDPOINT).toBe(
64+
'https://collector.example/otel/v1/logs',
65+
);
66+
expect(config.env.OTEL_LOG_USER_PROMPTS).toBe('0');
67+
expect(config.env.OTEL_LOG_ASSISTANT_RESPONSES).toBe('0');
68+
await panel.getByRole('checkbox').check();
69+
await panel.getByRole('button', { name: 'Copy Claude Code settings' }).click();
70+
expect(JSON.parse(await copied(page)).env.OTEL_LOG_TOOL_CONTENT).toBe('1');
71+
await panel.getByRole('tab', { name: 'Codex', exact: true }).click();
72+
await expect(panel.getByRole('checkbox')).not.toBeChecked();
73+
await panel.getByRole('button', { name: 'Copy Codex settings' }).click();
74+
expect(await copied(page)).toContain('endpoint = "https://collector.example/otel/v1/traces"');
75+
expect(await copied(page)).toContain('endpoint = "https://collector.example/otel/v1/logs"');
76+
expect(await copied(page)).toContain('log_user_prompt = false');
77+
await panel.getByRole('checkbox').check();
78+
await panel.getByText('Copy instructions for your coding agent', { exact: true }).click();
79+
await panel.getByRole('button', { name: 'Copy Telemetry setup agent brief' }).click();
80+
expect(await copied(page)).toContain('Set up Codex telemetry');
81+
expect(await copied(page)).toContain('log_user_prompt = true');
82+
expect(await copied(page)).toContain('Requested content flags are explicitly enabled');
83+
expect(mutations).toEqual([]);
84+
});
85+
86+
test('invalid endpoints withhold copy actions and clipboard failure leaves selectable config', async ({
87+
page,
88+
}) => {
89+
await serve(page, { empty: true });
90+
await page.goto('/agents?setup=1');
91+
const panel = guide(page);
92+
await panel.getByLabel('Collector base URL').fill('https://user:secret@example.com?token=x');
93+
await expect(panel.getByLabel('Collector base URL')).toHaveAttribute('aria-invalid', 'true');
94+
await expect(panel.getByRole('button', { name: 'Copy Claude Code settings' })).toHaveCount(0);
95+
await panel.getByLabel('Collector base URL').fill('http://127.0.0.1:4318');
96+
await page.evaluate(() => {
97+
Object.defineProperty(navigator, 'clipboard', {
98+
value: {
99+
writeText: async () => {
100+
throw new Error('unavailable');
101+
},
102+
},
103+
});
104+
});
105+
await panel.getByRole('button', { name: 'Copy Claude Code settings' }).click();
106+
await expect(
107+
panel.getByText('Clipboard is unavailable. Select and copy the configuration below.'),
108+
).toBeVisible();
109+
await expect(panel.getByLabel('Claude Code settings', { exact: true })).toContainText(
110+
'CLAUDE_CODE_ENABLE_TELEMETRY',
111+
);
112+
});
113+
114+
test('guide preserves dataset, filters, frozen range and query count on close and reload', async ({
115+
page,
116+
}) => {
117+
const { queries } = await serve(page);
118+
const params = new URLSearchParams({
119+
start: '2026-10-12T15:00:00.000Z',
120+
end: '2026-10-12T16:00:00.000Z',
121+
search: 'Support',
122+
status: 'success',
123+
model: 'example-model',
124+
});
125+
await page.goto(`/agents/agent_telemetry?${params}`);
126+
await expect(page.getByRole('button', { name: 'Inspect run Support assistant' })).toBeVisible();
127+
const count = queries.length;
128+
await page.getByRole('button', { name: 'Set up telemetry', exact: true }).click();
129+
await expect(guide(page)).toBeVisible();
130+
await guide(page).getByRole('button', { name: 'Close dialog' }).click();
131+
await expect(guide(page)).toHaveCount(0);
132+
for (const [key, value] of params) expect(new URL(page.url()).searchParams.get(key)).toBe(value);
133+
expect(queries.length).toBe(count);
134+
await expect(page.getByRole('button', { name: 'Set up telemetry', exact: true })).toBeFocused();
135+
await page.getByRole('button', { name: 'Set up telemetry', exact: true }).click();
136+
await page.reload();
137+
await expect(guide(page)).toBeVisible();
138+
await page.keyboard.press('Escape');
139+
for (const [key, value] of params) expect(new URL(page.url()).searchParams.get(key)).toBe(value);
140+
await expect(page.getByRole('button', { name: 'Inspect run Support assistant' })).toBeVisible();
141+
});
142+
143+
for (const state of ['empty', 'error'] as const) {
144+
test(`guide is available with ${state} discovery`, async ({ page }) => {
145+
const { mutations } = await serve(page, { [state]: true });
146+
await page.goto('/agents');
147+
await page
148+
.getByRole('button', {
149+
name: state === 'empty' ? 'Configure an agent' : 'Set up telemetry',
150+
exact: true,
151+
})
152+
.click();
153+
await expect(guide(page)).toBeVisible();
154+
await expect(
155+
guide(page).getByRole('button', { name: 'Copy Claude Code settings' }),
156+
).toBeVisible();
157+
expect(mutations).toEqual([]);
158+
});
159+
}
160+
161+
test('guide supports narrow screens, keyboard tabs and accessible controls', async ({ page }) => {
162+
await serve(page, { empty: true });
163+
await page.setViewportSize({ width: 390, height: 844 });
164+
await page.goto('/agents?setup=1');
165+
const panel = guide(page);
166+
await expect(panel).toBeVisible();
167+
await panel.getByRole('tab', { name: 'Claude Code' }).focus();
168+
await page.keyboard.press('ArrowRight');
169+
await expect(panel.getByRole('tab', { name: 'Codex', exact: true })).toHaveAttribute(
170+
'aria-selected',
171+
'true',
172+
);
173+
await panel
174+
.getByLabel('Collector base URL')
175+
.fill('https://collector.example/some/long/path/prefix');
176+
await panel.getByText('Mapping and validation checklist', { exact: true }).click();
177+
await expect(panel.getByText('Map agent and operation', { exact: false })).toBeVisible();
178+
expect(await panel.evaluate((node) => node.scrollWidth <= node.clientWidth)).toBe(true);
179+
expect((await new AxeBuilder({ page }).include('[role="dialog"]').analyze()).violations).toEqual(
180+
[],
181+
);
182+
});

0 commit comments

Comments
 (0)