Merge pull request #2715 from pikasTech/feat/hwlab-native-aggregate-status
Pipelines as Code CI / hwlab-web-probe-sentinel-nc01- Success
Pipelines as Code CI / platform-infra-gitea-nc01- Failed
Pipelines as Code CI / unidesk-host- Success

feat: 聚合查询 Workbench L1 状态
This commit is contained in:
Lyon
2026-07-21 08:36:38 +08:00
committed by GitHub
3 changed files with 23 additions and 2 deletions
+3 -1
View File
@@ -76,7 +76,9 @@ description: >-
- 通过项目 lifecycle 启动的 L1 服务在测试和验收后默认保持运行:
- 只有用户明确要求停止或清理时才执行 stop;
- 一次性 disposable smoke 可以按自身隔离合同清理,但不能替代可持续访问的 L1 服务;
- 任务结束前必须重新读取 lifecycle status,不能凭启动返回值推断服务仍在运行
- 任务结束前必须重新读取 lifecycle status,不能凭启动返回值推断服务仍在运行
- 多服务 L1 必须优先使用项目 CLI 的聚合 status,一次返回 API、Worker 和 Web 状态,禁止由调用方逐个查询后人工拼接结论;
- 项目暂缺聚合 status 时,应在当前任务内补齐该 CLI 能力,不能把逐服务查询固化为长期验收流程。
- CLI 显式使用项目 native `--over-api` transport,经 native API 调用 Worker。
- Web 使用 `$unidesk-webdev` 的受控入口访问 owning YAML 固定端口上的 native Web。
- 微服务项目只启动当前微服务的前端、API、Worker及必要依赖。
+19
View File
@@ -14,6 +14,7 @@ export function hwlabNativeDevelopmentHelp(): Record<string, unknown> {
ok: true,
command: "hwlab nodes native-development workbench",
usage: [
"bun scripts/cli.ts hwlab nodes native-development workbench status --node <node> --lane <lane>",
"bun scripts/cli.ts hwlab nodes native-development workbench api|worker|web start|stop|restart|status|logs --node <node> --lane <lane>",
"bun scripts/cli.ts hwlab nodes native-development workbench cli <health|session|turn|events ...> --node <node> --lane <lane>",
"bun scripts/cli.ts hwlab nodes native-development hwpod api|worker|web start|stop|restart|status|logs --node <node> --lane <lane>",
@@ -58,6 +59,24 @@ export function runHwlabNativeDevelopmentCommand(args: string[]): Record<string,
...(result.exitCode === 0 ? {} : { error: { code: "hwlab_native_cli_failed", exitCode: result.exitCode, stderr: result.stderr.trim().slice(-2000) } }),
};
}
if (application === "workbench" && serviceRaw === "status") {
const remaining = withoutOptions(args.slice(2), ["--node", "--lane"]);
if (remaining.length > 0) throw new Error(`native-development workbench status does not accept positional arguments: ${remaining.join(" ")}`);
const command = ["bun", "tools/hwlab-cli/bin/hwlab-cli.ts", "workbench", "service", "status"];
const result = runCommand(command, spec.workspace, { timeoutMs: 15_000, env: { ...process.env, ...env } });
const payload = parsePayload(result.stdout);
return {
ok: result.exitCode === 0 && payload.ok !== false,
command: "hwlab nodes native-development workbench status",
node,
lane,
action: "status",
configSource: `${hwlabRuntimeLaneConfigPath()}#lanes.${lane}.targets.${node}.nativeDevelopment.workbench`,
userEndpoint: { url: `${native.publicExposure.publicBaseUrl}/workbench` },
serviceResult: payload,
...(result.exitCode === 0 ? {} : { error: { code: "hwlab_native_cli_failed", exitCode: result.exitCode, stderr: result.stderr.trim().slice(-2000) } }),
};
}
const service = parseService(serviceRaw, application);
const action = parseAction(actionRaw);
const command = ["bun", "tools/hwlab-cli/bin/hwlab-cli.ts", application, "service", service, action];
+1 -1
View File
@@ -49,7 +49,7 @@ export function hwlabNodeHelp(scope: "legacy-cicd" | "platform-maintenance" | nu
"bun scripts/cli.ts hwlab nodes hwpod-preinstall plan --node <node> --lane <lane> --dry-run",
"bun scripts/cli.ts hwlab nodes hwpod-node plan --node G14-WSL --lane v03",
"bun scripts/cli.ts hwlab nodes fake-model-provider plan --node D518 --lane v03 --provider fake-echo",
"bun scripts/cli.ts hwlab nodes native-development workbench web status --node <node> --lane <lane>",
"bun scripts/cli.ts hwlab nodes native-development workbench status --node <node> --lane <lane>",
"bun scripts/cli.ts hwlab nodes native-development caserun api status --node <node> --lane <lane>",
"bun scripts/cli.ts hwlab nodes secret status --node <node> --lane <lane> --name <secret>",
"bun scripts/cli.ts hwlab nodes test-accounts status --node <node> --lane <lane>",