Skip to content

Commit 44a7567

Browse files
committed
Merge latest main and preserve Lark flat reply placement
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
2 parents 99d3a8b + eecf542 commit 44a7567

672 files changed

Lines changed: 94169 additions & 9105 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/package-smoke.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ jobs:
114114
- uses: actions/setup-node@v6
115115
with:
116116
node-version: "24"
117+
cache: npm
118+
cache-dependency-path: apps/presentation/dashboard/package-lock.json
117119
- uses: astral-sh/setup-uv@v7
118120
- name: Prepare source validation environment
119121
run: uv sync --extra test

‎.github/workflows/python-tests.yml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ jobs:
177177
python-version: "3.11"
178178
- name: Install checkout for Python-backed browser scenarios
179179
run: |
180-
python -m pip install --disable-pip-version-check -e .
180+
python -m pip install --disable-pip-version-check -e '.[test]'
181181
echo "LOOPX_TEST_PYTHON=$(python -c 'import sys; print(sys.executable)')" >> "$GITHUB_ENV"
182182
- uses: actions/setup-node@v6
183183
with:
@@ -203,6 +203,7 @@ jobs:
203203
npm run smoke:task-inspector-route
204204
npm run smoke:explore-timeline-scan
205205
npm run smoke:conversation-find
206+
node smoke/todo-confirmation-browser-smoke.mjs
206207
- name: Qualify packaged team evidence and feedback recovery
207208
if: matrix.shard == 2
208209
working-directory: apps/presentation/dashboard

‎apps/presentation/dashboard/public/benchmark-study.example.json‎

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,20 @@
169169
"median": null
170170
}
171171
},
172+
"terminal_effort": {
173+
"duration_ms": {
174+
"measured_run_count": 2,
175+
"observed_sum": 10800000
176+
},
177+
"token_count": {
178+
"measured_run_count": 1,
179+
"observed_sum": 120000
180+
},
181+
"estimated_cost_usd": {
182+
"measured_run_count": 0,
183+
"observed_sum": null
184+
}
185+
},
172186
"failure_class_counts": {
173187
"contract_miss": 1,
174188
"none": 1
@@ -263,6 +277,20 @@
263277
"median": null
264278
}
265279
},
280+
"terminal_effort": {
281+
"duration_ms": {
282+
"measured_run_count": 1,
283+
"observed_sum": 7200000
284+
},
285+
"token_count": {
286+
"measured_run_count": 0,
287+
"observed_sum": null
288+
},
289+
"estimated_cost_usd": {
290+
"measured_run_count": 0,
291+
"observed_sum": null
292+
}
293+
},
266294
"failure_class_counts": {}
267295
},
268296
{
@@ -352,6 +380,20 @@
352380
"median": null
353381
}
354382
},
383+
"terminal_effort": {
384+
"duration_ms": {
385+
"measured_run_count": 2,
386+
"observed_sum": 12000000
387+
},
388+
"token_count": {
389+
"measured_run_count": 0,
390+
"observed_sum": null
391+
},
392+
"estimated_cost_usd": {
393+
"measured_run_count": 0,
394+
"observed_sum": null
395+
}
396+
},
355397
"failure_class_counts": {
356398
"edge_case_miss": 1
357399
}
@@ -445,6 +487,20 @@
445487
"median": null
446488
}
447489
},
490+
"terminal_effort": {
491+
"duration_ms": {
492+
"measured_run_count": 1,
493+
"observed_sum": 7800000
494+
},
495+
"token_count": {
496+
"measured_run_count": 0,
497+
"observed_sum": null
498+
},
499+
"estimated_cost_usd": {
500+
"measured_run_count": 0,
501+
"observed_sum": null
502+
}
503+
},
448504
"failure_class_counts": {}
449505
}
450506
],

‎apps/presentation/dashboard/smoke/benchmark-study-contract-smoke.ts‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ if (packet.contrasts.goal_hint?.binary_metric_transitions.reward?.same !== 2) th
2626
if (packet.cases[1]?.largest_eligible_primary_contrast?.metric_deltas.feature?.delta !== 2) throw new Error("case-level eligible contrast missing");
2727
if (packet.cases[0]?.arms.some((cell) => cell.score_countable && !cell.metrics.preservation)) throw new Error("countable cell guardrail missing");
2828

