Defaults name current models, and review stops reading "the HIGH branch" as a HIGH finding (GST-3462) (#4678)

Three defaults gstack picks now name current models, and a reviewer's
mention of a code name like "the HIGH branch" no longer becomes a HIGH
finding.

Why: our rule is no older-generation model in a role we choose, and the
review parser forced a ruling on two notes that only quoted code.

Nothing to do: no settings change; overrides work as before.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Review-Finding: p1/adversarial-native#1 reader=adversarial-native
Review-Finding: p1/outside-voice#1 reader=outside-voice
Review-Finding: p1/adversarial-native#5 reader=adversarial-native
Review-Finding: p1/red-team#1 reader=red-team
Review-Finding: p1/adversarial-native#6 reader=adversarial-native
Review-Finding: p1/outside-voice#3 reader=outside-voice
This commit is contained in:
Garry Tanandcapy-ai[bot] authored and GitHub committed 2026-11-22 10:41:12 +00:00
1 parent 24b15c6823
commit 8ffd2b85f1
9 files changed
+131 -19

No files matched your search

+2 -2
View File
@@ -591,7 +591,7 @@ describe("token estimate calibration", () => {
expect(text).toContain("Bytes are always exact");
const exactText = tokenDisclaimer({
tokenEstimateErrorPct: 0,
tokenSource: "count_tokens (claude-opus-4-5)",
tokenSource: "count_tokens (claude-opus-5-5)",
});
expect(exactText).toContain("measured with count_tokens");
expect(exactText).not.toContain("ESTIMATES");
@@ -1397,7 +1397,7 @@ describe("--exact (opt-in measurement; offline here via an injected fetch)", ()
});
fs.rmSync(tmp, { recursive: true, force: true });
expect(code).toBe(0);
expect(JSON.parse(stdout.text()).tokenSource).toBe("count_tokens (claude-opus-4-5)");
expect(JSON.parse(stdout.text()).tokenSource).toBe("count_tokens (claude-opus-5-5)");
});
it("refuses a walked file swapped for a FIFO instead of hanging", () => {
+6 -3
View File
@@ -75,6 +75,9 @@ export function parseGeminiStreamJson(raw: string): GeminiStreamParse {
return { output, tokens: { input, output: out }, toolCalls, modelUsed };
}
/** The model a run is labelled and priced as when the Gemini CLI reports none (its own default is not passed to us). */
export const GEMINI_UNREPORTED_MODEL = 'gemini-4-argon';
/**
* Map a raw stream-json dump to a RunResult, including the empty-success
* hardening from #2159. Exported so adapter e2e can exercise the full
@@ -85,7 +88,7 @@ export function resultFromGeminiStream(
opts: { model?: string; durationMs?: number } = {},
): RunResult {
const parsed = parseGeminiStreamJson(raw);
const modelUsed = parsed.modelUsed || opts.model || 'gemini-2.5-pro';
const modelUsed = parsed.modelUsed || opts.model || GEMINI_UNREPORTED_MODEL;
const durationMs = opts.durationMs ?? 0;
if (!parsed.output.trim()) {
return {
@@ -180,7 +183,7 @@ export class GeminiAdapter implements ProviderAdapter {
}
estimateCost(tokens: { input: number; output: number; cached?: number }, model?: string): number {
return estimateCostUsd(tokens, model ?? 'gemini-2.5-pro');
return estimateCostUsd(tokens, model ?? GEMINI_UNREPORTED_MODEL);
}
private emptyResult(durationMs: number, error: RunResult['error'], model?: string): RunResult {
@@ -189,7 +192,7 @@ export class GeminiAdapter implements ProviderAdapter {
tokens: { input: 0, output: 0 },
durationMs,
toolCalls: 0,
modelUsed: model ?? 'gemini-2.5-pro',
modelUsed: model ?? GEMINI_UNREPORTED_MODEL,
error,
};
}
+33
View File
@@ -0,0 +1,33 @@
/**
* R116 (Garry, 2026-11-21): no gpt-4o or older-generation model in a role gstack chooses. These are the defaults the
* eval-plan check cannot see because no preregistration names them: the design prototype's orchestrator, the Gemini
* adapter's label for a run whose CLI reports no model, and context-bill's --exact model. A model counts as current when
* lib/pricing.ts prices it and names no replacement (currentReplacement).
*/
import { describe, expect, test } from 'bun:test';
import * as fs from 'node:fs';
import * as path from 'node:path';
import { EXACT_DEFAULT_MODEL } from '../lib/context-bill';
import { currentReplacement, hasPricing } from '../lib/pricing';
import { resultFromGeminiStream } from './helpers/providers/gemini';
const ROOT = path.resolve(import.meta.dir, '..');
const current = (model: string) => [model, hasPricing(model), currentReplacement(model)];
describe('defaults gstack chooses are the current generation (R116)', () => {
test('the design prototype builds its request with design/src/models.ts, never a literal such as gpt-4o', () => {
const src = fs.readFileSync(path.join(ROOT, 'design', 'prototype.ts'), 'utf8');
expect(src).toContain('imageRequestBody(brief.prompt');
expect(src).not.toMatch(/gpt-4o|model:/);
});
test('a Gemini run whose CLI reports no model is labelled and priced as a current model', () => {
const label = resultFromGeminiStream('{"type":"message","role":"assistant","content":"PONG"}').modelUsed!;
expect(current(label)).toEqual([label, true, null]);
expect(resultFromGeminiStream('{"type":"init","model":"gemini-3.8-flash"}\n{"type":"message","role":"assistant","content":"PONG"}').modelUsed).toBe('gemini-3.8-flash');
});
test('context-bill --exact counts with a current model', () => {
expect(current(EXACT_DEFAULT_MODEL)).toEqual([EXACT_DEFAULT_MODEL, true, null]);
});
});
+62
View File
@@ -0,0 +1,62 @@
/**
* A severity word that a reader uses as the name of something in the code under review is no severity (GSTA-711). On a /ship
* review of #4612 the native adversarial reader wrote "In the redact-doc HIGH and scanner-failure branches" and "runs after the HIGH
* branch" about redact-doc's HIGH exit path, and both lines collected as HIGH findings the lead could not lower, beside the reply's real
* findings, which each state Severity: Medium or Low. Such a line now collects at INFORMATIONAL; a severity word that rates a finding
* still collects as written.
*/
import { describe, expect, test } from 'bun:test';
import { parseFindings } from '../lib/review-ledger';
const CAPTURED_4612_NATIVE = [
'REVIEWED_TREE: e92bbfcdb1cd8727b991a3800c2e21f094f50d4c /workspace/gstack',
'REVIEW_VERDICT: blocking=0',
'',
'I found nothing that blocks the merge.',
'',
'**What I reviewed and checked**',
'- Every unforced `rm` on a required file follows a guard that proves the file exists:',
' - In the redact-doc HIGH and scanner-failure branches, `[ -s "$REDACT_FILE" ]` runs before the scan, so exit codes 3 and 1 are kept.',
' - The brief, feedback and prompt files are all checked with `-s` first.',
'',
'**Findings**',
'',
'1. `gstack-upgrade/SKILL.md.tmpl:280`: the vendored-sync removal now hides every failure. FIXABLE. Severity: Medium. Blocks: no.',
'',
'3. Unforced `rm` on files that may already be gone now prints errors. Three cases:',
' - The redact-doc cleanup at `scripts/resolvers/redact-doc.ts:112` runs after the HIGH branch has already removed `REDACT_FILE`.',
'',
' No data or exit gate depends on these lines. FIXABLE: add `2>/dev/null || true`. Severity: Low. Blocks: no.',
].join('\n');
const label = (line: string) => parseFindings('red-team', line).map(f => f.label);
describe('a severity word naming code is no severity (GSTA-711)', () => {
test('the captured #4612 reply: the two lines quoting the HIGH branch collect at INFORMATIONAL, the real findings at their fields', () => {
expect(parseFindings('adversarial-native', CAPTURED_4612_NATIVE).map(f => [f.label, f.raw.slice(0, 30)])).toEqual([
['INFORMATIONAL', '- In the redact-doc HIGH and s'],
['Medium', '1. `gstack-upgrade/SKILL.md.tm'],
['INFORMATIONAL', '- The redact-doc cleanup at `s'],
['Low', 'No data or exit gate depends o'],
]);
});
test('negative controls: CRITICAL, and a severity word that rates a finding, leads, stands apart or is spelled as prose, keep their label', () => {
for (const [line, want] of [
['- the HIGH finding above still stands', ['HIGH']],
['- HIGH: the auth check is skipped at auth.ts:9', ['HIGH']],
['- The HIGH branch drops the token check, so this is HIGH.', ['HIGH']],
['- the CRITICAL fix is covered by the new test', ['CRITICAL']],
['- Unauthenticated input reaches the CRITICAL write path.', ['CRITICAL']],
['- the LOW risk path is fine', ['LOW']],
['- the High branch drops the token check', ['High']],
['- the HIGH branch drops the token check. Blocks: yes', ['CRITICAL']],
['- the MEDIUM and LOW tiers both skip the check', ['INFORMATIONAL']],
['- the HIGH and CRITICAL write paths drop the auth check (store.ts:40)', ['CRITICAL']],
['- the HIGH and P0 paths skip validation at store.ts:40', ['P0']],
['- The HIGH and CRITICAL vulnerabilities remain unresolved', ['CRITICAL']],
['- the HIGH vulnerability in auth.ts:9 is still open', ['HIGH']],
['- There is the HIGH chance of a torn write that loses data at store.ts:40', ['HIGH']],
] as const) expect([line, label(line)]).toEqual([line, [...want]]);
});
});