/review on Codex with OpenAI models no longer blocks a review that ran its adversarial pass (GST-3375) (#4622)

/review on Codex no longer blocks or logs a miss for sessions that
really ran the adversarial review, when the model is an OpenAI one.

Why: Codex encrypts the message it sends a new subagent for OpenAI
models, so the check never saw the review brief's text; it now accepts a
started subagent named `adversarial` whose message is encrypted.

Nothing to do: Claude Code's check is unchanged, and a plaintext,
missing, failed or differently named subagent still counts as missing.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
Garry Tanandcapy-ai[bot] authored and GitHub committed 2026-11-21 16:54:58 +00:00
1 parent bd77c8ccaa
commit de9a7b4adc
13 files changed
+196 -44

No files matched your search

+13 -7
View File
@@ -17,7 +17,7 @@ const code = (s: string) => '\u0060' + s + '\u0060';
export type ContractItem =
| { id: string; kind: 'report_labels'; heading: string; labels: string[] }
| { id: string; kind: 'selected_specialists_dispatched'; marker: string }
| { id: string; kind: 'agent_dispatch'; match: string };
| { id: string; kind: 'agent_dispatch'; match: string; task_name?: string };
export interface SkillContract {
version: 1;
@@ -29,6 +29,7 @@ const KIND_FIELDS: Record<ContractItem['kind'], string[]> = {
selected_specialists_dispatched: ['marker'],
agent_dispatch: ['match'],
};
const OPTIONAL_FIELDS: Partial<Record<ContractItem['kind'], string[]>> = { agent_dispatch: ['task_name'] };
// The resolver and section that render the step each kind checks today. A host that suppresses the resolver, or a loadout that excludes the section, never shows that step, so its items are left out of the list there.
export const BACKED_BY: Partial<Record<ContractItem['kind'], { resolver: string; section: string }>> = {
@@ -67,11 +68,14 @@ export function parseSkillContract(value: unknown, where: string): SkillContract
if (seen.has(raw.id)) fail(where, at + ' duplicate id "' + raw.id + '"');
seen.add(raw.id);
for (const key of Object.keys(raw)) {
if (key !== 'id' && key !== 'kind' && !KIND_FIELDS[kind].includes(key)) fail(where, at + ' (' + kind + ') has unknown key "' + key + '"');
if (key !== 'id' && key !== 'kind' && !KIND_FIELDS[kind].includes(key) && !OPTIONAL_FIELDS[kind]?.includes(key)) fail(where, at + ' (' + kind + ') has unknown key "' + key + '"');
}
for (const field of KIND_FIELDS[kind]) {
if (field !== 'labels' && !isText(raw[field])) fail(where, at + ' ' + field + ' must be a non-empty string');
}
if (raw.task_name !== undefined && (typeof raw.task_name !== 'string' || !/^[a-z0-9][a-z0-9_-]{0,63}$/.test(raw.task_name))) {
fail(where, at + ' task_name must be lowercase letters, digits, _ or -, got ' + JSON.stringify(raw.task_name));
}
if (kind === 'report_labels') {
if (!Array.isArray(raw.labels) || raw.labels.length === 0) fail(where, at + ' labels must be a non-empty list');
for (const label of raw.labels as unknown[]) {
@@ -102,11 +106,13 @@ export function contractFromTemplate(tmplContent: string, where: string, opts: {
const list = (xs: string[]) => xs.length < 2 ? xs.join('') : xs.slice(0, -1).join(', ') + ' and ' + xs[xs.length - 1];
function plainWords(item: ContractItem): string {
function plainWords(item: ContractItem, host: string): string {
switch (item.kind) {
case 'report_labels': return 'a ' + code(item.heading) + ' with ' + list(item.labels) + ' filled in (' + code('none: <why>') + ' where the skill\'s own stop rule leaves one empty)';
case 'selected_specialists_dispatched': return 'the specialist selection printed (' + code(item.marker) + ' ...), then one Agent dispatch per specialist it names (none when a small diff skips them)';
case 'agent_dispatch': return 'an Agent dispatch for the ' + item.id.replace(/-/g, ' ') + ', its prompt including "' + item.match + '"';
case 'agent_dispatch': return host === 'codex' && item.task_name
? 'a ' + code('spawn_agent') + ' (' + code('task_name: ' + item.task_name) + '), its prompt including "' + item.match + '"'
: 'an Agent dispatch for the ' + item.id.replace(/-/g, ' ') + ', its prompt including "' + item.match + '"';
}
}
@@ -114,14 +120,14 @@ function plainWords(item: ContractItem): string {
export const CONTRACT_CHECKER_SHIPPED = true;
/** The list; checker adds the check and waive commands (run through the host's binDir), which only a tree that ships the checker may mention. */
export function renderDoneMeans(contract: SkillContract, binDir: string, checker = CONTRACT_CHECKER_SHIPPED): string {
export function renderDoneMeans(contract: SkillContract, binDir: string, checker = CONTRACT_CHECKER_SHIPPED, host = 'claude'): string {
if (contract.items.length === 0) return '';
return [
'## Done means',
'',
'Finish only when each of these exists (contract v1):',
'',
...contract.items.map(item => '- ' + code(item.id) + ': ' + plainWords(item) + '.'),
...contract.items.map(item => '- ' + code(item.id) + ': ' + plainWords(item, host) + '.'),
...(checker ? ['', code(binDir + '/gstack-skill-contract check') + ' reads them from the transcript (docs/skill-routing-and-contracts.md). ' +
'For an item that truly does not apply, run ' + code(binDir + '/gstack-skill-contract waive <item> --reason "<why>"') + ' (this session only; it counts as a miss).'] : []),
].join('\n');
@@ -135,5 +141,5 @@ export function generateContractDoneMeans(ctx: TemplateContext): string {
const backing = BACKED_BY[item.kind];
return !backing || (!suppressed.has(backing.resolver) && !ctx.modules?.excluded.has('section:' + ctx.skillName + '/' + backing.section));
};
return renderDoneMeans({ ...contract, items: contract.items.filter(shown) }, ctx.paths.binDir);
return renderDoneMeans({ ...contract, items: contract.items.filter(shown) }, ctx.paths.binDir, CONTRACT_CHECKER_SHIPPED, ctx.host);
}