Skip to content

fix(server): agents use gh for a PR when the user asks for it - #48470

Closed
shivamhwp wants to merge 1 commit into
mainfrom
t3/gh-cli-refusals
Closed

shivamhwp wants to merge 1 commit into
mainfrom
t3/gh-cli-refusals

Conversation

@shivamhwp

Copy link
Copy Markdown
Collaborator

Problem

A user reported in Discord that a GPT model kept refusing gh requests with "T3 requires me to open PRs through its GitHub connector." The PR-tool instruction says to use pull_request_* tools, "not gh or cafe", with no exception for a user who asks for the CLI. On Codex this text is sent as developer instructions, so it wins over the user's message. Expected: T3's tools stay the default, and an explicit ask for gh or cafe is honored.

Change

One sentence in PULL_REQUEST_LINKING_INSTRUCTIONS:

  • Before: When pull_request_* tools are listed, use them, not gh or cafe, to read, list, open, edit, …
  • After: Unless asked for gh or cafe, use listed pull_request_* tools to read, list, open, edit, …

The rest of the diff follows from that sentence: the eight Muse replay fixtures that embed it, and agentContextBudget.json, which drops by 3 bytes because the new sentence is shorter. One eval case is added, user-asks-gh-pr-create: the user says "Use gh pr create for this one", and the agent must run it, must not call pull_request_create, and the PR must end up linked.

Scope

Bug fix for the report above. No issue: it is a one-sentence fix to model-facing text with a failing eval case.

Verification

Evals: pnpm mcp-tool-use --model gpt-6.1-sol --shell-model gpt-6.1-terra, default samples (2, a 3rd when they disagree), on cases/pull-requests.ndjson.

The new case, on the text before and after:

user-asks-gh-pr-create Passed
Before 0 of 5 samples. Every sample called pull_request_create and never ran gh.
After 4 of 4 samples. Each ran gh pr create, then link_pull_request.

The 26 cases that cover the PR and CI tools, same model and shell before and after:

Samples passed Cases failing
Before 49 of 53 user-asks-gh-pr-create (0 of 2), pr-list-through-gh (1 of 3)
After 52 of 52 none

No case that passed before fails after. The cases that guard the default (open-pr-through-gh, merge-through-gh-unpinned, pr-checks-through-gh, ci-failure-read-through-gh and the rest) still pass with no gh call.

The other 40 Codex cases in the file, on the new text: 82 of 84 samples pass and no case fails. Two cases had one failed sample each, so I ran both on the old text too:

Case Old text New text
control-link-means-url 1 of 3 2 of 3
child-pr-not-linked 3 of 3 2 of 3 (the failed sample ran out of steps)

I also tried the smaller edit, use them → prefer them, with 3 samples per case:

Case prefer them This PR
user-asks-gh-pr-create 3 of 3 4 of 4
open-pr-through-gh 3 of 3 2 of 2
pr-checks-through-gh 3 of 3 2 of 2
merge-through-gh-unpinned 0 of 3 2 of 2

With prefer them, every merge sample called pull_request_merge and then ran gh pr merge unasked, which is the unpinned merge that case exists to stop.

Checks at 606198f0779f: vp run check:changed passes (format, lint, knip, graphql, typecheck, and the tests it selects: runtimeInstructions.test.ts, AgentContextBudget.test.ts). vp test run src/orchestration-v2/testkit/MuseReplayFixtures.integration.test.ts passes 8 of 8 against the edited fixtures.

Not shown:

  • Claude models. I had no Anthropic eval key, so deploy-wait-ends-turn-unwatched (a Claude-harness case) did not run and there is no Claude arm.
  • GPT 6.2 Sol, the model in the report. The eval's model table has 6.1 Sol.
  • A user asking for cafe, and an ask that comes from project instructions or a parent's brief. "Asked" covers them by wording; no case tests them.
  • Eval areas outside pull-requests.ndjson. The full run per model that evals/README.md asks for before merge is not done.
  • 9 samples across these runs errored at the model provider and are left out of the pass rates.

Claude Fable 5.2, Claude Code in T3 Code. Review by GPT-6.1 Sol in Codex.

🤖 Generated with Claude Code

