fix: integrate code agent readiness state

This commit is contained in:
HWLAB Code Queue
2026-05-22 15:11:04 +00:00
parent c7de4745f4
commit eb4c85a34f
8 changed files with 739 additions and 102 deletions
@@ -207,6 +207,11 @@ function runStaticSmoke() {
evidence: ["command-send", "agent-chat-status", "/v1/agent/chat", "conversationId/messageId/status/timestamps/error.message"]
});
addCheck(checks, blockers, "code-agent-provider-readiness-visibility", hasCodeAgentReadinessVisibility(files), "Workbench shows provider credential blockers and only real completed replies can become DEV-LIVE.", {
blocker: "observability_blocker",
evidence: ["BLOCKED 凭证缺口", "provider_unavailable", "OPENAI_API_KEY", "hwlab-code-agent-provider/openai-api-key", "completed -> dev-live guard"]
});
addCheck(checks, blockers, "no-hardware-write-api", noForbiddenWriteSurface(source), "Workbench source does not expose hardware write APIs or live mutation commands.", {
blocker: "safety_blocker",
evidence: forbiddenWritePatterns.map(String)
@@ -475,6 +480,29 @@ function hasCodeAgentChatContract({ html, app }) {
);
}
function hasCodeAgentReadinessVisibility({ html, app }) {
const source = `${html}\n${app}`;
return (
/codeAgentAvailability/u.test(app) &&
/codeAgentAvailabilityFrom/u.test(app) &&
/latestCompletedAgentMessage/u.test(app) &&
/BLOCKED 凭证缺口/u.test(app) &&
/provider_unavailable/u.test(app) &&
/OPENAI_API_KEY/u.test(app) &&
/hwlab-code-agent-provider\/openai-api-key/u.test(app) &&
/只有真实 completed 回复才标 DEV-LIVE/u.test(app) &&
/不能因为只有 conversationId 标为开发实况/u.test(app) &&
/Boolean\(message\.provider\)/u.test(app) &&
/Boolean\(message\.model\)/u.test(app) &&
/Boolean\(message\.backend\)/u.test(app) &&
/status === "completed" \? "dev-live"/u.test(app) &&
!/status === "failed" \? "dev-live"/u.test(app) &&
!/tone:\s*state\.conversationId\s*\?\s*"dev-live"/u.test(app) &&
!/provider_unavailable[\s\S]{0,120}tone-[\w-]*dev-live/iu.test(source) &&
!/sk-[A-Za-z0-9._-]{8,}/u.test(source)
);
}
function noForbiddenWriteSurface(source) {
return forbiddenWritePatterns.every((pattern) => !pattern.test(source));
}