fix: keep AgentRun validation hints locally scoped

This commit is contained in:
Codex
2026-07-12 06:29:36 +02:00
parent 26597700df
commit 5c6ca8e9ee
2 changed files with 10 additions and 16 deletions
+1 -1
View File
@@ -313,7 +313,7 @@ describe("AgentRun default transport contract", () => {
expect(rejected.ok).toBe(false);
expect(renderedContentTypeOf(rejected)).toBe(invalid.contentType);
expect(rejectedText).toContain("validation-failed");
expect(rejectedText).toContain("Use --input without --full or --raw");
expect(rejectedText).toContain("cannot be combined with complete resource disclosure");
expect(rejectedText).not.toContain(hiddenCredential);
expect(rejectedText).not.toContain("supervisor");
expect(Buffer.byteLength(rejectedText, "utf8")).toBeLessThan(2400);
+9 -15
View File
@@ -1068,10 +1068,6 @@ export function renderAgentRunRestError(command: string, error: AgentRunRestErro
const nextCommands = Array.isArray(laneHint.nextCommands)
? laneHint.nextCommands.filter((value): value is string => typeof value === "string" && value.length > 0).slice(0, 4)
: [];
const validationDetails = record(payload.agentrun);
const recoveryActions = Array.isArray(validationDetails.recoveryActions)
? validationDetails.recoveryActions.filter((value): value is string => typeof value === "string" && value.length > 0).slice(0, 4)
: [];
const hintLines = Object.keys(laneHint).length === 0
? []
: [
@@ -1084,17 +1080,15 @@ export function renderAgentRunRestError(command: string, error: AgentRunRestErro
const validationHelp = `bun scripts/cli.ts agentrun ${command.split(/\s+/u)[1] ?? "--help"} --help`;
const nextLines = nextCommands.length > 0
? nextCommands
: recoveryActions.length > 0
? recoveryActions
: error.failureKind === "validation-failed"
? [
"Review the AgentRun validation message and correct the request; do not bypass the formal resource API.",
validationHelp,
]
: [
"Check config/agentrun.yaml manager.baseUrl and the AgentRun API route.",
"Verify HWLAB_API_KEY is present in env or in the configured auth.file without printing the key.",
];
: error.failureKind === "validation-failed"
? [
"Review the AgentRun validation message and correct the request; do not bypass the formal resource API.",
validationHelp,
]
: [
"Check config/agentrun.yaml manager.baseUrl and the AgentRun API route.",
"Verify HWLAB_API_KEY is present in env or in the configured auth.file without printing the key.",
];
return renderedCliResult(false, command, [
`Error: ${payload.failureKind}`,
String(payload.message ?? ""),