The PR-tool instruction said to use pull_request_* tools, "not gh or cafe",
with no exception, so an agent asked to open a PR with gh used
pull_request_create or refused. The sentence now opens with "Unless asked
for gh or cafe". It is 3 bytes shorter, so the agent context budget drops.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Dec 3, 2026
@macroscopeapp

macroscopeapp Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 606198f

Macroscope's review found this PR approvable — Agents may use gh or cafe for PR work when explicitly requested; listed PR tools remain the default. Existing linking and monitoring instructions are unchanged, and context-budget measurements reflect the shorter prompt.

You can add or adjust custom eligibility rules. Learn more.

@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 5.0 KiB 5.0 KiB 0 B (0.0%) 6.8 KiB ✅
Codex Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅
Codex Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB ✅
Codex Live turn WebSocket decoded 21.5 KiB 21.5 KiB 0 B (0.0%) 24.4 KiB ✅
Codex Live turn messages 1 1 0 (0.0%) 8 ✅
Claude Total thread wire 5.0 KiB 5.0 KiB 0 B (0.0%) 6.8 KiB ✅
Claude Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅
Claude Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB ✅
Claude Live turn WebSocket decoded 21.9 KiB 21.9 KiB 0 B (0.0%) 24.4 KiB ✅
Claude Live turn messages 1 1 0 (0.0%) 8 ✅

Other scenarios

All 64 scenario measurements match main.

