fix(agent): stabilize post-merge release paths

This commit is contained in:
huanghuoguoguo
2026-08-04 17:04:40 +08:00
parent 5c5ed940a9
commit 444024c5b4
19 changed files with 319 additions and 57 deletions
@@ -81,7 +81,8 @@ async function api(page, path, options = {}) {
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
"X-Workspace-Id": localStorage.getItem("langbot_active_workspace_uuid") || "",
"X-Workspace-Id":
localStorage.getItem("langbot_active_workspace_uuid") || "",
},
body:
options.body === undefined ? undefined : JSON.stringify(options.body),
@@ -205,9 +206,7 @@ try {
result.visible_signals.push("bot-created", "adapter-enabled");
await page.getByRole("button", { name: /Next|下一步|次へ/ }).click();
const localAgentTitle = page
.getByText(/^(Local Agent|本地 Agent)$/)
.first();
const localAgentTitle = page.getByText(/^(Local Agent|本地 Agent)$/).first();
const localAgentCard = localAgentTitle.locator(
'xpath=ancestor::*[@data-slot="card"][1]',
);
@@ -316,6 +315,24 @@ try {
} catch (error) {
if (!["blocked", "env_issue"].includes(result.status)) result.status = "fail";
result.reason = result.reason || error.message;
if (browser?.page && token && botId) {
const [routeStatus, botLogs] = await Promise.all([
api(
browser.page,
`/api/v1/platform/bots/${encodeURIComponent(botId)}/event-routes/status`,
).catch(() => ({ status: 0, json: {} })),
api(
browser.page,
`/api/v1/platform/bots/${encodeURIComponent(botId)}/logs`,
{
method: "POST",
body: { from_index: -1, max_count: 50 },
},
).catch(() => ({ status: 0, json: {} })),
]);
result.runtime.failure_route_status = routeStatus.json.data || null;
result.runtime.failure_bot_logs = botLogs.json.data || null;
}
if (browser?.page) await safeScreenshot(browser.page, paths.screenshot);
} finally {
if (browser?.page && token) {
+6 -2
View File
@@ -1003,8 +1003,12 @@
"rag"
],
"automation": "scripts/e2e/langrag-kb-retrieve.mjs",
"setup_automation": [],
"setup_provides_env": [],
"setup_automation": [
"node:scripts/e2e/ensure-langrag-sentinel-kb.mjs --write-env"
],
"setup_provides_env": [
"LANGBOT_LOCAL_AGENT_RAG_KB_UUID"
],
"evidence_required": [
"ui",
"screenshot",
@@ -25,6 +25,10 @@ automation_env:
automation_env_any:
- LANGBOT_LOCAL_AGENT_RAG_KB_UUID|LANGBOT_RAG_KB_UUID
automation_expected_text: "azalea-cobalt-7421"
setup_automation:
- "node:scripts/e2e/ensure-langrag-sentinel-kb.mjs --write-env"
setup_provides_env:
- LANGBOT_LOCAL_AGENT_RAG_KB_UUID
preconditions:
- "LangRAG is installed and initialized in the active LangBot instance."
- "A working embedding model is available, preferably chroma-all-MiniLM-L6-v2 for local repeatability."
@@ -8,13 +8,20 @@ from pathlib import Path
def has_initial_failure_section(report: str) -> bool:
folded = report.casefold()
return any(
if any(
marker in folded
for marker in (
"initial fail",
"initially fail",
"baseline fail",
)
):
return True
baseline_markers = ("baseline test", "before any edit", "before editing")
failure_markers = ("failing test", "failed test", "failures=", "errors=")
return any(marker in folded for marker in baseline_markers) and any(
marker in folded for marker in failure_markers
)
@@ -26,9 +26,23 @@ class ComplexAgentTaskVerifyTests(unittest.TestCase):
def test_accepts_baseline_failure_heading(self) -> None:
self.assertTrue(MODULE.has_initial_failure_section("## Baseline failing tests\n- test_price"))
def test_accepts_baseline_run_heading_with_failures_in_body(self) -> None:
report = """\
## Baseline test run (before any edits)
The suite reported FAILED (failures=2). Failing tests:
- test_price
- test_inventory
"""
self.assertTrue(MODULE.has_initial_failure_section(report))
def test_rejects_report_without_failure_section(self) -> None:
self.assertFalse(MODULE.has_initial_failure_section("## Verification\nAll tests pass."))
def test_rejects_passing_baseline_without_failure_evidence(self) -> None:
self.assertFalse(MODULE.has_initial_failure_section("## Baseline test run\nAll tests pass."))
if __name__ == "__main__":
unittest.main()