Skip to content

Commit 0270a71

Browse files
authored
fix(qa): keep Telegram release bootstrap configs current (#132710)
1 parent 8e4eb78 commit 0270a71

5 files changed

Lines changed: 37 additions & 4 deletions

File tree

‎extensions/qa-lab/src/gateway-child.test.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,8 @@ if (!recordPath || !configPath || !stateDir) {
178178
const record = (value) => fs.appendFileSync(recordPath, JSON.stringify(value) + "\\n");
179179
const fail = async (code, message) => {
180180
await new Promise((resolve) => process.stderr.write(
181-
message + "\\ncontext retained\\n" + "diagnostic ".repeat(400), resolve));
181+
message + "\\ncontext retained\\n" + "diagnostic ".repeat(400) +
182+
"\\nterminal failure: Authorization: Bearer fixture-tail-secret", resolve));
182183
process.exit(code);
183184
};
184185
const authDbPath = path.join(stateDir, "agents", "qa", "agent", "openclaw-agent.sqlite");
@@ -1734,6 +1735,7 @@ describe("buildQaRuntimeEnv", () => {
17341735
expect(error.message).toContain(`${prefix}${detail}\ncontext retained\n`);
17351736
expect(error.cause.message.length).toBeLessThanOrEqual(prefix.length + 2_048);
17361737
expect(error.cause.message).not.toContain("diagnostic ".repeat(400));
1738+
expect(error.cause.message).toContain("terminal failure: Authorization: Bearer <redacted>");
17371739
expect(error.cause).not.toHaveProperty("cause");
17381740
const records = await readJsonLines(recordPath);
17391741
expect(records.map((record) => record.kind)).toEqual(
@@ -1757,6 +1759,7 @@ describe("buildQaRuntimeEnv", () => {
17571759
expect(diagnostic).not.toContain(submittedKey);
17581760
}
17591761
expect(diagnostic).not.toContain("fixture-plugin-secret");
1762+
expect(diagnostic).not.toContain("fixture-tail-secret");
17601763
const tempRoots = await readdir(tempParentDir);
17611764
expect(tempRoots).toHaveLength(1);
17621765
for (const stream of ["stdout", "stderr"]) {

‎extensions/qa-lab/src/gateway-log-redaction.test.ts‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
import { describe, expect, it } from "vitest";
2-
import { formatQaGatewayLogsForError, redactQaGatewayDebugText } from "./gateway-log-redaction.js";
2+
import {
3+
createQaGatewayCliError,
4+
formatQaGatewayLogsForError,
5+
redactQaGatewayDebugText,
6+
} from "./gateway-log-redaction.js";
37

48
describe("gateway log redaction", () => {
59
it("redacts raw Telegram bot tokens and Bot API URLs", () => {
@@ -93,4 +97,16 @@ describe("gateway log redaction", () => {
9397
expect(formatQaGatewayLogsForError(raw)).not.toMatch(/(^|[\r\n])[^\S\r\n]*::/u);
9498
expect(formatQaGatewayLogsForError(raw)).not.toContain("##[");
9599
});
100+
101+
it.each([995, 996, 997])(
102+
"keeps a CLI truncation boundary inert with %s trailing chars",
103+
(padding) => {
104+
const raw = `${"context ".repeat(512)}::error::untrusted${"x".repeat(padding)}`;
105+
const error = createQaGatewayCliError(raw);
106+
107+
expect(error.message).toContain("untrusted");
108+
expect(error.message.length).toBeLessThanOrEqual(2_048);
109+
expect(error.message).not.toMatch(/(^|[\r\n])[^\S\r\n]*::/u);
110+
},
111+
);
96112
});

‎extensions/qa-lab/src/gateway-log-redaction.ts‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,15 @@ export function formatQaGatewayLogsForError(logs: string) {
145145
export function createQaGatewayCliError(error: unknown): Error {
146146
// Candidate errors can carry credentials in nested causes, spawnargs, or output.
147147
// Retain only a bounded, redacted message, including for lifecycle-held failures.
148-
const message = coerceErrorMessage(error);
149-
return new Error(sliceUtf16Safe(redactQaGatewayDebugText(message), 0, 2_048));
148+
let message = redactQaGatewayDebugText(coerceErrorMessage(error));
149+
const maxChars = 2_048;
150+
if (message.length > maxChars) {
151+
// Doctor can print setup panels before its terminal error. Preserve both
152+
// ends after redaction so the bounded diagnostic retains the failure.
153+
// Keep the tail on this line so slicing cannot create a workflow command.
154+
const marker = "\n… output omitted … ";
155+
const edgeChars = Math.floor((maxChars - marker.length) / 2);
156+
message = `${sliceUtf16Safe(message, 0, edgeChars)}${marker}${sliceUtf16Safe(message, -edgeChars)}`;
157+
}
158+
return new Error(message);
150159
}

‎extensions/qa-lab/src/qa-gateway-config.test.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ describe("buildQaGatewayConfig", () => {
111111
expect(getModelFallbacks(cfg.agents?.defaults?.model)).toEqual([
112112
"mock-openai/gpt-5.6-luna-alt",
113113
]);
114+
expect(cfg.agents?.defaults?.modelPolicy).toEqual({
115+
allow: ["mock-openai/gpt-5.6-luna", "mock-openai/gpt-5.6-luna-alt"],
116+
});
114117
expect(getModelFallbacks(cfg.agents?.entries?.qa?.model)).toEqual([
115118
"mock-openai/gpt-5.6-luna-alt",
116119
]);
@@ -546,6 +549,7 @@ describe("buildQaGatewayConfig", () => {
546549

547550
expect(getPrimaryModel(cfg.agents?.defaults?.model)).toBe("openai/gpt-5.4");
548551
expect(getModelFallbacks(cfg.agents?.defaults?.model)).toBeUndefined();
552+
expect(cfg.agents?.defaults?.modelPolicy).toEqual({ allow: ["openai/gpt-5.4"] });
549553
});
550554

551555
it("can disable control ui for suite-only gateway children", () => {

‎extensions/qa-lab/src/qa-gateway-config.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ export function buildQaGatewayConfig(params: {
252252
[primaryModel]: resolveModelEntry(primaryModel),
253253
[alternateModel]: resolveModelEntry(alternateModel),
254254
},
255+
modelPolicy: { allow: uniqueStrings([primaryModel, alternateModel]) },
255256
subagents: {
256257
allowAgents: ["*"],
257258
maxConcurrent: 2,

0 commit comments

Comments
 (0)