29+
const overflowFixture = structuredClone(fixture);
30+
overflowFixture.arms[0]!.terminal_effort.token_count = { measured_run_count: 2, observed_sum: null };
31+
const overflowTotal = parseBenchmarkStudyDashboard(overflowFixture).arms[0]?.terminal_effort?.token_count;
32+
if (overflowTotal?.measured_run_count !== 2 || overflowTotal.observed_sum !== null) {
33+
throw new Error("an unrepresentable total must retain its measured coverage");
34+
}
35+
2936
const ratioFixture = structuredClone(fixture);
3037
const ratioMetric = ratioFixture.cases[1]!.largest_eligible_primary_contrast!.metric_deltas.feature;
3138
Object.assign(ratioMetric, { delta: -41, delta_rate: 0.4, direction: "improved" });
@@ -47,6 +54,11 @@ function parseUnexpectedComparison(value: unknown) {
4754
try { parseBenchmarkStudyDashboard(value); return true; } catch { return false; }
4855
}
4956

57+
const mismatchedRole = structuredClone(fixture);
58+
const mismatchedRun = mismatchedRole.runs[0]!;
59+
mismatchedRun.arm_role = mismatchedRun.arm_role === "baseline" ? "treatment" : "baseline";
60+
if (parseUnexpectedComparison(mismatchedRole)) throw new Error("run role conflicts with its declared arm");
61+
5062
const resolved = resolveBenchmarkStudyDashboardUrl("/study.json", "http://127.0.0.1:5173/benchmarks/study");
5163
if (resolved !== "http://127.0.0.1:5173/study.json") throw new Error("local readback URL drifted");
5264
const packaged = resolveBenchmarkStudyDashboardUrl("/chat/benchmark-study.example.json", "http://127.0.0.1:5173/chat/benchmarks/study");

‎apps/presentation/dashboard/smoke/goal-created-session-smoke.ts‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import assert from "node:assert/strict";
22
import {goalCreatedManagedSession} from "../src/features/personal-workspace/goal-created-session";
33
import {preparedAcceptancePlan} from "../src/data/goal-acceptance-actions";
44
import {conversationChannelId, conversationContextKey, createChatSession, fetchChatHistory,
5-
readManagedTaskValidation, type ManagedTaskTurn, type TypedActionProposal} from "../src/data/chat";
5+
readManagedTaskOutcome, type ManagedTaskTurn, type TypedActionProposal} from "../src/data/chat";
66

