fix: add opencode smoke observability probes

This commit is contained in:
Codex
2026-06-30 10:44:28 +00:00
parent f9d7d68522
commit 2d1f96650e
8 changed files with 389 additions and 8 deletions
+5 -1
View File
@@ -86,8 +86,12 @@ export interface NodeWebProbeScriptOptions {
browserProxyMode: WebProbeBrowserProxyMode;
commandTimeoutSeconds: number;
scriptText: string;
commandLabel?: string;
suppressAdHocWarning?: boolean;
generatedHints?: string[];
generatedPreferredCommands?: Record<string, string>;
scriptSource: {
kind: "stdin" | "file";
kind: "stdin" | "file" | "generated";
path: string | null;
byteCount: number;
sha256: string;
@@ -469,6 +469,7 @@ export function runNodeWebProbeScript(
material: BootstrapAdminPasswordMaterial,
credential: Record<string, unknown>,
): Record<string, unknown> {
const commandLabel = options.commandLabel ?? `web-probe script --node ${options.node} --lane ${options.lane}`;
const webProbeProxy = nodeWebProbeHostProxyEnv(spec, options.browserProxyMode);
const script = nodeWebProbeScriptRemoteShell(options, secretSpec, material.username ?? secretSpec.bootstrapAdminUsername, material.password ?? "", webProbeProxy, spec.webProbe?.playwrightBrowsersPath);
const result = runTransWorkspaceStdinScript(options.node, spec.workspace, script, options.commandTimeoutSeconds);
@@ -545,7 +546,7 @@ export function runNodeWebProbeScript(
return renderWebProbeScriptResult({
ok: passed,
status: passed ? "pass" : "blocked",
command: `web-probe script --node ${options.node} --lane ${options.lane}`,
command: commandLabel,
node: options.node,
lane: options.lane,
workspace: spec.workspace,
@@ -579,6 +580,7 @@ export function runNodeWebProbeScript(
}
function webProbeScriptGovernanceWarnings(options: NodeWebProbeScriptOptions): Record<string, unknown>[] {
if (options.suppressAdHocWarning === true) return [];
return [{
code: "web_probe_script_ad_hoc_only",
severity: "warning",
@@ -590,6 +592,7 @@ function webProbeScriptGovernanceWarnings(options: NodeWebProbeScriptOptions): R
}
function webProbeScriptGovernanceHints(options: NodeWebProbeScriptOptions): string[] {
if (options.generatedHints !== undefined) return options.generatedHints;
return [
"Prefer `web-probe observe start` plus `web-probe observe command` for interactive flows; use `observe collect/analyze` for repeated evidence reads.",
"If the same script is needed more than once, add or extend a reusable command type in the web-probe observe command surface.",
@@ -598,6 +601,7 @@ function webProbeScriptGovernanceHints(options: NodeWebProbeScriptOptions): stri
}
function webProbeScriptPreferredCommands(options: NodeWebProbeScriptOptions): Record<string, string> {
if (options.generatedPreferredCommands !== undefined) return options.generatedPreferredCommands;
return {
startObserver: `bun scripts/cli.ts web-probe observe start --node ${options.node} --lane ${options.lane} --target-path /projects/mdtodo`,
mdtodoSummary: "bun scripts/cli.ts web-probe observe collect <observerId> --view project-mdtodo-summary",
+3 -1
View File
@@ -564,7 +564,9 @@ export function runNodeWebProbe(options: NodeWebProbeOptions): Record<string, un
return {
ok: false,
status: "blocked",
command: options.action === "observe"
command: options.action === "script" && typeof options.commandLabel === "string"
? options.commandLabel
: options.action === "observe"
? `web-probe observe ${options.observeAction} --node ${options.node} --lane ${options.lane}`
: `web-probe ${options.action} --node ${options.node} --lane ${options.lane}`,
node: options.node,
File diff suppressed because one or more lines are too long