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
26 changes: 26 additions & 0 deletions actions/setup/js/unified_session.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,32 @@ describe("Unified conclusion session", () => {
expect(fs.readFileSync(path.join(root, "usage/aw_session.jsonl"), "utf8")).toBe(original);
});

it("collects available tool and engine versions from workflow metadata", () => {
write("aw_info.json", {
cli_version: "v1.2.3",
awf_version: "v0.4.5",
awmg_version: "v0.6.7",
engine_id: "copilot",
agent_version: "v2.3.4",
model: "fixture",
secret: "omit",
});
const { events } = collectUnifiedSession({ rootDir: root });
expect(events.find(event => event.type === "workflow.info")).toMatchObject({
data: {
cliVersion: "v1.2.3",
awfVersion: "v0.4.5",
mcpgVersion: "v0.6.7",
engineId: "copilot",
agentVersion: "v2.3.4",
engine: "copilot",
model: "fixture",
},
provenance: { path: "aw_info.json", component: "workflow" },
});
expect(events.find(event => event.type === "workflow.info").data).not.toHaveProperty("secret");
});

it("retains native provenance, equal-time source order, and invalid/absent timestamps without mutation", () => {
const sources = [
{
Expand Down
13 changes: 12 additions & 1 deletion actions/setup/js/unified_session_payload.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,18 @@ const EVENT_FIELDS = {
secretLeak: ["secretLeak", "secret_leak"],
maliciousPatch: ["maliciousPatch", "malicious_patch"],
},
"workflow.info": { engine: ["engine", "engine_id"], model: ["model"], workflow: ["workflow", "workflow_name"], repository: ["repository"], runId: ["runId", "run_id"] },
"workflow.info": {
engine: ["engine", "engine_id"],
engineId: ["engineId", "engine_id"],
agentVersion: ["agentVersion", "agent_version"],
cliVersion: ["cliVersion", "cli_version"],
awfVersion: ["awfVersion", "awf_version"],
mcpgVersion: ["mcpgVersion", "awmg_version"],
Comment on lines +147 to +151
model: ["model"],
workflow: ["workflow", "workflow_name"],
repository: ["repository"],
runId: ["runId", "run_id"],
},
};
EVENT_FIELDS["session.start"] = EVENT_FIELDS["session.init"];
EVENT_FIELDS["usage.report"] = EVENT_FIELDS["firewall.token_usage"];
Expand Down
19 changes: 19 additions & 0 deletions actions/setup/js/unified_session_payload.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,25 @@ describe("essential unified session payloads", () => {
expect(normalizeUnifiedSessionEvent(compact)).toEqual(compact);
});

it("keeps only supplied workflow version identifiers without conflating CLI and engine versions", () => {
const source = {
type: "workflow.info",
data: { engine_id: "custom", agent_version: "v2", version: "v3", cli_version: "", awf_version: "", awmg_version: "", token: "omit" },
};
expect(normalizeUnifiedSessionEvent(source).data).toEqual({
engine: "custom",
engineId: "custom",
agentVersion: "v2",
cliVersion: "",
awfVersion: "",
mcpgVersion: "",
});
expect(normalizeUnifiedSessionEvent({ type: "workflow.info", data: { engine_id: "custom", version: "v3" } }).data).toEqual({
engine: "custom",
engineId: "custom",
});
});

it("uses one accounting shape without losing zero values or adding overlapping totals", () => {
const data = { provider: "copilot", inputTokens: 0, output_tokens: 2, cache_read_tokens: 0, cache_write_tokens: 0, ai_credits_this_response: 0, ai_credits_total: 0, duration_ms: 0, opaque: "omit" };
const runtime = normalizeUnifiedSessionEvent({ type: "firewall.token_usage", data });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ source for opaque fields.
| `experiment.state`, `experiment.assignment` | Downloaded state and assignment observations, including historical state retained in the supplied snapshot. |
| `grader.manifest`, `grader.result` | Essential deterministic grader definitions/results, without scripts; grading does not invent event time. |
| `eval.result` | Evals JSONL observations, preserving answers, IDs, and observed timestamps. |
| `usage.report`, `execution.result`, `detection.result`, `workflow.info` | Existing accounting, execution evidence, detection verdicts, and run metadata. |
| `usage.report`, `execution.result`, `detection.result`, `workflow.info` | Existing accounting, execution evidence, detection verdicts, and run metadata. `workflow.info` retains available `cliVersion` (gh-aw), `awfVersion`, `mcpgVersion`, `engineId`, and `agentVersion` from `aw_info.json` (`cli_version`, `awf_version`, `awmg_version`, `engine_id`, and `agent_version`, respectively). Unavailable values are not inferred. |
| `session.collection_warning`, `session.collection` | Explicit collection diagnostics and coverage. |
| `session.format` | Leading collector-owned file-format metadata, distinct from source-native events with the same type. |

Expand Down
Loading