mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-29 19:34:29 +01:00
fix: clarify outside review fallback and CEO decisions
Render one applicable own-harness fallback path and retain native review, disabled policy, and missing-coverage semantics. Align report field names and mode labels, and make the existing per-cut scope approval explicit. Regenerate skill outputs and keep the workflow judge's model, thresholds, and retry policy unchanged.
This commit is contained in:
1 parent
5114f8c59f
commit
4ce67de60b
21 files changed
+116
-94
No files matched your search
@@ -84,7 +84,7 @@ test('only an explicit user selection or enabled successful mode check bypasses
|
||||
expect(q).toContain('`ASK_NORMALLY` means ask.');
|
||||
expect(s).toContain('This settles only the mode, not approach or scope approval.');
|
||||
expect(document).toContain('Do NOT proceed to mode selection (0F) without user approval of the chosen approach.');
|
||||
expect(s).toContain('Every mode requires your explicit approval for added scope.');
|
||||
expect(s).toContain('Every mode requires explicit user approval for scope changes.');
|
||||
expect(s).toContain('Keep the approved 0C-bis approach; explain and obtain approval for any mode-required change.');
|
||||
expect(s).toContain('offer all four modes in one AskUserQuestion');
|
||||
expect(s).toContain('context defaults for RECOMMENDATION');
|
||||
|
||||
+1
-4
@@ -2308,15 +2308,12 @@ echo "CODEX_MODE: $_CODEX_MODE"
|
||||
Branch on the echoed `CODEX_MODE`:
|
||||
- **`disabled`** — the user turned Codex reviews off (`codex_reviews=disabled`). Skip the Codex passes only; the factory (in-host) adversarial subagent below STILL runs (it is free and fast). Print: "Codex passes skipped (codex_reviews disabled) — running factory (in-host) adversarial only."
|
||||
- **`not_installed`** — Codex CLI absent. Print: "Codex not installed — falling back to a factory (in-host) subagent (fresh context, but the same harness; model identity is unknown). Install Codex for an actual outside-model read: `npm install -g @openai/codex`." Fall back to the factory (in-host) subagent path.
|
||||
- **`under_codex`** — stale artifact selected its own harness. Print: "Codex outside review unavailable: harness mismatch; no outside process started. Missing coverage. Repair: setup --host codex." Skip the outside invocation; retain the section's native pass if defined. Conflicting inherited harness markers are not grounds to guess another provider.
|
||||
- **`under_codex`** — stale artifact selected its own harness. Print: "Codex outside review unavailable: harness mismatch; no outside process started. Missing coverage. Repair: setup --host codex." Skip the outside invocation and follow the workflow's native-review instructions below. Conflicting inherited harness markers are not grounds to guess another provider.
|
||||
- **`not_authed`** — installed but no credentials. Print: "Codex installed but not authenticated — falling back to a factory (in-host) subagent (same harness; model identity is unknown). Run `codex login` or set `$CODEX_API_KEY`." Fall back to the factory (in-host) subagent path.
|
||||
- **`broken_install`** — the CLI is on PATH but cannot execute (spawn ENOENT, non-executable binary, missing vendor payload). Print: "Codex is installed but its binary cannot run — Codex passes skipped. Reinstall: `npm install -g @openai/codex`." Relay the probe's HINT lines and fall back to the factory (in-host) subagent path. This state exists because a missing binary used to land in the model probe's fail-open bucket and report `ready`, so every Codex pass was skipped silently (#2742).
|
||||
- **`model_unusable`** — authed but the account cannot use gstack's selected Codex model (#2477: HTTP 400 on every call). Relay the probe's HINT lines, tell the user the one-line fix (set `GSTACK_CODEX_MODEL=<supported-model>` or pass an explicit `-c model=...` override), and fall back to the factory (in-host) subagent path. The ~10s round trip is cached for 1h; timeouts fail open to `ready`.
|
||||
- **`ready`** — run the Codex pass below.
|
||||
|
||||
A stale artifact selecting its own harness must report missing coverage and run no outside CLI. Repair: `setup --host codex`. Never infer a replacement provider from inherited environment markers. The invocation below repeats this guard.
|
||||
|
||||
|
||||
For this diff-review path, `CODEX_MODE: disabled` means skip the Codex passes ONLY — the
|
||||
factory (in-host) adversarial subagent below still runs (it's free and fast). `ready` runs the Codex
|
||||
passes; `not_installed` / `not_authed` skip them with the printed note and continue with
|
||||
|
||||
@@ -5,12 +5,41 @@ import * as os from 'node:os';
|
||||
import * as path from 'node:path';
|
||||
import { spawnSync } from 'node:child_process';
|
||||
import { outsideVoiceCommand, outsideVoicePreflight } from '../scripts/resolvers/outside-voice';
|
||||
import { generateCodexDocReview, generateCodexPlanReview } from '../scripts/resolvers/review';
|
||||
import { HOST_PATHS, type TemplateContext } from '../scripts/resolvers/types';
|
||||
import { ALL_HOST_CONFIGS } from '../hosts';
|
||||
|
||||
const ROOT = path.resolve(import.meta.dir, '..');
|
||||
const TEMP = fs.mkdtempSync(path.join(os.tmpdir(), 'gstack-outside-preflight-'));
|
||||
afterAll(() => fs.rmSync(TEMP, { recursive: true, force: true }));
|
||||
|
||||
describe('own-harness review fallback instructions', () => {
|
||||
for (const host of ALL_HOST_CONFIGS) {
|
||||
for (const [name, render] of [['plan', generateCodexPlanReview], ['documentation', generateCodexDocReview]] as const) {
|
||||
test(`${host.name}: ${name} fallback names only the mode its preflight emits`, () => {
|
||||
const ctx: TemplateContext = { host: host.name, skillName: 'review', tmplPath: 'review/SKILL.md.tmpl', paths: HOST_PATHS[host.name] };
|
||||
const text = render(ctx);
|
||||
const mode = host.name === 'codex' ? 'under_current_harness' : 'under_codex';
|
||||
const preflight = text.match(/```bash\n([\s\S]*?)\n```/)![1];
|
||||
expect(preflight).toContain(mode);
|
||||
expect([...new Set(text.match(/under_codex|under_current_harness/g))]).toEqual([mode]);
|
||||
expect(text.includes("retain the section's native pass if defined")).toBe(false);
|
||||
|
||||
const fallback = text.slice(text.indexOf('**Native fallback'), text.indexOf('Dispatch via the Agent tool'));
|
||||
const ownHarnessBranch = `On \`CODEX_MODE: ${mode}\``;
|
||||
expect(text.split(ownHarnessBranch)).toHaveLength(2);
|
||||
expect(fallback).toContain(ownHarnessBranch);
|
||||
expect(fallback).toContain('`outside_status: unavailable`');
|
||||
expect(fallback).toContain('run no outside CLI');
|
||||
expect(fallback).toContain('use the native subagent below');
|
||||
expect(fallback).toContain('A native result never supplies outside coverage.');
|
||||
expect(fallback).toContain('The disabled branch never reaches this fallback.');
|
||||
expect(fallback).toContain('`CODEX_MODE: disabled`, finish this section with `outside_status: disabled`;');
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function fixture() {
|
||||
const dir = fs.mkdtempSync(path.join(TEMP, 'case-'));
|
||||
const repo = path.join(dir, "repo ' $(touch NEVER)");
|
||||
|
||||
Reference in new issue
Block a user