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
5 changes: 3 additions & 2 deletions actions/setup/js/parse_mcp_gateway_log.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ function generateTokenUsageSummary(summary) {
if (!summary || summary.totalRequests === 0) return "";

const lines = [];
lines.push("### 📊 Token Usage\n");
lines.push("| Model | Input | Output | Cache Read | Cache Write | ET | Requests | Duration |");
lines.push("|-------|------:|-------:|-----------:|------------:|---:|---------:|---------:|");

Expand Down Expand Up @@ -162,6 +161,8 @@ function generateTokenUsageSummary(summary) {
lines.push(`<sub>ET weights: input=${w.input} · cached_input=${w.cached_input} · output=${w.output} · reasoning=${w.reasoning} · cache_write=${w.cache_write}</sub>`);
}

lines.push("");

return lines.join("\n") + "\n";
}

Expand All @@ -183,7 +184,7 @@ function writeStepSummaryWithTokenUsage(coreObj) {
const parsedSummary = parseTokenUsageJsonl(content);
const markdown = generateTokenUsageSummary(parsedSummary);
if (markdown.length > 0) {
coreObj.summary.addRaw(markdown);
coreObj.summary.addDetails("Token Usage", "\n\n" + markdown);
}
// Export total effective tokens as a GitHub Actions env var for use in
// generated footers (GH_AW_EFFECTIVE_TOKENS is read by messages_footer.cjs)
Expand Down
2 changes: 1 addition & 1 deletion actions/setup/js/parse_mcp_gateway_log.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ Some content here.`;
setFailed: vi.fn(),
summary: {
addRaw: vi.fn().mockReturnThis(),
addDetails: vi.fn().mockReturnThis(),
write: vi.fn(),
},
};
Expand Down Expand Up @@ -1004,7 +1005,6 @@ not-json
test("renders header and table columns", () => {
const summary = parseTokenUsageJsonl(JSON.stringify({ model: "claude-sonnet-4-6", provider: "anthropic", input_tokens: 100, output_tokens: 200, cache_read_tokens: 5000, cache_write_tokens: 3000, duration_ms: 2500 }));
const md = generateTokenUsageSummary(summary);
expect(md).toContain("### 📊 Token Usage");
expect(md).toContain("| Model | Input | Output | Cache Read | Cache Write | ET | Requests | Duration |");
expect(md).toContain("claude-sonnet-4-6");
Comment on lines 1005 to 1009
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

This test name is now misleading: generateTokenUsageSummary no longer renders a header (the assertion for the header was removed). Rename the test to reflect what it actually verifies (e.g., table columns/content).

Copilot uses AI. Check for mistakes.
});
Expand Down
Loading