All 64 scenario measurements
Provider Scenario Metric Main baseline This PR Impact PR ceiling
Codex short turn resume WebSocket decoded 10.5 KiB 10.5 KiB 0 B (0.0%) 12.7 KiB ✅
Codex short turn resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Codex long turn running, cold open HTTP decoded 281.7 KiB 281.7 KiB 0 B (0.0%) 302.7 KiB ✅
Codex long turn running, cold open rows 75 75 0 (0.0%) 75 ✅
Codex long turn running, history page HTTP decoded 92.5 KiB 92.5 KiB 0 B (0.0%) 107.4 KiB ✅
Codex long turn running, history page rows 75 75 0 (0.0%) 75 ✅
Codex long turn finished, cold open HTTP decoded 381.5 KiB 381.5 KiB 0 B (0.0%) 410.2 KiB ✅
Codex long turn finished, cold open rows 151 151 0 (0.0%) 151 ✅
Codex long turn finished, socket cold open WebSocket decoded 381.6 KiB 381.6 KiB 0 B (0.0%) 410.2 KiB ✅
Codex long turn finished, socket cold open WebSocket messages 2 2 0 (0.0%) 2 ✅
Codex long turn finished, socket cold open rows 151 151 0 (0.0%) 151 ✅
Codex long turn finished, work page HTTP decoded 78.3 KiB 78.3 KiB 0 B (0.0%) 200.2 KiB ✅
Codex long turn finished, work page rows 75 75 0 (0.0%) 150 ✅
Codex idle thread resume WebSocket decoded 65 B 65 B 0 B (0.0%) 200 B ✅
Codex idle thread resume WebSocket messages 1 1 0 (0.0%) 1 ✅
Codex fleet shell snapshot HTTP decoded 42.4 KiB 42.4 KiB 0 B (0.0%) 53.7 KiB ✅
Codex fleet shell snapshot rows 27 27 0 (0.0%) 27 ✅
Codex fleet shell subscribe WebSocket decoded 65 B 65 B 0 B (0.0%) 200 B ✅
Codex fleet shell subscribe WebSocket messages 1 1 0 (0.0%) 1 ✅
Codex fleet shell resume check HTTP decoded 18 B 18 B 0 B (0.0%) 100 B ✅
Codex fleet shell resume check rows 0 0 0 0 ✅
Codex stale shell reload HTTP decoded 42.4 KiB 42.4 KiB 0 B (0.0%) 53.7 KiB ✅
Codex stale shell reload rows 27 27 0 (0.0%) 27 ✅
Codex stale shell resume WebSocket decoded 140 B 140 B 0 B (0.0%) 400 B ✅
Codex stale shell resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Codex stale todo list cold open HTTP decoded 72.4 KiB 72.4 KiB 0 B (0.0%) 83.0 KiB ✅
Codex stale todo list cold open rows 75 75 0 (0.0%) 75 ✅
Codex stale todo list cold open nodes 2 2 0 (0.0%) 4 ✅
Codex stale todo list cold open subagents 2 2 0 (0.0%) 4 ✅
Codex stale todo list cold open plans 1 1 0 (0.0%) 2 ✅
Codex stale todo list cold open providerTurns 1 1 0 (0.0%) 2 ✅
Codex stale todo list cold open checkpoints 1 1 0 (0.0%) 2 ✅
Claude short turn resume WebSocket decoded 10.6 KiB 10.6 KiB 0 B (0.0%) 12.7 KiB ✅
Claude short turn resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Claude long turn running, cold open HTTP decoded 283.3 KiB 283.3 KiB 0 B (0.0%) 302.7 KiB ✅
Claude long turn running, cold open rows 75 75 0 (0.0%) 75 ✅
Claude long turn running, history page HTTP decoded 93.4 KiB 93.4 KiB 0 B (0.0%) 107.4 KiB ✅
Claude long turn running, history page rows 75 75 0 (0.0%) 75 ✅
Claude long turn finished, cold open HTTP decoded 384.2 KiB 384.2 KiB 0 B (0.0%) 410.2 KiB ✅
Claude long turn finished, cold open rows 151 151 0 (0.0%) 151 ✅
Claude long turn finished, socket cold open WebSocket decoded 384.3 KiB 384.3 KiB 0 B (0.0%) 410.2 KiB ✅
Claude long turn finished, socket cold open WebSocket messages 2 2 0 (0.0%) 2 ✅
Claude long turn finished, socket cold open rows 151 151 0 (0.0%) 151 ✅
Claude long turn finished, work page HTTP decoded 79.2 KiB 79.2 KiB 0 B (0.0%) 200.2 KiB ✅
Claude long turn finished, work page rows 75 75 0 (0.0%) 150 ✅
Claude idle thread resume WebSocket decoded 66 B 66 B 0 B (0.0%) 200 B ✅
Claude idle thread resume WebSocket messages 1 1 0 (0.0%) 1 ✅
Claude fleet shell snapshot HTTP decoded 43.0 KiB 43.0 KiB 0 B (0.0%) 53.7 KiB ✅
Claude fleet shell snapshot rows 27 27 0 (0.0%) 27 ✅
Claude fleet shell subscribe WebSocket decoded 66 B 66 B 0 B (0.0%) 200 B ✅
Claude fleet shell subscribe WebSocket messages 1 1 0 (0.0%) 1 ✅
Claude fleet shell resume check HTTP decoded 18 B 18 B 0 B (0.0%) 100 B ✅
Claude fleet shell resume check rows 0 0 0 0 ✅
Claude stale shell reload HTTP decoded 43.0 KiB 43.0 KiB 0 B (0.0%) 53.7 KiB ✅
Claude stale shell reload rows 27 27 0 (0.0%) 27 ✅
Claude stale shell resume WebSocket decoded 140 B 140 B 0 B (0.0%) 400 B ✅
Claude stale shell resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Claude stale todo list cold open HTTP decoded 73.4 KiB 73.4 KiB 0 B (0.0%) 83.0 KiB ✅
Claude stale todo list cold open rows 75 75 0 (0.0%) 75 ✅
Claude stale todo list cold open nodes 2 2 0 (0.0%) 4 ✅
Claude stale todo list cold open subagents 2 2 0 (0.0%) 4 ✅
Claude stale todo list cold open plans 1 1 0 (0.0%) 2 ✅
Claude stale todo list cold open providerTurns 1 1 0 (0.0%) 2 ✅
Claude stale todo list cold open checkpoints 1 1 0 (0.0%) 2 ✅

Baseline: 4ec5222 · PR result: 606198f · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 108.5 KiB
  • Claude decoded thread snapshot: 108.8 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

@coderabbitai

coderabbitai Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The runtime pull-request instruction now allows gh or cafe when explicitly requested. Transcript fixtures reflect the updated wording, and a new evaluation case checks an explicit gh pr create request. Two configured context byte limits each decrease by three.

Changes: Pull-request tool selection

