Merge remote-tracking branch 'origin/main' into capy/agent-ready-errors

This commit is contained in:
garrytan committed 2026-10-16 22:00:50 +00:00
commit e6924276e2
145 files changed
+8254 -714

No files matched your search

+1 -1
View File
@@ -16,7 +16,7 @@
"scripts/lib/published-text.ts": {"blob":"3f2e4d616b5dd0204035710c66b64d49055c5714","since":4},
"scripts/lib/shard-engine.ts": {"blob":"3cd0b1aaa84018b00bf9ea0ce48093f3c8492f66","since":4},
"scripts/test-paid-shards.ts": {"blob":"8ddee5f11ed7856876135520dd8025ab989e2db9","since":4},
"scripts/test-pr-profile.ts": {"blob":"d95cffbf216a49d412824e2f518efc34cae015b4","since":4,"nonBehavioral":"PR-lane selection only: free-only files (the vendored Capy skill) skip the paid prompt-coverage rule; no case's verdict or inputs change"},
"scripts/test-pr-profile.ts": {"blob":"ddc1e5991636c8c94722cd32472edce26489b26d","since":4,"nonBehavioral":"adds the free-only windows-pregate-e2e.yml workflow to FREE_ONLY_PR_FILES; no paid case reads it, so no verdict can change"},
"scripts/test-strict-output.ts": {"blob":"01185d20dc9761b04b9b2f751ec98664fe0eaf93","since":4},
"test/helpers/agent-sdk-runner.ts": {"blob":"210bba92d241a90df578b2c7fc943ac5755d0025","since":4},
"test/helpers/auq-substance-panel.ts": {"blob":"4881260ef793668e4963a062db6d06a5e1f7a40f","since":4},
+34 -37
View File
@@ -439,16 +439,15 @@ Other preflight failures retain their printed diagnosis, including harness misma
These failures do not block the review; they use the bounded fallback below.
Enter only when **Outcome routing** selects fallback; do not restart the outside
invocation after its failure. A native result never counts as outside coverage.
invocation after its failure.
Immediately before dispatch, recheck whether reviews are enabled. If the mode is
\`CODEX_MODE: disabled\`, return to **Record the disabled outcome** without
dispatching. Otherwise continue with the same prepared prompt.
` : ctx.skillName === 'plan-eng-review' ? `**Native fallback — provider unavailable or execution failed, with reviews enabled:**
Use this fallback only after the routing row says to use it. Immediately before
dispatch, check the preflight result again: disabled means no replacement;
Immediately before dispatch, check the preflight result again: disabled means no replacement;
record disabled coverage and do not dispatch. If still enabled, run the bounded
native attempt below. A native result never supplies outside coverage.` : `**Error handling:** All errors are non-blocking — the outside voice is informational.
native attempt below.` : `**Error handling:** All errors are non-blocking — the outside voice is informational.
${outsideVoiceFailurePolicy(ctx, { timeoutMinutes: 5, onTimeout: 'fallback', stderrOnEmpty: false, fallback: 'native', escape: 1 })}
**Native fallback — provider unavailable or execution failed, with reviews enabled:**
@@ -464,50 +463,48 @@ A native result never supplies outside coverage.`}`}`;
}
function codexPlanBoundedWait(ctx: TemplateContext, ceo: boolean, needsApprovalReadiness: boolean): string {
return `**Bounded outside-voice wait — one five-minute wait plus dispatch/cancellation overhead:**
return `**Bounded outside-voice wait — one five-minute host timer:**
${['plan-ceo-review', 'plan-eng-review'].includes(ctx.skillName) ? `Before dispatch, verify TaskOutput and TaskStop in this session's tool definitions,
and Plan in Agent's declared subagent types. Do not launch a task to test availability.
If any capability is missing or undeclared, take the unavailable path below.` : `Before dispatch, verify the host offers the built-in Plan agent type, TaskOutput and
TaskStop. If any is unavailable, take the unavailable path below without launching.`}
Before dispatch, check this session's tools for TaskStop, Bash's \`run_in_background\`
and Plan among Agent's subagent types. Do not launch a task to test availability;
if any is missing, take the unavailable path without launching.
Use Plan, which denies native Edit, Write and NotebookEdit tools. Do not set a model
override; keep the inherited model. This is not a filesystem sandbox: the review-only
prompt also forbids mutations through other tools. The subagent has fresh context
but is the same harness; model identity stays unknown unless the runtime reports it.
A native result never supplies outside coverage.
prompt also forbids mutations through other tools. A native result never supplies
outside coverage. This is the one exception to foreground dispatch here.
Execute the four steps once:
This is the single bounded-wait exception to foreground dispatch for this outside
voice. Execute the four steps once:
1. Dispatch via the Agent tool with \`subagent_type: "Plan"\` and
\`run_in_background: true\`. Subagent prompt: same plan review prompt as above.
Keep the returned \`agentId\`; do not guess an ID or launch a second task.
If dispatch fails without an ID, take the unavailable path without guessing one.
2. Immediately call TaskOutput with that exact ID as \`task_id\`, \`block: true\`,
and \`timeout: 300000\`. Make one wait only; do not poll or renew the budget.
3. Check TaskOutput's outer fields: \`<retrieval_status>\` must be \`success\`,
\`<task_id>\` must match, \`<task_type>\` must be \`local_agent\`, \`<status>\`
must be \`completed\`, \`<output>\` must be nonempty, and there must be no outer
\`<error>\`. Accept findings only if that output is an identifiable complete
1. Start the timer: Bash \`command: "sleep 300"\`, \`run_in_background: true\`,
\`timeout: 300000\`. Dispatch via the Agent tool with \`subagent_type: "Plan"\`
and \`run_in_background: true\` where offered, with the same plan review prompt.
Keep the returned agent ID; do not guess an ID or launch a second task.
2. End your turn and wait for task notifications. Make one wait only: do not poll,
sleep, Read either output file or renew the timer.
3. Only the agent's \`<task-notification>\` arriving before the timer's counts:
\`<task-id>\` must match the agent ID, \`<status>\` must be \`completed\`, \`<summary>\`
must say it finished ("is waiting on its own background work": keep waiting; a
turn limit: partial) and \`<result>\` must be nonempty; a "[Subagent hand-back]"
header only frames it. Accept findings only if it is an identifiable complete
final reviewer report. Reject raw or in-progress transcripts; do not extract
finding fragments from them. Terminal status or warning markers alone do not
establish report completeness. If any check fails or the report cannot be identified, follow step 4. Otherwise present it under an \`OUTSIDE VOICE (${outsideVoiceFor(ctx).nativeLabel} subagent):\`
establish report completeness. If any check fails or the report cannot be identified, follow step 4. Otherwise call TaskStop with the timer's ID, present it under an \`OUTSIDE VOICE (${outsideVoiceFor(ctx).nativeLabel} subagent):\`
header, then continue to ${ceo ? '**Integrate reviewer findings**' : 'Cross-model tension'}.
4. On any noncompletion (timeout, error, missing/mismatched result, failed/killed
status, raw transcript or empty report), call TaskStop with the same ID as
\`task_id\`. TaskOutput timeout does not stop the agent. Record the stop result;
if cancellation fails, say cancellation is unconfirmed. If TaskStop reports the
task already completed after the timeout, still give no late-result credit.
4. Otherwise (timer first, no ID, failed or stopped status, partial or empty result,
or Agent returns a report directly: no enforced deadline, so no credit), call
TaskStop with the same ID as the agent, and call TaskStop with the timer's ID if it runs.
Record each stop result; if one fails, cancellation is unconfirmed.
For a completion after the timer or TaskStop, still give no late-result credit.
**Unavailable path:** "Outside voice unavailable. Continuing to ${needsApprovalReadiness ? 'planning decisions and Approval readiness' : 'outputs'}."
**Unavailable path:** "Outside voice unavailable: <cause>. Fix: <fix>. Continuing to ${needsApprovalReadiness ? 'planning decisions and Approval readiness' : 'outputs'}. (OUTSIDE_VOICE_UNAVAILABLE)"
The cause adds to the provider's diagnosis: Plan agent type not offered, TaskStop not offered,
background tasks unavailable${ctx.host === 'claude' ? ' (fix: Claude Code 2.1.277+, background tasks on)' : ''}, no complete report within five minutes, or a failed status.
Do not retry with a general-purpose agent. Report missing outside-voice coverage.
Ignore partial or late results for critique, agreement, clean status or coverage.
${ceo ? 'Skip Integrate reviewer findings and Cross-model tension.' : 'Skip Cross-model tension.'} Persist an unavailable result using the command below
with STATUS = "unavailable", SOURCE = "none", OUTSIDE_STATUS = "unavailable";
then continue directly to ${needsApprovalReadiness ? 'the remaining planning decisions and Approval readiness' : 'outputs'}. The storage policy still applies.
Do not record a clean review when no reviewer completed within the accepted wait.
${ceo ? '' : '(On `CODEX_MODE: disabled` you already skipped this section per the preflight — do not reach here.)'}`;
with STATUS = "unavailable", SOURCE = "none", OUTSIDE_STATUS = "unavailable", adding \`"unavailable_reason":"<cause>"\`;
then continue directly to ${needsApprovalReadiness ? 'the remaining planning decisions and Approval readiness' : 'outputs'}.
Do not record a clean review when no reviewer completed.
`;
}
function codexPlanCrossModelTension(ctx: TemplateContext): string {
+1 -1
View File
@@ -185,7 +185,7 @@ pass/fail/blocked/not run/inconclusive/not applicable (reason).
| Contract | Observe |
|---|---|
| Successful execution | Expected return/output and final business effect, not just launch/acceptance |
| Invalid/missing input | Declared rejection, correct status and no forbidden state change |
| Invalid/missing input | One probe per documented input rule (allowed characters, format, sign, range, arity): declared rejection, correct status and no forbidden state change |
| Authentication/authorization | Valid identity, missing/invalid identity, wrong owner/role and durable no-effect boundary |
| CLI process contract | Exact exit code, stdout and stderr separately; resulting file/state changes |
| State transitions | Initial, intermediate and completed/failed states and their permitted transitions |
+1
View File
@@ -247,6 +247,7 @@ export const FREE_ONLY_PR_FILES = [
'scripts/ship-measure-sweep.ts', // The weekly sweep CLI; it launches paid cases, never runs inside one.
'.github/workflows/version-gate.yml',
'.github/workflows/windows-free-tests.yml',
'.github/workflows/windows-pregate-e2e.yml',
'.github/workflows/windows-setup-e2e.yml',
] as const;