77
const resources = {goal_id: "research", goal_instance_id: null, agent_id: "codex",
88
managed_agent_id: "codex", channel_id: "agent.codex", session_id: "original-session"};
@@ -89,21 +89,21 @@ const postcondition = {schema_version: "loopx_turn_execution_v0", dry_run: false
8989
validation_stage: "task_postcondition", receipt: {ok: true, lineage}};
9090
const passingCheck = {schema_version: "loopx_turn_task_validation_v0", ok: true, status: "passed", summary: "Checks passed"};
9191
const checkedTurn = {...turn, response: {native_loopx: {...postcondition, validation: passingCheck}}};
92-
assert.equal(readManagedTaskValidation(checkedTurn)?.status, "passed");
93-
assert.equal(readManagedTaskValidation({...turn, response: {native_loopx: {...postcondition,
94-
validation: {...passingCheck, ok: false, status: "failed", summary: "One required check failed"}}}})?.status, "failed",
92+
assert.equal(readManagedTaskOutcome(checkedTurn)?.validation.status, "passed");
93+
assert.equal(readManagedTaskOutcome({...turn, response: {native_loopx: {...postcondition,
94+
validation: {...passingCheck, ok: false, status: "failed", summary: "One required check failed"}}}})?.validation.status, "failed",
9595
"A terminal conversation receipt can carry a failed independent check");
9696
for (const native_loopx of [
9797
{...postcondition, dry_run: true, validation: passingCheck},
9898
{...postcondition, validation_stage: "host_result_contract", validation: passingCheck},
9999
{...postcondition, validation: {...passingCheck, ok: false}},
100100
{...postcondition, receipt: {ok: true, lineage: {...lineage, todo_id: "another-task"}}, validation: passingCheck},
101101
]) {
102-
assert.equal(readManagedTaskValidation({...turn, response: {native_loopx}}), undefined,
102+
assert.equal(readManagedTaskOutcome({...turn, response: {native_loopx}}), undefined,
103103
"Simulation, unrelated lineage and inconsistent receipts cannot certify the selected Task");
104104
}
105-
assert.equal(readManagedTaskValidation(turn), undefined, "Legacy responses cannot attest a check");
106-
assert.equal(readManagedTaskValidation({...checkedTurn, status: "running"}), undefined);
105+
assert.equal(readManagedTaskOutcome(turn), undefined, "Legacy responses cannot attest a check");
106+
assert.equal(readManagedTaskOutcome({...checkedTurn, status: "running"}), undefined);
107107
const preparedCheck = (scope: Record<string, unknown>): TypedActionProposal => ({
108108
...proposal, action_kind: "goal.acceptance.check", status: "preview_ready",
109109
context: {kind: "goal", goal_id: target.goalId},

‎apps/presentation/dashboard/smoke/managed-task-entry-browser-smoke.mjs‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,31 @@ try {
8181
assert.equal(p.reads.length, 1, "An unconfigured default Goal has one initial native read and no empty background queries");
8282
assert.deepEqual(p.writes, []); await p.finish();
8383
}
84+
{
85+
const completedTurn = native("completed-original", "completed");
86+
completedTurn.loopx_request.actor.goal_instance_id = session.goal_instance_id;
87+
const receipt = {schema_version: "loopx_turn_execution_v0", dry_run: false, status: "committed",
88+
validation_stage: "task_postcondition", quota_slot_spend_count: 1,
89+
receipt: {ok: true, lineage: {goal_id: session.goal_id, agent_id: session.managed_agent_id, todo_id: ready.todo_id}},
90+
validation: {schema_version: "loopx_turn_task_validation_v0", status: "passed", ok: true, summary: "Checks passed"}};
91+
completedTurn.response = {native_loopx: receipt};
92+
const p = await probe({task: {...ready, canonical_done: true, completion_turn: completedTurn}});
93+
const check = p.section.getByText("Latest independent check passed", {exact: false});
94+
await check.waitFor();
95+
assert.match(await check.textContent(), /1 quota slot used for this completion/);
96+
await p.page.reload();
97+
await check.waitFor();
98+
assert.match(await check.textContent(), /1 quota slot used for this completion/);
99+
for (const changed of [{quota_slot_spend_count: undefined}, {quota_slot_spend_count: "1"}, {status: "stopped"}]) {
100+
completedTurn.response.native_loopx = {...receipt, ...changed};
101+
await p.page.reload();
102+
await check.waitFor();
103+
assert.doesNotMatch(await check.textContent(), /quota slot/,
104+
"An unavailable debit preserves the independent check without inventing an amount");
105+
}
106+
assert.deepEqual(p.writes, []);
107+
await p.finish();
108+
}
84109
{
85110
const p = await probe(); await p.button.waitFor();
86111
assert.equal(await p.button.isDisabled(), false, "A ready definition permits repair despite a failed baseline");

‎apps/presentation/dashboard/smoke/steward-monitor-fixture.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def main() -> None:
2828
from test_native_steward_private import steward
2929
from test_native_steward_managed_mode import original, storage
3030
from loopx.chat_server import ChatHTTPServer, ChatRequestHandler
31-
from loopx.chat_loopx_mode import DelegationWakeService
31+
from loopx.chat.loopx_mode import DelegationWakeService
3232
from loopx.extensions.lark.cli_resolution import LarkCliResolution
3333
from loopx.presentation.codex_accounts_api import CodexAccountService
3434

0 commit comments

Comments
 (0)