Layer / File(s) Summary
Runtime guidance and context budgets
packages/provider-core/src/server/runtimeInstructions.ts, apps/server/src/provider/agentContextBudget.json
The runtime instruction makes listed pull-request tools the default unless the user requests gh or cafe. Both configured context byte limits decrease by three.
Transcript and evaluation coverage
apps/server/src/orchestration-v2/testkit/fixtures/*/muse_transcript.ndjson, evals/mcp-tool-use/cases/pull-requests.ndjson
The transcript fixtures record the revised instruction in turn inputs and user-message events. The evaluation case checks that an explicit gh pr create request uses the CLI and leaves the resulting PR linked to the thread.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Suggested reviewers: gabrielelpidio

Merge Risk: Minimal · up to 60619

This change lets agents use gh or cafe when a user explicitly asks for them, and keeps the listed pull request tools as the default. The change is small and low risk, so it looks ready to merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: agents should use gh for a PR when the user asks for it. The raw summary and objectives confirm that PULL_REQUEST_LINKING_INSTRUCTIONS now makes an explicit gh or cafe…
Description check Passed The description follows the repository template closely. It has Problem, Change, Scope, and Verification sections, and each one contains specific content. The Problem section gives the user report and…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: agents should use gh for a PR when the user asks for it. The raw summary and objectives confirm that PULL_REQUEST_LINKING_INSTRUCTIONS now makes an explicit gh or cafe request an exception to the default pull_request_* tool rule, and the title matches that behavior change. The title follows the conventional commit format and is specific enough for a teammate scanning history.

Full details: Description check

Explanation

The description follows the repository template closely. It has Problem, Change, Scope, and Verification sections, and each one contains specific content. The Problem section gives the user report and expected behavior. The Change section quotes the before and after instruction text. The Scope section explains why no issue is linked and why the change is a bug fix. The Verification section gives eval results before and after, unit and fixture test results, and a list of what was not tested. The description also names the model and harness used, as the template requests. Two minor gaps remain. The Scope section does not link an issue, and the author gives a reason for omitting one, which the template allows for small obvious fixes. The Verification section has a few claims that rely on eval runs outside the PR, but these are stated with their scope and limits.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 4ec5222 and 606198f.

Files selected for processing: 11

  • apps/server/src/orchestration-v2/testkit/fixtures/multi_turn/muse_transcript.ndjson
  • apps/server/src/orchestration-v2/testkit/fixtures/muse_permission/muse_transcript.ndjson
  • apps/server/src/orchestration-v2/testkit/fixtures/muse_subagent_approval/muse_transcript.ndjson
  • apps/server/src/orchestration-v2/testkit/fixtures/muse_subagent_interrupt/muse_transcript.ndjson
  • apps/server/src/orchestration-v2/testkit/fixtures/muse_workflow/muse_transcript.ndjson
  • apps/server/src/orchestration-v2/testkit/fixtures/simple/muse_transcript.ndjson
  • apps/server/src/orchestration-v2/testkit/fixtures/subagent_v2/muse_transcript.ndjson
  • apps/server/src/orchestration-v2/testkit/fixtures/turn_interrupt/muse_transcript.ndjson
  • apps/server/src/provider/agentContextBudget.json
  • evals/mcp-tool-use/cases/pull-requests.ndjson
  • packages/provider-core/src/server/runtimeInstructions.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@juliusmarminge

Copy link
Copy Markdown
Member

Thanks for this. Before a bug fix is taken further, the bug is reproduced on current main, and here it did not appear.

I tried this on current main (4ec5222) in the real app. I started a dev server with a fresh database and added a project whose origin is a GitHub URL. On a branch with one committed change, I started threads with your eval's prompt ending in "Use gh pr create for this one." The session log shows the unchanged instruction ("use them, not gh or cafe") reached the model as developer instructions, and T3's pull request tools could be called.

In every sample the agent ran gh pr create and never called pull_request_create or said T3 required its connector. That was three samples on gpt-6.1-sol (default, medium and high effort), one each on gpt-6-astra and gpt-6-sol, and one on Claude Haiku. In a control run without the gh request, the model still tried gh before using T3's tool. So in the shipped app the explicit request was honored, and the current wording did not stop it.

Your harness's 0-of-5 result is real for that harness, but it doesn't seem to carry over to the app as it runs today. If you have the model, effort and settings from the Discord report, or a transcript where the refusal happens in the app, we'd be glad to look again.

Closing this pull request. If it still happens for you, please open an issue with the exact steps, what you see, and the version and platform you are on; a fix is picked up from there.

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

Labels

size:M 30-99 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants