Skip to content

Fix Pi sub-agent smoke workflow model selection and completion - #66805

Merged
pelikhan merged 3 commits into
mainfrom
pelikhan-debug-new-workflow
Oct 8, 2026
Merged

pelikhan merged 3 commits into
mainfrom
pelikhan-debug-new-workflow

Conversation

@pelikhan

@pelikhan pelikhan commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Pin provider-qualified sub-agent model IDs so gpt-5-mini cannot resolve to the newer gpt-5.4-mini alias match; replace the unavailable nano target with advertised gpt-4o-mini.
  • Prevent time-pressure steering from reopening completed answers while retaining steering for ongoing tool turns.
  • Assign workflow-completion and noop reporting to the parent, preserving inherited controls and task-required safe outputs in children.
  • Make the smoke identities explicitly plain text and tool-free; add regressions, Pi documentation, a patch changeset, and the regenerated lock file.

Actions debugging

Revision Run Observed result
Original main 37732970288 Failed before inference: nano alias unavailable; mini alias selected gpt-5.4-mini. Pi 1.0.0 installed successfully on Actions.
Model-selection fix 37733960493 Correct models dispatched, but staged report FAIL despite green Actions. Steering reopened completed child answers, producing unnecessary completion reporting and an aborted compact child.
Final fe36b03733 37735099783 Overall PASS, with all three exact responses and intended models verified from actual child events and inference usage.

Final hosted assertions confirm exactly one sequential dispatch and one successful answer per child: claude-haiku-4.5, gpt-5-mini, and gpt-4o-mini. The only safe output was the staged PASS issue report; there were no noop or incomplete messages and no real issue was created. The final run SHA matches the published PR head.

Validation

  • make recompile: all 328 workflows compiled; generated locks remained in sync.
  • make fmt-cjs and make lint-cjs: passed; inherited lint warnings remain unchanged.
  • make agent-report-progress: passed, including 21 focused JavaScript regressions, typechecking/lint, schema freshness, and workflow drift. No changed Go files; impacted Go tests were skipped.
  • Current-source gh aw compile --dry-run: passed strict validation, native shellcheck and model checks with zero smoke-workflow warnings. Optional Docker scanners were not run.
  • Final verification used real Pi inference in GitHub Actions, not local Pi execution or fixture success alone.

Kept as a draft as requested.

pelikhan and others added 2 commits October 7, 2026 22:44
Use provider-qualified model IDs to avoid alias collisions and replace the unavailable GPT-5 nano model with the advertised GPT-4o mini model. Update the smoke regression to exercise the colliding mini alias and current inventory.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Do not reopen completed turns with time-pressure steering. Scope child reporting to delegated task results while retaining task-required safe outputs and inherited controls. Make smoke answers explicitly plain text and tool-free, with regressions and documentation.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@pelikhan
pelikhan marked this pull request as ready for review October 8, 2026 06:05
Copilot AI balanced review requested due to automatic review settings October 8, 2026 06:05
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

🔎 PR Code Quality Reviewer is reviewing code quality for this pull request...

@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft.

No ADR enforcement needed for PR #66805: the PR does not carry the 'implementation' label (has_implementation_label=false) and has 0 new lines in default business logic directories (threshold: 100, no custom .design-gate.yml). Evidence: /tmp/gh-aw/agent/adr-prefetch-summary.json.

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Lean already. Ship.

Generated by Ponytail Reviewer for #66805

@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer failed during the skills-based review.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel skipped because pre-fetch PR data was unavailable: unable to fetch test file diff

🧪 Test quality analysis by Test Quality Sentinel

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Terminal error turns can still be reopened, and audit evidence fails to recognize two pinned models.

2 open findings
What changed in this PR

This PR improves Pi sub-agent smoke-test model selection, completion handling, and reporting ownership.

Changes:

  • Pins provider-qualified models and replaces the unavailable nano model.
  • Prevents normal completed turns from receiving timeout steering.
  • Adds delegation guidance, tests, documentation, and regenerated workflow output.
File Description
docs/​src/​content/​docs/​engines/​pi.md Documents child completion behavior.
actions/​setup/​js/​pi_subagent_extension.test.cjs Tests delegation and model selection.
actions/​setup/​js/​pi_subagent_extension.cjs Adds child reporting boundaries.
actions/​setup/​js/​pi_steering_extension.test.cjs Tests completed-turn steering behavior.
actions/​setup/​js/​pi_steering_extension.cjs Skips steering after normal completion.
.github/​workflows/​smoke-pi-sub-agents.md Pins smoke models and responses.
.github/​workflows/​smoke-pi-sub-agents.lock.yml Regenerates the compiled workflow.
.changeset/​fix-pi-smoke-completion.md Records the patch release changes.

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

GH_AW_COMPILED_STRICT: "true"
GH_AW_INFO_FEATURES: '{"gh-aw-detection":false}'
GH_AW_INFO_SUB_AGENT_MODELS: "[{\"model\":\"claude-haiku-4.5\",\"name\":\"haiku-whoami\",\"patterns\":[\"github-copilot/claude-haiku-4.5\"]},{\"model\":\"gpt-5-mini\",\"name\":\"mini-whoami\",\"patterns\":[\"github-copilot/gpt-5*mini*\",\"openai/gpt-5*mini*\"]},{\"model\":\"gpt-5-nano\",\"name\":\"nano-whoami\",\"patterns\":[\"github-copilot/gpt-5*nano*\",\"openai/gpt-5*nano*\"]}]"
GH_AW_INFO_SUB_AGENT_MODELS: "[{\"model\":\"copilot/claude-haiku-4.5\",\"name\":\"haiku-whoami\",\"patterns\":[\"github-copilot/claude-haiku-4.5\"]},{\"model\":\"copilot/gpt-5-mini\",\"name\":\"mini-whoami\",\"patterns\":[\"github-copilot/gpt-5-mini\"]},{\"model\":\"copilot/gpt-4o-mini\",\"name\":\"compact-whoami\",\"patterns\":[\"github-copilot/gpt-4o-mini\"]}]"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Audit matching now recognizes the canonical dated Copilot IDs, including Claude’s hyphenated version, and has regression coverage. Pushed as 1994aa9.

pi.on("turn_end", async (/** @type {any} */ _event, /** @type {any} */ ctx) => {
if (startTime === undefined) {
pi.on("turn_end", async (/** @type {any} */ event, /** @type {any} */ ctx) => {
if (startTime === undefined || event.message?.stopReason === "stop") {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deadline steering now runs only when stopReason === "toolUse"; tests cover stop, error, aborted, unknown, and missing reasons. Pushed as 1994aa9.

@github-actions github-actions Bot mentioned this pull request Oct 8, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict

Blocking: the child-session completion fix is still prompt-only, and the new smoke regression does not actually assert the prompt constraints that are meant to keep the failure from coming back.

Key issues
  • actions/setup/js/pi_subagent_extension.cjs:41-44 still leaves the completion/noop path technically available inside child sessions, so the original regression can recur when a delegated model ignores or reinterprets the added instruction.
  • actions/setup/js/pi_subagent_extension.test.cjs:177-240 only checks the selected model and returned text; it never inspects the generated prompt, so removing the new plain-text only / Do not call tools constraints would not fail this test.

The grumpy-coder sub-agent failed before producing output, so this review is based on the diff and local source inspection only.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt54 · 45.3 AIC · ⌖ 5.68 AIC · ⊞ 19.8K
Comment /review to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Impeccable review: harden + audit (bug_fix/correctness)

Scope: .github/workflows/smoke-pi-sub-agents.md, pi_steering_extension.cjs, pi_subagent_extension.cjs, docs, changeset, and tests.

Verification performed

  • Ran vitest on pi_steering_extension.test.cjs and pi_subagent_extension.test.cjs at the PR head (fe36b03): all 21 tests pass.
  • Traced event.message?.stopReason === "stop" guard in pi_steering_extension.cjs against the test added in the same commit — correctly skips steering on a completed assistant turn while still steering on toolUse turns, matching the documented v1 Pi event schema (stopReason enum used consistently elsewhere, e.g. pi_agent_core_driver.cjs, pi_rpc_driver.cjs).
  • Confirmed copilot/gpt-5-mini and copilot/gpt-4o-mini are provider-qualified (not bare aliases), so resolveModelAlias in pi_subagent_config.cjs cannot resolve them to a newer gpt-5.4-mini/similar alias match — this directly fixes the reported model-selection bug.
  • Confirmed the delegationScope text appended to each sub-agent's system prompt in pi_subagent_extension.cjs is only advisory (prompt convention), not an enforced technical control; GH_AW_PI_SUBAGENT_CHILD=1 is the actual mechanism that short-circuits piSubagentExtension registration in child sessions (pi_subagent_extension.cjs:161), so the "no noop/completion in child" behavior is backed by code, not only prompt text. No issue — just confirming the design is sound.
  • Docs update in docs/src/content/docs/engines/pi.md accurately describes the new behavior.

Result: No blocking issues found. Changes are minimal, consistent with existing conventions (logger, test harness patterns), and backed by passing unit tests plus the PR description's hosted Actions verification.

No inline comments added — changed lines are correctness-focused infra/test code with adequate coverage.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · copilot · sonnet50 · 132.8 AIC · ⌖ 13.2 AIC · ⊞ 8.1K

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · sonnet50 · 175.9 AIC · ⌖ 14.4 AIC · ⊞ 10.1K
Comment /matt to run again

fs.writeFileSync(promptPath, system + agent.prompt, { mode: 0o600 });
const delegationScope =
"You are a delegated sub-agent, not the workflow's main agent. Complete only the delegated task and return your answer to the parent, following the declared agent's output format exactly. " +
"The parent is responsible for finalizing the workflow and its required safe-output reporting. Do not emit noop safe outputs or workflow-completion reports for this child session. " +

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/diagnosing-bugs] This fix relies entirely on prompt text ("Do not emit noop safe outputs or workflow-completion reports") rather than structural enforcement. The codebase already has a working pattern for this exact scenario one line above: GH_AW_PI_SUBAGENT_CHILD env var gates piSubagentExtension registration structurally. A model can ignore prompt instructions.

💡 Why this matters and a possible structural fix

The root cause of the original bug ("staged report FAIL despite green Actions... aborted compact child") was that children could independently trigger workflow-completion/noop safe outputs. Pinning this down with a text instruction treats the symptom, not the mechanism. Since GH_AW_PI_SUBAGENT_CHILD=1 is already set in the child's env (line 52), consider filtering/disabling the noop/completion-reporting tool(s) from the child's MCP tool list when that env var is set, the same way piSubagentExtension itself is disabled for children. This would make the constraint unbypassable regardless of what the model decides to do with the extra prompt text.

If a structural fix is infeasible for this PR (e.g. tool registration happens in a separate process/extension not easily reached here), it would help to note in the PR description or a code comment why prompt-only mitigation was chosen, and whether gh aw audit/tests can detect a regression if a child does emit a completion report despite the instruction.

@copilot please address this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The child Pi tool policy now blocks noop and incomplete-reporting tools while leaving task safe outputs available. The existing prompt assertions remain, with added policy regression coverage. Pushed as 1994aa9.

@pelikhan

pelikhan commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator Author

@copilot run or-finisher skill

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

@copilot run or-finisher skill

Finished the PR-finisher pass: addressed the review feedback and pushed 1994aa9. Local validation passed; CI on the new head still needs a human re-trigger.

@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Hey @pelikhan 👋 — thanks for this fix! This PR is well-aligned with the project guidelines: a focused change with regression tests and a clear description. Ready for review.

Generated by ✅ Contribution Check · copilot · auto · 32.8 AIC · ⌖ 0.608 AIC · ⊞ 9.2K · ◷

@pelikhan
pelikhan merged commit 7cc1db3 into main Oct 8, 2026
1 check passed
@pelikhan
pelikhan deleted the pelikhan-debug-new-workflow branch October 8, 2026 12:27
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.91.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants