The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 03:37 UTC
feat(server): pull_request_read returns a compact summary by default (#39901)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Nov 20, 2026 at 16:17 UTC
e19193db45054e06df5e799bf4d6b4fd9ec53e90
7 files changed
+283
-218
apps/server/src/mcp/toolkits/pullRequests/handlers.test.ts
+55
-23
@@ -847,7 +847,20 @@ describe("source control tools", () => {
847
changedFiles: 1,
848
labels: [],
849
reviewers: [],
850
- checks: [{ name: "CI", status: "success", description: null, url: null }],
850
+ checks: [
851
+ { name: "CI", status: "success", description: null, url: null },
852
+ { name: "Lint", status: "failure", description: null, url: null },
853
+ { name: "E2E", status: "cancelled", description: null, url: null },
854
+ { name: "Deploy", status: "pending", description: null, url: null },
855
+ {
856
+ name: "Approval",
857
+ status: "action-required",
858
+ description: null,
859
+ url: null,
860
+ placeholder: true,
861
+ },
862
+ { name: "Docs", status: "skipped", description: null, url: null },
863
+ ],
864
} as unknown as PullRequestDetail;
865
const reviewThread = (id: string, isResolved: boolean) => ({
866
id,
@@ -866,34 +879,51 @@ describe("source control tools", () => {
879
commits: [],
880
};
881
869
- it.effect("reads the thread's branch PR, only the sections asked, without resolved threads", () =>
882
+ it.effect("reads the thread's branch PR compactly, adding only the sections asked", () =>
883
Effect.gen(function* () {
884
const asked: Array<PullRequestRef> = [];
885
+ let reviewThreadsTruncated = false;
886
const harness = yield* makeHarness({
887
thread: branchThread,
888
pullRequests: {
889
detail: (ref) => Effect.sync(() => asked.push(ref)).pipe(Effect.as(detail)),
876
- activity: () => Effect.succeed(activity),
890
+ activity: () => Effect.sync(() => ({ ...activity, reviewThreadsTruncated })),
891
},
892
});
879
- const result = yield* harness.call("pull_request_read", {
880
- sections: ["summary", "conversation"],
893
+ const compact = yield* harness.call("pull_request_read", {});
894
+ expect(compact).toMatchObject({
895
+ headSha: "abc123",
896
+ checks: { passed: 2, pending: 1, failed: ["Lint", "E2E"], incomplete: true },
897
+ unresolvedThreads: 1,
898
});
882
- expect(asked).toEqual([
883
- {
884
- projectId: PROJECT_ID,
885
- host: "github.com",
886
- repository: "t3tools/t3code",
887
- number: 42,
888
- allowStale: false,
889
- },
890
- ]);
891
- expect(result.summary?.headSha).toBe("abc123");
892
- expect(result.checks).toBeUndefined();
893
- expect(result.conversation?.reviewThreads.map((thread) => thread.id)).toEqual([
899
+ expect(compact.body).toBeUndefined();
900
+ expect(compact.checkRuns).toBeUndefined();
901
+ expect(compact.conversation).toBeUndefined();
902
+ expect(compact.unresolvedThreadsTruncated).toBeUndefined();
903
+ const result = yield* harness.call("pull_request_read", { include: ["body", "threads"] });
904
+ expect(asked[1]).toEqual({
905
+ projectId: PROJECT_ID,
906
+ host: "github.com",
907
+ repository: "t3tools/t3code",
908
+ number: 42,
909
+ allowStale: false,
910
+ });
911
+ expect(result.body).toBe("Adds tools.");
912
+ expect(result.checkRuns).toBeUndefined();
913
+ expect(result.conversation?.comments).toBeUndefined();
914
+ expect(result.conversation?.reviewThreads?.map((thread) => thread.id)).toEqual([
915
"open-thread",
916
]);
896
- expect(result.conversation?.hiddenResolvedThreads).toBe(1);
917
+ // Unfetched threads may be unresolved, so the compact count says it is partial.
918
+ reviewThreadsTruncated = true;
919
+ expect(yield* harness.call("pull_request_read", {})).toMatchObject({
920
+ unresolvedThreads: 1,
921
+ unresolvedThreadsTruncated: true,
922
+ });
923
+ const commentsOnly = yield* harness.call("pull_request_read", { include: ["comments"] });
924
+ expect(commentsOnly.conversation?.truncated).toBe(false);
925
+ const threadsOnly = yield* harness.call("pull_request_read", { include: ["threads"] });
926
+ expect(threadsOnly.conversation?.truncated).toBe(true);
927
}),
928
);
929
@@ -910,6 +940,7 @@ describe("source control tools", () => {
940
const harness = yield* makeHarness({
941
thread: branchThread,
942
pullRequests: {
943
+ detail: () => Effect.succeed(detail),
944
activity: () =>
945
Effect.sync(() => ({
946
...activity,
@@ -942,7 +973,7 @@ describe("source control tools", () => {
973
),
974
},
975
});
945
- const first = yield* harness.call("pull_request_read", { sections: ["conversation"] });
976
+ const first = yield* harness.call("pull_request_read", { include: ["threads"] });
977
expect(first.conversation?.reviewThreads).toMatchObject([
978
{ id: "first", moreComments: false, comments: [{}, { body: "reply" }] },
979
]);
@@ -951,12 +982,12 @@ describe("source control tools", () => {
982
// The agent resolves what it read; the next page still starts at the next thread.
983
firstResolved = true;
984
const second = yield* harness.call("pull_request_read", { cursor: cursor! });
954
- expect(second.summary).toBeUndefined();
955
- expect(second.conversation?.reviewThreads.map((thread) => thread.id)).toEqual(["second"]);
985
+ expect(second.conversation?.comments).toBeUndefined();
986
+ expect(second.conversation?.reviewThreads?.map((thread) => thread.id)).toEqual(["second"]);
987
expect(second.conversation?.nextCursor).toBeNull();
988
// A cursor past the current end finishes instead of repeating an empty page.
989
const stale = Base64Url.encode(
959
- JSON.stringify({ threads: 99, comments: 99, includeResolved: false }),
990
+ JSON.stringify({ threads: 99, comments: null, includeResolved: false }),
991
);
992
const past = yield* harness.call("pull_request_read", { cursor: stale });
993
expect(past.conversation).toMatchObject({ reviewThreads: [], nextCursor: null });
@@ -991,10 +1022,11 @@ describe("source control tools", () => {
1022
pullRequests: {
1023
summary: () => Effect.succeed({ state: "open", headBranch } as never),
1024
detail: (ref) => Effect.sync(() => asked.push(ref)).pipe(Effect.as(detail)),
1025
+ activity: () => Effect.succeed(activity),
1026
},
1027
});
1028
const harness = yield* opened("tools");
997
- yield* harness.call("pull_request_read", { sections: ["summary"] });
1029
+ yield* harness.call("pull_request_read", {});
1030
expect(asked).toMatchObject([{ number: 43 }]);
1031
1032
// Before sync, the host says which branch it came from; another branch's is not this one.
apps/server/src/mcp/toolkits/pullRequests/handlers.ts
+97
-73
@@ -5,6 +5,7 @@ import {
5
PullRequestListCursors,
6
type PullRequestRef,
7
type PullRequestReviewCommentDraft,
8
+ type PullRequestCheck,
9
type PullRequestReviewThread,
10
type OrchestrationProjectShell,
11
type PullRequestState,
@@ -70,9 +71,10 @@ import {
71
72
const ReadCursor = Schema.Union([
73
Schema.Struct({ diff: TrimmedNonEmptyString }),
74
+ // Null marks a list the read did not ask for.
75
Schema.Struct({
74
- threads: NonNegativeInt,
75
- comments: NonNegativeInt,
76
+ threads: Schema.NullOr(NonNegativeInt),
77
+ comments: Schema.NullOr(NonNegativeInt),
78
includeResolved: Schema.Boolean,
79
}),
80
]);
@@ -116,7 +118,7 @@ const REVIEW_DIFF_PAGES = 10;
118
119
function conversationPage(
120
activity: PullRequestActivity,
119
- start: { readonly threads: number; readonly comments: number },
121
+ start: { readonly threads: number | null; readonly comments: number | null },
122
includeResolved: boolean,
123
) {
124
// Offsets index the unfiltered lists, whose order resolving a thread does not change.
@@ -124,8 +126,8 @@ function conversationPage(
126
const pageThreads: Array<PullRequestReviewThread> = [];
127
const pageComments: Array<PullRequestActivity["comments"][number]> = [];
128
let size = 0;
127
- let thread = Math.min(start.threads, reviewThreads.length);
128
- let comment = Math.min(start.comments, comments.length);
129
+ let thread = start.threads === null ? null : Math.min(start.threads, reviewThreads.length);
130
+ let comment = start.comments === null ? null : Math.min(start.comments, comments.length);
131
const fits = (item: unknown) => {
132
const next = size + JSON.stringify(item).length;
133
if (next > CONVERSATION_PAGE_CHARS && pageThreads.length + pageComments.length > 0) {
@@ -135,7 +137,7 @@ function conversationPage(
137
return true;
138
};
139
// Review threads come first: they hold the feedback an agent acts on.
138
- while (thread < reviewThreads.length) {
140
+ while (thread !== null && thread < reviewThreads.length) {
141
const next = reviewThreads[thread]!;
142
if (includeResolved || !next.isResolved) {
143
if (!fits(next)) break;
@@ -143,22 +145,34 @@ function conversationPage(
145
}
146
thread += 1;
147
}
146
- if (thread === reviewThreads.length) {
147
- while (comment < comments.length && fits(comments[comment])) {
148
+ const threadsDone = thread === null || thread === reviewThreads.length;
149
+ if (threadsDone) {
150
+ while (comment !== null && comment < comments.length && fits(comments[comment])) {
151
pageComments.push(comments[comment++]!);
152
}
153
}
151
- const done = thread === reviewThreads.length && comment === comments.length;
154
+ const done = threadsDone && (comment === null || comment === comments.length);
155
return {
156
threads: pageThreads,
157
comments: pageComments,
155
- hiddenResolvedThreads: includeResolved
156
- ? 0
157
- : reviewThreads.filter((candidate) => candidate.isResolved).length,
158
next: done ? null : { threads: thread, comments: comment, includeResolved },
159
};
160
}
161
162
+function checksSummary(checks: ReadonlyArray<PullRequestCheck>) {
163
+ let passed = 0;
164
+ let pending = 0;
165
+ let incomplete = false;
166
+ const failed: Array<string> = [];
167
+ for (const check of checks) {
168
+ if (check.placeholder === true) incomplete = true;
169
+ else if (check.status === "failure" || check.status === "cancelled") failed.push(check.name);
170
+ else if (check.status === "pending" || check.status === "action-required") pending += 1;
171
+ else passed += 1;
172
+ }
173
+ return { passed, pending, failed, ...(incomplete ? { incomplete: true as const } : {}) };
174
+}
175
+
176
function entryOf(
177
link: ThreadPullRequestLink,
178
chains: ReturnType<typeof resolveThreadPullRequestChains>,
@@ -570,10 +584,8 @@ const make = Effect.gen(function* () {
584
const [detail, activity, diff] = yield* Effect.all(
585
[
586
// Agents pin merges to this headSha, so it must not come from a stale snapshot.
573
- wants("summary") || wants("checks")
574
- ? pullRequests.detail({ ...ref, allowStale: false }).pipe(Effect.asSome)
575
- : Effect.succeedNone,
576
- wants("conversation") ? pullRequests.activity(ref).pipe(Effect.asSome) : Effect.succeedNone,
587
+ pullRequests.detail({ ...ref, allowStale: false }),
588
+ pullRequests.activity(ref),
589
wants("diff")
590
? pullRequests
591
.diff({ ...ref, ...(diffCursor === undefined ? {} : { cursor: diffCursor }) })
@@ -582,70 +594,79 @@ const make = Effect.gen(function* () {
594
],
595
{ concurrency: "unbounded" },
596
).pipe(Effect.mapError(forgeFailure));
585
- const page = Option.map(activity, (value) =>
586
- conversationPage(
587
- value,
588
- cursor !== undefined && "threads" in cursor ? cursor : { threads: 0, comments: 0 },
589
- includeResolved,
590
- ),
591
- );
597
+ const wantsThreads = wants("threads");
598
+ const wantsComments = wants("comments");
599
+ const page =
600
+ wantsThreads || wantsComments
601
+ ? Option.some(
602
+ conversationPage(
603
+ activity,
604
+ cursor !== undefined && "threads" in cursor
605
+ ? cursor
606
+ : { threads: wantsThreads ? 0 : null, comments: wantsComments ? 0 : null },
607
+ includeResolved,
608
+ ),
609
+ )
610
+ : Option.none();
611
const threadRests = Option.isSome(page)
612
? yield* Effect.forEach(page.value.threads, (thread) => restOfThread(ref, thread), {
613
concurrency: 4,
614
})
615
: [];
616
const result: Omit<ReadPullRequestResult, "host" | "repository" | "number" | "url"> = {
598
- ...(Option.isSome(detail) && wants("summary")
599
- ? {
600
- summary: {
601
- title: detail.value.title,
602
- body: detail.value.body,
603
- state: detail.value.state,
604
- isDraft: detail.value.isDraft,
605
- author: detail.value.author?.login ?? null,
606
- headBranch: detail.value.headBranch,
607
- baseBranch: detail.value.baseBranch,
608
- headSha: detail.value.headSha ?? null,
609
- mergeability: detail.value.mergeability,
610
- behindBy: detail.value.behindBy ?? null,
611
- autoMergeEnabled: detail.value.autoMergeEnabled ?? null,
612
- additions: detail.value.additions,
613
- deletions: detail.value.deletions,
614
- changedFiles: detail.value.changedFiles,
615
- labels: detail.value.labels.map((label) => label.name),
616
- reviewers: detail.value.reviewers.map((reviewer) => reviewer.login),
617
- },
618
- }
619
- : {}),
620
- ...(Option.isSome(detail) && wants("checks") ? { checks: detail.value.checks } : {}),
621
- ...(Option.isSome(activity) && Option.isSome(page)
617
+ title: detail.title,
618
+ state: detail.state,
619
+ isDraft: detail.isDraft,
620
+ author: detail.author?.login ?? null,
621
+ headBranch: detail.headBranch,
622
+ baseBranch: detail.baseBranch,
623
+ headSha: detail.headSha ?? null,
624
+ mergeability: detail.mergeability,
625
+ behindBy: detail.behindBy ?? null,
626
+ autoMergeEnabled: detail.autoMergeEnabled ?? null,
627
+ checks: checksSummary(detail.checks),
628
+ unresolvedThreads: activity.reviewThreads.filter((thread) => !thread.isResolved).length,
629
+ ...(activity.reviewThreadsTruncated === true ? { unresolvedThreadsTruncated: true } : {}),
630
+ ...(wants("body") ? { body: detail.body } : {}),
631
+ ...(wants("checks") ? { checkRuns: detail.checks } : {}),
632
+ ...(Option.isSome(page)
633
? {
634
conversation: {
624
- comments: page.value.comments.map((comment) => ({
625
- id: comment.id,
626
- kind: comment.kind,
627
- author: comment.author?.login ?? null,
628
- body: comment.body,
629
- createdAt: comment.createdAt,
630
- path: comment.path,
631
- reviewState: comment.reviewState,
632
- })),
633
- reviewThreads: page.value.threads.map((thread, index) => ({
634
- id: thread.id,
635
- path: thread.path,
636
- line: thread.line,
637
- isResolved: thread.isResolved,
638
- isOutdated: thread.isOutdated,
639
- comments: [...thread.comments, ...threadRests[index]!.comments].map((comment) => ({
640
- author: comment.author?.login ?? null,
641
- body: comment.body,
642
- createdAt: comment.createdAt,
643
- })),
644
- moreComments: threadRests[index]!.moreComments,
645
- })),
646
- hiddenResolvedThreads: page.value.hiddenResolvedThreads,
635
+ ...(wantsThreads
636
+ ? {
637
+ reviewThreads: page.value.threads.map((thread, index) => ({
638
+ id: thread.id,
639
+ path: thread.path,
640
+ line: thread.line,
641
+ isResolved: thread.isResolved,
642
+ isOutdated: thread.isOutdated,
643
+ comments: [...thread.comments, ...threadRests[index]!.comments].map(
644
+ (comment) => ({
645
+ author: comment.author?.login ?? null,
646
+ body: comment.body,
647
+ createdAt: comment.createdAt,
648
+ }),
649
+ ),
650
+ moreComments: threadRests[index]!.moreComments,
651
+ })),
652
+ }
653
+ : {}),
654
+ ...(wantsComments
655
+ ? {
656
+ comments: page.value.comments.map((comment) => ({
657
+ id: comment.id,
658
+ kind: comment.kind,
659
+ author: comment.author?.login ?? null,
660
+ body: comment.body,
661
+ createdAt: comment.createdAt,
662
+ path: comment.path,
663
+ reviewState: comment.reviewState,
664
+ })),
665
+ }
666
+ : {}),
667
truncated:
648
- activity.value.commentsTruncated || activity.value.reviewThreadsTruncated === true,
668
+ (wantsComments && activity.commentsTruncated) ||
669
+ (wantsThreads && activity.reviewThreadsTruncated === true),
670
nextCursor: page.value.next === null ? null : readCursors.encode(page.value.next),
671
},
672
}
@@ -958,10 +979,13 @@ const make = Effect.gen(function* () {
979
// A cursor continues the one section it came from, with that read's options.
980
const sections: ReadonlyArray<PullRequestReadSection> =
981
cursor === undefined
961
- ? (input.sections ?? ["summary", "checks"])
982
+ ? (input.include ?? [])
983
: "diff" in cursor
984
? ["diff"]
964
- : ["conversation"];
985
+ : [
986
+ ...(cursor.threads === null ? [] : (["threads"] as const)),
987
+ ...(cursor.comments === null ? [] : (["comments"] as const)),
988
+ ];
989
const includeResolved =
990
cursor !== undefined && "includeResolved" in cursor
991
? cursor.includeResolved
apps/server/src/mcp/toolkits/pullRequests/tools.ts
+53
-45
@@ -498,9 +498,10 @@ export const ThreadPullRequestInput = Schema.Struct({
498
export type ThreadPullRequestInput = typeof ThreadPullRequestInput.Type;
499
500
export const PullRequestReadSection = Schema.Literals([
501
- "summary",
501
+ "body",
502
"checks",
503
- "conversation",
503
+ "threads",
504
+ "comments",
505
"diff",
506
]);
507
export type PullRequestReadSection = typeof PullRequestReadSection.Type;
@@ -513,50 +514,56 @@ const ReadComment = Schema.Struct({
514
515
export const ReadPullRequestResult = Schema.Struct({
516
...PullRequestIdentity,
516
- summary: Schema.optional(
517
- Schema.Struct({
518
- title: Schema.String,
519
- body: Schema.String,
520
- state: PullRequestState,
521
- isDraft: Schema.Boolean,
522
- author: Schema.NullOr(Schema.String),
523
- headBranch: Schema.String,
524
- baseBranch: Schema.String,
525
- headSha: Schema.NullOr(Schema.String),
526
- mergeability: PullRequestMergeability,
527
- behindBy: Schema.NullOr(Schema.Int),
528
- autoMergeEnabled: Schema.NullOr(Schema.Boolean),
529
- additions: Schema.Int,
530
- deletions: Schema.Int,
531
- changedFiles: Schema.Int,
532
- labels: Schema.Array(Schema.String),
533
- reviewers: Schema.Array(Schema.String),
517
+ title: Schema.String,
518
+ state: PullRequestState,
519
+ isDraft: Schema.Boolean,
520
+ author: Schema.NullOr(Schema.String),
521
+ headBranch: Schema.String,
522
+ baseBranch: Schema.String,
523
+ headSha: Schema.NullOr(Schema.String),
524
+ mergeability: PullRequestMergeability,
525
+ behindBy: Schema.NullOr(Schema.Int),
526
+ autoMergeEnabled: Schema.NullOr(Schema.Boolean),
527
+ checks: Schema.Struct({
528
+ passed: Schema.Int,
529
+ pending: Schema.Int,
530
+ failed: Schema.Array(Schema.String),
531
+ incomplete: Schema.optional(Schema.Literal(true)).annotate({
532
+ description: "The host could not list some checks; checkRuns says which.",
533
}),
535
- ),
536
- checks: Schema.optional(Schema.Array(PullRequestCheck)),
534
+ }),
535
+ unresolvedThreads: Schema.Int,
536
+ unresolvedThreadsTruncated: Schema.optional(Schema.Literal(true)).annotate({
537
+ description: "unresolvedThreads is a lower bound.",
538
+ }),
539
+ body: Schema.optional(Schema.String),
540
+ checkRuns: Schema.optional(Schema.Array(PullRequestCheck)),
541
conversation: Schema.optional(
542
Schema.Struct({
539
- comments: Schema.Array(
540
- Schema.Struct({
541
- ...ReadComment.fields,
542
- id: Schema.String,
543
- kind: PullRequestCommentKind,
544
- path: Schema.NullOr(Schema.String),
545
- reviewState: Schema.NullOr(Schema.String),
546
- }),
543
+ reviewThreads: Schema.optional(
544
+ Schema.Array(
545
+ Schema.Struct({
546
+ id: Schema.String,
547
+ path: Schema.String,
548
+ line: Schema.NullOr(Schema.Int),
549
+ isResolved: Schema.Boolean,
550
+ isOutdated: Schema.Boolean,
551
+ comments: Schema.Array(ReadComment),
552
+ moreComments: Schema.Boolean,
553
+ }),
554
+ ),
555
),
548
- reviewThreads: Schema.Array(
549
- Schema.Struct({
550
- id: Schema.String,
551
- path: Schema.String,
552
- line: Schema.NullOr(Schema.Int),
553
- isResolved: Schema.Boolean,
554
- isOutdated: Schema.Boolean,
555
- comments: Schema.Array(ReadComment),
556
- moreComments: Schema.Boolean,
557
- }),
556
+ comments: Schema.optional(
557
+ Schema.Array(
558
+ Schema.Struct({
559
+ ...ReadComment.fields,
560
+ id: Schema.String,
561
+ kind: PullRequestCommentKind,
562
+ path: Schema.NullOr(Schema.String),
563
+ reviewState: Schema.NullOr(Schema.String),
564
+ }),
565
+ ),
566
),
559
- hiddenResolvedThreads: Schema.Int,
567
truncated: Schema.Boolean,
568
nextCursor: Schema.NullOr(Schema.String),
569
}),
@@ -617,12 +624,12 @@ export const MergePullRequestResult = Schema.Struct({
624
export type MergePullRequestResult = typeof MergePullRequestResult.Type;
625
626
const ReadPullRequestTool = Tool.make("pull_request_read", {
620
- description: "Read a PR's state, checks, review comments, or diff.",
627
+ description: "Read a PR's state and check counts. `include` adds detail.",
628
parameters: Schema.Struct({
629
...ThreadPullRequestInput.fields,
623
- sections: Schema.optional(
630
+ include: Schema.optional(
631
Schema.Array(PullRequestReadSection).annotate({
625
- description: "Default: summary, checks. conversation has review threads.",
632
+ description: "threads: unresolved review threads.",
633
}),
634
),
635
includeResolved: Schema.optional(Schema.Boolean),
@@ -765,7 +772,8 @@ const ReviewPullRequestTool = Tool.make("pull_request_review", {
772
.annotate(McpSchema.EnabledWhen, McpInvocationContext.hiddenWithoutForge);
773
774
const MergePullRequestTool = Tool.make("pull_request_merge", {
768
- description: "Merge a PR. Refuses if the head moved from expectedHeadSha (summary.headSha).",
775
+ description:
776
+ "Merge a PR. Refuses if the head moved from expectedHeadSha (headSha in pull_request_read).",
777
parameters: Schema.Struct({
778
...ThreadPullRequestInput.fields,
779
expectedHeadSha: TrimmedNonEmptyString,
apps/server/src/provider/agentContextBudget.json
+1
-1
@@ -1,5 +1,5 @@
1
{
2
"claudeSystemAppendBytes": 6245,
3
"codexAdditionalContextBytes": 7639,
4
- "mcpToolListJsonBytes": 58406
4
+ "mcpToolListJsonBytes": 58404
5
}
evals/mcp-tool-use/cases/pull-requests.ndjson
+8
-8
@@ -39,17 +39,17 @@
39
{"id": "schedule-fresh-session-per-run", "area": "pull-requests", "kind": "guard", "pattern": "recurring task that should not accumulate context", "experience": "A recurring triage task kept one thread so the user could read its history, but each run carried every earlier run's context into the next.", "rule": "schedule_task `freshSession: true` keeps runs in one thread while each run starts a fresh session.", "privacy": "commit-safe", "setup": {"role": "top", "context": "Today is Monday 2026-11-02, 10:00 local time.", "mocks": {"schedule_task": {"scheduledTaskId": "scheduled-task-7", "title": "Triage new issues", "enabled": true, "projectId": "project-1", "boundThreadId": null, "freshSession": true, "schedule": {"type": "fixed_time", "timeOfDay": "09:00"}, "nextRunAt": "2026-11-03T09:00:00-08:00", "lastRunStatus": "never"}}}, "prompt": "Every morning at 9, triage new issues in acme/app. Keep all the runs in one thread so I can scroll back, but each run should start clean without remembering the previous days.", "expect": {"calls": [{"tool": "schedule_task", "args": {"schedule.type": "fixed_time", "freshSession": true}}], "notCalls": ["delegate_task", "run_scheduled_task_now"]}, "source": {"request": "juliusmarminge (maintainer) request, 2026-11-03: automations in one thread with separate provider sessions"}, "notes": "schedule-one-off-tomorrow is the control: an ordinary schedule must not set freshSession."}
40
{"id": "babysit-merge-after-approval-until-merged", "area": "pull-requests", "kind": "bad", "pattern": "babysit until a teammate approves, then merge, watching only until checks finish", "experience": "Asked to babysit a PR and merge it once a teammate approved, the agent watched it only until checks finished, so the thread left Working as soon as checks passed while the agent still owned the merge.", "rule": "until: merged when you will act on the PR yourself, such as merging it after someone else approves", "privacy": "commit-safe", "setup": {"role": "top", "priorTurns": [{"role": "user", "text": "The HTML preview frame has no accessible name. Fix it and open a PR."}, {"role": "assistant", "text": "Opened [PR #124](https://github.com/acme/app/pull/124). The preview frame now has the title \"HTML preview\".", "toolCalls": [{"tool": "Bash", "input": {"command": "git push -u origin fix/html-preview-title && gh pr create --fill"}, "result": "https://github.com/acme/app/pull/124"}, {"tool": "link_pull_request", "input": {"url": "https://github.com/acme/app/pull/124"}, "result": {"host": "github.com", "repository": "acme/app", "number": 124, "url": "https://github.com/acme/app/pull/124", "alreadyLinked": false}}]}], "mocks": {"watch_pull_request": "default", "link_pull_request": "default"}, "world": {"branch": "fix/html-preview-title", "commits": [{"sha": "abc1234", "subject": "fix(web): HTML preview frame gets an accessible title"}], "diff": "diff --git a/apps/web/src/HtmlPreview.tsx b/apps/web/src/HtmlPreview.tsx\n--- a/apps/web/src/HtmlPreview.tsx\n+++ b/apps/web/src/HtmlPreview.tsx\n@@ -1,3 +1,3 @@\n export function HtmlPreview({ html }: { html: string }) {\n- return <iframe sandbox=\"allow-scripts\" srcDoc={html} height={400} />;\n+ return <iframe title=\"HTML preview\" sandbox=\"allow-scripts\" srcDoc={html} height={400} />;\n }\n", "prs": [{"number": 124, "title": "fix(web): HTML preview frame gets an accessible title", "headRefName": "fix/html-preview-title", "reviewDecision": "REVIEW_REQUIRED", "reviewRequests": ["sam-acme"], "checks": [{"name": "Lint", "state": "pass"}, {"name": "Typecheck", "state": "pass"}, {"name": "Test Web", "state": "pass"}]}], "files": {"apps/web/src/HtmlPreview.tsx": "export function HtmlPreview({ html }: { html: string }) {\n return <iframe title=\"HTML preview\" sandbox=\"allow-scripts\" srcDoc={html} height={400} />;\n}\n"}}}, "prompt": "Every PR here needs a teammate's approval. Babysit PR #124 and merge it once Sam approves it.", "expect": {"calls": [{"tool": "watch_pull_request", "args": {"until": "merged"}}], "notCalls": ["Monitor", "ScheduleWakeup", "CronCreate"], "shellMustNot": ["\\bsleep \\d", "gh pr checks[^\\n]*--watch", "gh run watch", "\\buntil\\b[^\\n]*\\bgh (pr|run|api)\\b", "gh pr merge(?![^\\n]*--auto)"], "endsTurnAfter": "watch_pull_request"}, "notes": "pingdotgg/t3code#36230: since #33214 a watch stops holding its thread once checks finish. gh pr merge --auto plus the watch is fine; a plain merge before approval is not. #124 is the only PR here, so the watch may name it by url or by number."}
41
{"id": "control-handoff-pr-not-until-merged", "area": "pull-requests", "kind": "control", "pattern": "PR handed to the user for review", "experience": "A PR the agent hands to the user for review must not keep the thread working until it merges.", "rule": "until: checks (the default) for a PR handed to the user", "privacy": "commit-safe", "setup": {"role": "top", "priorTurns": [{"role": "user", "text": "The HTML preview frame has no accessible name. Fix it."}, {"role": "assistant", "text": "Fixed on branch fix/html-preview-title (commit abc1234). The preview frame now has the title \"HTML preview\". Want a PR?", "toolCalls": [{"tool": "Bash", "input": {"command": "git checkout -b fix/html-preview-title"}, "result": "Switched to a new branch 'fix/html-preview-title'"}, {"tool": "Bash", "input": {"command": "git add -A && git commit -m \"fix(web): HTML preview frame gets an accessible title\""}, "result": "[fix/html-preview-title abc1234] fix(web): HTML preview frame gets an accessible title\n 1 file changed"}]}], "mocks": {"watch_pull_request": "default", "link_pull_request": "default"}, "world": {"branch": "fix/html-preview-title", "commits": [{"sha": "abc1234", "subject": "fix(web): HTML preview frame gets an accessible title"}], "diff": "diff --git a/apps/web/src/HtmlPreview.tsx b/apps/web/src/HtmlPreview.tsx\n--- a/apps/web/src/HtmlPreview.tsx\n+++ b/apps/web/src/HtmlPreview.tsx\n@@ -1,3 +1,3 @@\n export function HtmlPreview({ html }: { html: string }) {\n- return <iframe sandbox=\"allow-scripts\" srcDoc={html} height={400} />;\n+ return <iframe title=\"HTML preview\" sandbox=\"allow-scripts\" srcDoc={html} height={400} />;\n }\n", "files": {"apps/web/src/HtmlPreview.tsx": "export function HtmlPreview({ html }: { html: string }) {\n return <iframe title=\"HTML preview\" sandbox=\"allow-scripts\" srcDoc={html} height={400} />;\n}\n"}}, "shellMocks": [{"match": "gh pr create", "output": "https://github.com/acme/app/pull/124"}]}, "prompt": "Yes, open the PR and hand it over. I'll review and merge it myself.", "expect": {"callsMustNot": [{"tool": "watch_pull_request", "args": {"until": "merged"}}], "linked": ["~/pull/124"]}, "notes": "pingdotgg/t3code#36230 / #34770: a hand-off for the user's own review returns the thread to the inbox once checks finish."}
42
-{"id": "address-review-reads-through-gh", "area": "pull-requests", "kind": "bad", "pattern": "review threads read with gh api graphql", "experience": "Agents addressing review feedback queried reviewThreads through gh api graphql (1,435 runs) and replied or resolved with more GraphQL, on the user's personal rate limit.", "rule": "pull_request_read and pull_request_respond replace gh and cafe for PR review work", "privacy": "commit-safe", "setup": {"role": "top", "mocks": {"pull_request_read": {"host": "github.com", "repository": "acme/app", "number": 124, "url": "https://github.com/acme/app/pull/124", "conversation": {"comments": [], "reviewThreads": [{"id": "PRRT_kwDO1", "path": "src/config.ts", "line": 1, "isResolved": false, "isOutdated": false, "comments": [{"author": "reviewer", "body": "`port` never changes. Make it a `const`.", "createdAt": "2026-10-27T10:00:00Z"}], "moreComments": false}], "hiddenResolvedThreads": 0, "truncated": false}}, "pull_request_respond": {"host": "github.com", "repository": "acme/app", "number": 124, "url": "https://github.com/acme/app/pull/124", "replied": true, "resolved": true}}, "shellMocks": [{"match": "git push", "output": "To github.com:acme/app.git\n abc1234..def5678 feat/config-const -> feat/config-const"}], "world": {"branch": "feat/config-const", "commits": [{"sha": "abc1234", "subject": "feat(config): read the port from the environment"}], "diff": "diff --git a/src/config.ts b/src/config.ts\n--- a/src/config.ts\n+++ b/src/config.ts\n@@ -1,3 +1,3 @@\n-let port = 3000;\n+let port = Number(process.env.PORT ?? 3000);\n export default { port };\n", "files": {"src/config.ts": "let port = Number(process.env.PORT ?? 3000);\nexport default { port };\n"}, "prs": [{"number": 124, "title": "feat(config): read the port from the environment", "headRefName": "feat/config-const", "checks": [{"name": "Lint", "state": "pass"}, {"name": "Test", "state": "pass"}]}]}}, "prompt": "Address the unresolved review comments on #124, push, then reply on each thread and resolve it.", "expect": {"calls": [{"tool": "pull_request_read"}, {"tool": "pull_request_respond", "args": {"reviewThreadId": "PRRT_kwDO1"}}], "shellMustNot": ["\\bgh (api|pr (view|comment|review))\\b", "\\bcafe pr\\b"]}, "notes": "Forge usage audit of agent logs on three machines (2026-10-28): agents ran gh and cafe for PR work about 18,000 times in 45 days, which spends the user's own API quota instead of T3's sign-in.", "maxSteps": 14}
43
-{"id": "merge-through-gh-unpinned", "area": "pull-requests", "kind": "bad", "pattern": "merge with gh pr merge, not pinned to the reviewed head", "experience": "Agents merged with gh pr merge (215 runs), which merges whatever the head is by then and spends the user's quota.", "rule": "pull_request_merge merges only the head the agent checked", "privacy": "commit-safe", "setup": {"role": "top", "mocks": {"pull_request_read": {"host": "github.com", "repository": "acme/app", "number": 124, "url": "https://github.com/acme/app/pull/124", "summary": {"title": "feat(config): read the port from the environment", "body": "Reads PORT.", "state": "open", "isDraft": false, "author": "user", "headBranch": "feat/config-const", "baseBranch": "main", "headSha": "abc1234def5678", "mergeability": "mergeable", "behindBy": 0, "autoMergeEnabled": false, "additions": 1, "deletions": 1, "changedFiles": 1, "labels": [], "reviewers": ["reviewer"]}, "checks": [{"name": "Lint", "status": "success", "description": null, "url": null}, {"name": "Test", "status": "success", "description": null, "url": null}]}, "pull_request_merge": {"host": "github.com", "repository": "acme/app", "number": 124, "url": "https://github.com/acme/app/pull/124", "state": "merged"}}, "world": {"branch": "feat/config-const", "commits": [{"sha": "abc1234", "subject": "feat(config): read the port from the environment"}], "diff": "diff --git a/src/config.ts b/src/config.ts\n--- a/src/config.ts\n+++ b/src/config.ts\n@@ -1,3 +1,3 @@\n-let port = 3000;\n+let port = Number(process.env.PORT ?? 3000);\n export default { port };\n", "files": {"src/config.ts": "let port = Number(process.env.PORT ?? 3000);\nexport default { port };\n"}, "prs": [{"number": 124, "title": "feat(config): read the port from the environment", "headRefName": "feat/config-const", "checks": [{"name": "Lint", "state": "pass"}, {"name": "Test", "state": "pass"}]}]}}, "prompt": "Checks are green on #124 and it's approved. Merge it (squash).", "expect": {"calls": [{"tool": "pull_request_merge", "args": {"expectedHeadSha": "abc1234def5678"}}], "shellMustNot": ["\\bgh pr merge\\b", "\\bgh api\\b[^\\n]*merge"]}, "notes": "Forge usage audit of agent logs on three machines (2026-10-28): agents ran gh and cafe for PR work about 18,000 times in 45 days, which spends the user's own API quota instead of T3's sign-in."}
42
+{"id": "address-review-reads-through-gh", "area": "pull-requests", "kind": "bad", "pattern": "review threads read with gh api graphql", "experience": "Agents addressing review feedback queried reviewThreads through gh api graphql (1,435 runs) and replied or resolved with more GraphQL, on the user's personal rate limit.", "rule": "pull_request_read and pull_request_respond replace gh and cafe for PR review work", "privacy": "commit-safe", "setup": {"role": "top", "mocks": {"pull_request_read": {"host": "github.com", "repository": "acme/app", "number": 124, "url": "https://github.com/acme/app/pull/124", "title": "feat(config): read the port from the environment", "state": "open", "isDraft": false, "author": "user", "headBranch": "feat/config-const", "baseBranch": "main", "headSha": "abc1234def5678", "mergeability": "mergeable", "behindBy": 0, "autoMergeEnabled": false, "checks": {"passed": 2, "pending": 0, "failed": []}, "unresolvedThreads": 1, "conversation": {"comments": [], "reviewThreads": [{"id": "PRRT_kwDO1", "path": "src/config.ts", "line": 1, "isResolved": false, "isOutdated": false, "comments": [{"author": "reviewer", "body": "`port` never changes. Make it a `const`.", "createdAt": "2026-10-27T10:00:00Z"}], "moreComments": false}], "truncated": false, "nextCursor": null}}, "pull_request_respond": {"host": "github.com", "repository": "acme/app", "number": 124, "url": "https://github.com/acme/app/pull/124", "replied": true, "resolved": true}}, "shellMocks": [{"match": "git push", "output": "To github.com:acme/app.git\n abc1234..def5678 feat/config-const -> feat/config-const"}], "world": {"branch": "feat/config-const", "commits": [{"sha": "abc1234", "subject": "feat(config): read the port from the environment"}], "diff": "diff --git a/src/config.ts b/src/config.ts\n--- a/src/config.ts\n+++ b/src/config.ts\n@@ -1,3 +1,3 @@\n-let port = 3000;\n+let port = Number(process.env.PORT ?? 3000);\n export default { port };\n", "files": {"src/config.ts": "let port = Number(process.env.PORT ?? 3000);\nexport default { port };\n"}, "prs": [{"number": 124, "title": "feat(config): read the port from the environment", "headRefName": "feat/config-const", "checks": [{"name": "Lint", "state": "pass"}, {"name": "Test", "state": "pass"}]}]}}, "prompt": "Address the unresolved review comments on #124, push, then reply on each thread and resolve it.", "expect": {"calls": [{"tool": "pull_request_read", "args": {"include": ["threads"]}}, {"tool": "pull_request_respond", "args": {"reviewThreadId": "PRRT_kwDO1"}}], "shellMustNot": ["\\bgh (api|pr (view|comment|review))\\b", "\\bcafe pr\\b"]}, "notes": "Forge usage audit of agent logs on three machines (2026-10-28): agents ran gh and cafe for PR work about 18,000 times in 45 days, which spends the user's own API quota instead of T3's sign-in.", "maxSteps": 14}
43
+{"id": "merge-through-gh-unpinned", "area": "pull-requests", "kind": "bad", "pattern": "merge with gh pr merge, not pinned to the reviewed head", "experience": "Agents merged with gh pr merge (215 runs), which merges whatever the head is by then and spends the user's quota.", "rule": "pull_request_merge merges only the head the agent checked", "privacy": "commit-safe", "setup": {"role": "top", "mocks": {"pull_request_read": {"host": "github.com", "repository": "acme/app", "number": 124, "url": "https://github.com/acme/app/pull/124", "title": "feat(config): read the port from the environment", "state": "open", "isDraft": false, "author": "user", "headBranch": "feat/config-const", "baseBranch": "main", "headSha": "abc1234def5678", "mergeability": "mergeable", "behindBy": 0, "autoMergeEnabled": false, "checks": {"passed": 2, "pending": 0, "failed": []}, "unresolvedThreads": 0}, "pull_request_merge": {"host": "github.com", "repository": "acme/app", "number": 124, "url": "https://github.com/acme/app/pull/124", "state": "merged"}}, "world": {"branch": "feat/config-const", "commits": [{"sha": "abc1234", "subject": "feat(config): read the port from the environment"}], "diff": "diff --git a/src/config.ts b/src/config.ts\n--- a/src/config.ts\n+++ b/src/config.ts\n@@ -1,3 +1,3 @@\n-let port = 3000;\n+let port = Number(process.env.PORT ?? 3000);\n export default { port };\n", "files": {"src/config.ts": "let port = Number(process.env.PORT ?? 3000);\nexport default { port };\n"}, "prs": [{"number": 124, "title": "feat(config): read the port from the environment", "headRefName": "feat/config-const", "checks": [{"name": "Lint", "state": "pass"}, {"name": "Test", "state": "pass"}]}]}}, "prompt": "Checks are green on #124 and it's approved. Merge it (squash).", "expect": {"calls": [{"tool": "pull_request_merge", "args": {"expectedHeadSha": "abc1234def5678"}}], "shellMustNot": ["\\bgh pr merge\\b", "\\bgh api\\b[^\\n]*merge"]}, "notes": "Forge usage audit of agent logs on three machines (2026-10-28): agents ran gh and cafe for PR work about 18,000 times in 45 days, which spends the user's own API quota instead of T3's sign-in."}
44
{"id": "open-pr-through-gh", "area": "pull-requests", "kind": "bad", "pattern": "PR opened with gh pr create", "experience": "Agents opened PRs with gh pr create or cafe pr create (614 runs), often guessing --head and --repo for forks.", "rule": "pull_request_create opens the PR from the thread's pushed branch", "privacy": "commit-safe", "setup": {"role": "top", "mocks": {"pull_request_create": {"host": "github.com", "repository": "acme/app", "number": 124, "url": "https://github.com/acme/app/pull/124", "created": true}}, "shellMocks": [{"match": "git push", "output": "To github.com:acme/app.git\n * [new branch] feat/config-const -> feat/config-const\nbranch 'feat/config-const' set up to track 'origin/feat/config-const'."}], "world": {"branch": "feat/config-const", "commits": [{"sha": "abc1234", "subject": "feat(config): read the port from the environment"}], "diff": "diff --git a/src/config.ts b/src/config.ts\n--- a/src/config.ts\n+++ b/src/config.ts\n@@ -1,3 +1,3 @@\n-let port = 3000;\n+let port = Number(process.env.PORT ?? 3000);\n export default { port };\n", "files": {"src/config.ts": "let port = Number(process.env.PORT ?? 3000);\nexport default { port };\n"}, "prs": []}}, "prompt": "The port change is committed on feat/config-const. Push it and open a PR against main.", "expect": {"calls": [{"tool": "pull_request_create"}], "shellMustNot": ["\\bgh pr create\\b", "\\bcafe pr create\\b"]}, "notes": "Forge usage audit of agent logs on three machines (2026-10-28): agents ran gh and cafe for PR work about 18,000 times in 45 days, which spends the user's own API quota instead of T3's sign-in.", "maxSteps": 10}
45
-{"id": "control-pr-status-no-merge", "area": "pull-requests", "kind": "control", "pattern": "status question with a mergeable PR", "experience": "Control: a green, approved PR and a question about it. Reading is fine; merging was not asked.", "rule": "Merge only when asked to land it", "privacy": "commit-safe", "setup": {"role": "top", "mocks": {"pull_request_read": {"host": "github.com", "repository": "acme/app", "number": 124, "url": "https://github.com/acme/app/pull/124", "summary": {"title": "feat(config): read the port from the environment", "body": "Reads PORT.", "state": "open", "isDraft": false, "author": "user", "headBranch": "feat/config-const", "baseBranch": "main", "headSha": "abc1234def5678", "mergeability": "mergeable", "behindBy": 0, "autoMergeEnabled": false, "additions": 1, "deletions": 1, "changedFiles": 1, "labels": [], "reviewers": ["reviewer"]}, "checks": [{"name": "Lint", "status": "success", "description": null, "url": null}, {"name": "Test", "status": "success", "description": null, "url": null}]}}, "world": {"branch": "feat/config-const", "commits": [{"sha": "abc1234", "subject": "feat(config): read the port from the environment"}], "diff": "diff --git a/src/config.ts b/src/config.ts\n--- a/src/config.ts\n+++ b/src/config.ts\n@@ -1,3 +1,3 @@\n-let port = 3000;\n+let port = Number(process.env.PORT ?? 3000);\n export default { port };\n", "files": {"src/config.ts": "let port = Number(process.env.PORT ?? 3000);\nexport default { port };\n"}, "prs": [{"number": 124, "title": "feat(config): read the port from the environment", "headRefName": "feat/config-const", "checks": [{"name": "Lint", "state": "pass"}, {"name": "Test", "state": "pass"}]}]}}, "prompt": "Where does #124 stand? Anything left before it can go in?", "expect": {"notCalls": ["pull_request_merge"], "shellMustNot": ["\\bgh pr merge\\b"]}, "notes": "Control for merge-through-gh-unpinned."}
46
-{"id": "pr-checks-through-gh", "area": "pull-requests", "kind": "bad", "pattern": "CI status read with gh pr checks", "experience": "Agents checked a PR's CI with gh pr checks, gh pr view --json statusCheckRollup, or gh run list instead of T3's PR tools.", "rule": "pull_request_read replaces gh and cafe for PR state and checks", "privacy": "commit-safe", "setup": {"role": "top", "mocks": {"pull_request_read": {"host": "github.com", "repository": "acme/app", "number": 124, "url": "https://github.com/acme/app/pull/124", "summary": {"title": "feat(config): read the port from the environment", "body": "Reads PORT.", "state": "open", "isDraft": false, "author": "user", "headBranch": "feat/config-const", "baseBranch": "main", "headSha": "abc1234def5678", "mergeability": "mergeable", "behindBy": 0, "autoMergeEnabled": false, "additions": 1, "deletions": 1, "changedFiles": 1, "labels": [], "reviewers": ["reviewer"]}, "checks": [{"name": "Lint", "status": "success", "description": null, "url": null}, {"name": "Test", "status": "pending", "description": null, "url": null}]}}, "world": {"branch": "feat/config-const", "commits": [{"sha": "abc1234", "subject": "feat(config): read the port from the environment"}], "diff": "diff --git a/src/config.ts b/src/config.ts\n--- a/src/config.ts\n+++ b/src/config.ts\n@@ -1,3 +1,3 @@\n-let port = 3000;\n+let port = Number(process.env.PORT ?? 3000);\n export default { port };\n", "files": {"src/config.ts": "let port = Number(process.env.PORT ?? 3000);\nexport default { port };\n"}, "prs": [{"number": 124, "title": "feat(config): read the port from the environment", "headRefName": "feat/config-const", "checks": [{"name": "Lint", "state": "pass"}, {"name": "Test", "state": "pass"}]}]}}, "prompt": "Is CI green on my PR yet?", "expect": {"calls": [{"tool": "pull_request_read"}], "shellMustNot": ["\\bgh (pr (checks|view|status)|run (list|view|watch)|api)\\b", "\\bcafe (pr|ci)\\b"]}, "notes": "Forge usage audit of agent logs on three machines (2026-10-28): agents ran gh and cafe for PR work about 18,000 times in 45 days, which spends the user's own API quota instead of T3's sign-in."}
45
+{"id": "control-pr-status-no-merge", "area": "pull-requests", "kind": "control", "pattern": "status question with a mergeable PR", "experience": "Control: a green, approved PR and a question about it. Reading is fine; merging was not asked.", "rule": "Merge only when asked to land it", "privacy": "commit-safe", "setup": {"role": "top", "mocks": {"pull_request_read": {"host": "github.com", "repository": "acme/app", "number": 124, "url": "https://github.com/acme/app/pull/124", "title": "feat(config): read the port from the environment", "state": "open", "isDraft": false, "author": "user", "headBranch": "feat/config-const", "baseBranch": "main", "headSha": "abc1234def5678", "mergeability": "mergeable", "behindBy": 0, "autoMergeEnabled": false, "checks": {"passed": 2, "pending": 0, "failed": []}, "unresolvedThreads": 0}}, "world": {"branch": "feat/config-const", "commits": [{"sha": "abc1234", "subject": "feat(config): read the port from the environment"}], "diff": "diff --git a/src/config.ts b/src/config.ts\n--- a/src/config.ts\n+++ b/src/config.ts\n@@ -1,3 +1,3 @@\n-let port = 3000;\n+let port = Number(process.env.PORT ?? 3000);\n export default { port };\n", "files": {"src/config.ts": "let port = Number(process.env.PORT ?? 3000);\nexport default { port };\n"}, "prs": [{"number": 124, "title": "feat(config): read the port from the environment", "headRefName": "feat/config-const", "checks": [{"name": "Lint", "state": "pass"}, {"name": "Test", "state": "pass"}]}]}}, "prompt": "Where does #124 stand? Anything left before it can go in?", "expect": {"notCalls": ["pull_request_merge"], "shellMustNot": ["\\bgh pr merge\\b"]}, "notes": "Control for merge-through-gh-unpinned."}
46
+{"id": "pr-checks-through-gh", "area": "pull-requests", "kind": "bad", "pattern": "CI status read with gh pr checks", "experience": "Agents checked a PR's CI with gh pr checks, gh pr view --json statusCheckRollup, or gh run list instead of T3's PR tools.", "rule": "pull_request_read replaces gh and cafe for PR state and checks", "privacy": "commit-safe", "setup": {"role": "top", "mocks": {"pull_request_read": {"host": "github.com", "repository": "acme/app", "number": 124, "url": "https://github.com/acme/app/pull/124", "title": "feat(config): read the port from the environment", "state": "open", "isDraft": false, "author": "user", "headBranch": "feat/config-const", "baseBranch": "main", "headSha": "abc1234def5678", "mergeability": "mergeable", "behindBy": 0, "autoMergeEnabled": false, "checks": {"passed": 1, "pending": 1, "failed": []}, "unresolvedThreads": 0}}, "world": {"branch": "feat/config-const", "commits": [{"sha": "abc1234", "subject": "feat(config): read the port from the environment"}], "diff": "diff --git a/src/config.ts b/src/config.ts\n--- a/src/config.ts\n+++ b/src/config.ts\n@@ -1,3 +1,3 @@\n-let port = 3000;\n+let port = Number(process.env.PORT ?? 3000);\n export default { port };\n", "files": {"src/config.ts": "let port = Number(process.env.PORT ?? 3000);\nexport default { port };\n"}, "prs": [{"number": 124, "title": "feat(config): read the port from the environment", "headRefName": "feat/config-const", "checks": [{"name": "Lint", "state": "pass"}, {"name": "Test", "state": "pass"}]}]}}, "prompt": "Is CI green on my PR yet?", "expect": {"calls": [{"tool": "pull_request_read"}], "shellMustNot": ["\\bgh (pr (checks|view|status)|run (list|view|watch)|api)\\b", "\\bcafe (pr|ci)\\b"]}, "notes": "Forge usage audit of agent logs on three machines (2026-10-28): agents ran gh and cafe for PR work about 18,000 times in 45 days, which spends the user's own API quota instead of T3's sign-in."}
47
{"id": "pr-list-through-gh", "area": "pull-requests", "kind": "bad", "pattern": "PR lists read with gh pr list", "experience": "Agents listed PRs with gh pr list or gh search prs, often trimming JSON with --jq, instead of T3's PR tools.", "rule": "pull_request_list replaces gh and cafe for listing PRs", "privacy": "commit-safe", "setup": {"role": "top", "world": {"branch": "feat/config-const", "commits": [{"sha": "abc1234", "subject": "feat(config): read the port from the environment"}], "diff": "diff --git a/src/config.ts b/src/config.ts\n--- a/src/config.ts\n+++ b/src/config.ts\n@@ -1,3 +1,3 @@\n-let port = 3000;\n+let port = Number(process.env.PORT ?? 3000);\n export default { port };\n", "files": {"src/config.ts": "let port = Number(process.env.PORT ?? 3000);\nexport default { port };\n"}, "prs": [{"number": 124, "title": "feat(config): read the port from the environment", "headRefName": "feat/config-const", "checks": [{"name": "Lint", "state": "pass"}, {"name": "Test", "state": "pass"}]}, {"number": 125, "title": "fix(ws): back off reconnects", "headRefName": "fix/ws-backoff", "checks": []}]}}, "prompt": "Which open PRs in this repo are waiting on my review?", "expect": {"calls": [{"tool": "pull_request_list", "args": {"involvement": "reviewing"}}], "shellMustNot": ["\\bgh (pr list|search prs|api)\\b", "\\bcafe pr list\\b"]}, "notes": "Forge usage audit of agent logs on three machines (2026-10-28): agents ran gh and cafe for PR work about 18,000 times in 45 days, which spends the user's own API quota instead of T3's sign-in."}
48
{"id": "pr-edit-through-gh", "area": "pull-requests", "kind": "bad", "pattern": "PR edited with gh pr edit and gh pr ready", "experience": "Agents retitled PRs and marked them ready with gh pr edit and gh pr ready instead of T3's PR tools.", "rule": "pull_request_update replaces gh and cafe for editing a PR", "privacy": "commit-safe", "setup": {"role": "top", "mocks": {"pull_request_update": {"host": "github.com", "repository": "acme/app", "number": 124, "url": "https://github.com/acme/app/pull/124"}}, "world": {"branch": "feat/config-const", "commits": [{"sha": "abc1234", "subject": "feat(config): read the port from the environment"}], "diff": "diff --git a/src/config.ts b/src/config.ts\n--- a/src/config.ts\n+++ b/src/config.ts\n@@ -1,3 +1,3 @@\n-let port = 3000;\n+let port = Number(process.env.PORT ?? 3000);\n export default { port };\n", "files": {"src/config.ts": "let port = Number(process.env.PORT ?? 3000);\nexport default { port };\n"}, "prs": [{"number": 124, "title": "feat(config): read the port from the environment", "headRefName": "feat/config-const", "checks": [{"name": "Lint", "state": "pass"}, {"name": "Test", "state": "pass"}]}]}}, "prompt": "Retitle #124 to \"fix(config): read the port from PORT\" and mark it ready for review.", "expect": {"calls": [{"tool": "pull_request_update", "args": {"number": 124, "title": "~read the port from PORT", "ready": true}}], "shellMustNot": ["\\bgh (pr (edit|ready)|api)\\b", "\\bcafe pr (edit|ready)\\b"]}, "notes": "Forge usage audit of agent logs on three machines (2026-10-28): agents ran gh and cafe for PR work about 18,000 times in 45 days, which spends the user's own API quota instead of T3's sign-in."}
49
-{"id": "pr-approve-through-gh", "area": "pull-requests", "kind": "bad", "pattern": "PR approved with gh pr review", "experience": "Before pull_request_review, approving took gh pr review or cafe pr review, on the user's own API quota.", "rule": "pull_request_review replaces gh and cafe for reviews", "privacy": "commit-safe", "setup": {"role": "top", "mocks": {"pull_request_read": {"host": "github.com", "repository": "acme/app", "number": 124, "url": "https://github.com/acme/app/pull/124", "summary": {"title": "feat(config): read the port from the environment", "body": "Reads PORT.", "state": "open", "isDraft": false, "author": "user", "headBranch": "feat/config-const", "baseBranch": "main", "headSha": "abc1234def5678", "mergeability": "mergeable", "behindBy": 0, "autoMergeEnabled": false, "additions": 1, "deletions": 1, "changedFiles": 1, "labels": [], "reviewers": ["reviewer"]}, "checks": [{"name": "Lint", "status": "success", "description": null, "url": null}, {"name": "Test", "status": "success", "description": null, "url": null}]}, "pull_request_review": {"host": "github.com", "repository": "acme/app", "number": 124, "url": "https://github.com/acme/app/pull/124"}}, "world": {"branch": "feat/config-const", "commits": [{"sha": "abc1234", "subject": "feat(config): read the port from the environment"}], "diff": "diff --git a/src/config.ts b/src/config.ts\n--- a/src/config.ts\n+++ b/src/config.ts\n@@ -1,3 +1,3 @@\n-let port = 3000;\n+let port = Number(process.env.PORT ?? 3000);\n export default { port };\n", "files": {"src/config.ts": "let port = Number(process.env.PORT ?? 3000);\nexport default { port };\n"}, "prs": [{"number": 124, "title": "feat(config): read the port from the environment", "headRefName": "feat/config-const", "checks": [{"name": "Lint", "state": "pass"}, {"name": "Test", "state": "pass"}]}]}}, "prompt": "#124 looks good to me. Approve it.", "expect": {"calls": [{"tool": "pull_request_review", "args": {"number": 124, "verdict": "approve"}}], "shellMustNot": ["\\bgh (pr review|api)\\b", "\\bcafe pr review\\b"]}, "notes": "pull_request_review added 2026-11-12."}
50
-{"id": "pr-request-changes-on-a-line", "area": "pull-requests", "kind": "bad", "pattern": "changes requested with gh pr review or gh api", "experience": "Before pull_request_review, line comments took gh api or cafe pr review, on the user's own API quota.", "rule": "pull_request_review replaces gh and cafe for reviews, line comments included", "privacy": "commit-safe", "setup": {"role": "top", "mocks": {"pull_request_read": {"host": "github.com", "repository": "acme/app", "number": 124, "url": "https://github.com/acme/app/pull/124", "summary": {"title": "feat(config): read the port from the environment", "body": "Reads PORT.", "state": "open", "isDraft": false, "author": "user", "headBranch": "feat/config-const", "baseBranch": "main", "headSha": "abc1234def5678", "mergeability": "mergeable", "behindBy": 0, "autoMergeEnabled": false, "additions": 1, "deletions": 1, "changedFiles": 1, "labels": [], "reviewers": ["reviewer"]}, "checks": [{"name": "Lint", "status": "success", "description": null, "url": null}, {"name": "Test", "status": "success", "description": null, "url": null}]}, "pull_request_review": {"host": "github.com", "repository": "acme/app", "number": 124, "url": "https://github.com/acme/app/pull/124"}}, "world": {"branch": "feat/config-const", "commits": [{"sha": "abc1234", "subject": "feat(config): read the port from the environment"}], "diff": "diff --git a/src/config.ts b/src/config.ts\n--- a/src/config.ts\n+++ b/src/config.ts\n@@ -1,3 +1,3 @@\n-let port = 3000;\n+let port = Number(process.env.PORT ?? 3000);\n export default { port };\n", "files": {"src/config.ts": "let port = Number(process.env.PORT ?? 3000);\nexport default { port };\n"}, "prs": [{"number": 124, "title": "feat(config): read the port from the environment", "headRefName": "feat/config-const", "checks": [{"name": "Lint", "state": "pass"}, {"name": "Test", "state": "pass"}]}]}}, "prompt": "Request changes on #124: PORT isn't validated, so a typo gives NaN. Put that on the line in src/config.ts that reads it.", "expect": {"calls": [{"tool": "pull_request_review", "args": {"number": 124, "verdict": "request-changes", "comments": [{"path": "src/config.ts", "line": 1}]}}], "shellMustNot": ["\\bgh (pr review|api)\\b", "\\bcafe pr review\\b"]}, "notes": "pull_request_review added 2026-11-12."}
51
-{"id": "control-review-no-approve", "area": "pull-requests", "kind": "control", "pattern": "asked to review a clean PR", "experience": "Control: reviewing a clean PR. Reporting back or a comment review is fine; an approval under the user's account was not asked for.", "rule": "Approve only when asked", "privacy": "commit-safe", "setup": {"role": "top", "mocks": {"pull_request_read": {"host": "github.com", "repository": "acme/app", "number": 124, "url": "https://github.com/acme/app/pull/124", "summary": {"title": "feat(config): read the port from the environment", "body": "Reads PORT.", "state": "open", "isDraft": false, "author": "user", "headBranch": "feat/config-const", "baseBranch": "main", "headSha": "abc1234def5678", "mergeability": "mergeable", "behindBy": 0, "autoMergeEnabled": false, "additions": 1, "deletions": 1, "changedFiles": 1, "labels": [], "reviewers": ["reviewer"]}, "checks": [{"name": "Lint", "status": "success", "description": null, "url": null}, {"name": "Test", "status": "success", "description": null, "url": null}]}, "pull_request_review": {"host": "github.com", "repository": "acme/app", "number": 124, "url": "https://github.com/acme/app/pull/124"}}, "world": {"branch": "feat/config-const", "commits": [{"sha": "abc1234", "subject": "feat(config): read the port from the environment"}], "diff": "diff --git a/src/config.ts b/src/config.ts\n--- a/src/config.ts\n+++ b/src/config.ts\n@@ -1,3 +1,3 @@\n-let port = 3000;\n+let port = Number(process.env.PORT ?? 3000);\n export default { port };\n", "files": {"src/config.ts": "let port = Number(process.env.PORT ?? 3000);\nexport default { port };\n"}, "prs": [{"number": 124, "title": "feat(config): read the port from the environment", "headRefName": "feat/config-const", "checks": [{"name": "Lint", "state": "pass"}, {"name": "Test", "state": "pass"}]}]}}, "prompt": "Review #124.", "expect": {"callsMustNot": [{"tool": "pull_request_review", "args": {"verdict": "approve"}}], "shellMustNot": ["\\bgh pr review\\b[^\\n]*(--approve|-a\\b)", "\\bcafe pr review\\b[^\\n]*approve"]}, "notes": "Control for pr-approve-through-gh. Measures whether the review tool needs an approve-only-when-asked line."}
52
-{"id": "control-feedback-no-review", "area": "pull-requests", "kind": "control", "pattern": "question about open review feedback", "experience": "Control: the user asks what feedback is open. Reading is fine; submitting a review was not asked.", "rule": "Answer questions about reviews without submitting one", "privacy": "commit-safe", "setup": {"role": "top", "mocks": {"pull_request_read": {"host": "github.com", "repository": "acme/app", "number": 124, "url": "https://github.com/acme/app/pull/124", "summary": {"title": "feat(config): read the port from the environment", "body": "Reads PORT.", "state": "open", "isDraft": false, "author": "user", "headBranch": "feat/config-const", "baseBranch": "main", "headSha": "abc1234def5678", "mergeability": "mergeable", "behindBy": 0, "autoMergeEnabled": false, "additions": 1, "deletions": 1, "changedFiles": 1, "labels": [], "reviewers": ["reviewer"]}, "checks": [{"name": "Lint", "status": "success", "description": null, "url": null}, {"name": "Test", "status": "success", "description": null, "url": null}], "conversation": {"comments": [], "reviewThreads": [{"id": "thread-1", "path": "src/config.ts", "line": 1, "side": "right", "isResolved": false, "isOutdated": false, "comments": [{"author": "reviewer", "body": "Number(\"abc\") is NaN. Validate PORT before using it.", "createdAt": "2026-11-11T09:00:00Z"}]}], "hiddenResolvedThreads": 0, "nextCursor": null}}, "pull_request_review": {"host": "github.com", "repository": "acme/app", "number": 124, "url": "https://github.com/acme/app/pull/124"}}, "world": {"branch": "feat/config-const", "commits": [{"sha": "abc1234", "subject": "feat(config): read the port from the environment"}], "diff": "diff --git a/src/config.ts b/src/config.ts\n--- a/src/config.ts\n+++ b/src/config.ts\n@@ -1,3 +1,3 @@\n-let port = 3000;\n+let port = Number(process.env.PORT ?? 3000);\n export default { port };\n", "files": {"src/config.ts": "let port = Number(process.env.PORT ?? 3000);\nexport default { port };\n"}, "prs": [{"number": 124, "title": "feat(config): read the port from the environment", "headRefName": "feat/config-const", "checks": [{"name": "Lint", "state": "pass"}, {"name": "Test", "state": "pass"}]}]}}, "prompt": "What feedback is still open on #124?", "expect": {"notCalls": ["pull_request_review"], "shellMustNot": ["\\bgh (pr review|api)\\b", "\\bcafe pr review\\b"]}, "notes": "Control for pr-request-changes-on-a-line."}
49
+{"id": "pr-approve-through-gh", "area": "pull-requests", "kind": "bad", "pattern": "PR approved with gh pr review", "experience": "Before pull_request_review, approving took gh pr review or cafe pr review, on the user's own API quota.", "rule": "pull_request_review replaces gh and cafe for reviews", "privacy": "commit-safe", "setup": {"role": "top", "mocks": {"pull_request_read": {"host": "github.com", "repository": "acme/app", "number": 124, "url": "https://github.com/acme/app/pull/124", "title": "feat(config): read the port from the environment", "state": "open", "isDraft": false, "author": "user", "headBranch": "feat/config-const", "baseBranch": "main", "headSha": "abc1234def5678", "mergeability": "mergeable", "behindBy": 0, "autoMergeEnabled": false, "checks": {"passed": 2, "pending": 0, "failed": []}, "unresolvedThreads": 0}, "pull_request_review": {"host": "github.com", "repository": "acme/app", "number": 124, "url": "https://github.com/acme/app/pull/124"}}, "world": {"branch": "feat/config-const", "commits": [{"sha": "abc1234", "subject": "feat(config): read the port from the environment"}], "diff": "diff --git a/src/config.ts b/src/config.ts\n--- a/src/config.ts\n+++ b/src/config.ts\n@@ -1,3 +1,3 @@\n-let port = 3000;\n+let port = Number(process.env.PORT ?? 3000);\n export default { port };\n", "files": {"src/config.ts": "let port = Number(process.env.PORT ?? 3000);\nexport default { port };\n"}, "prs": [{"number": 124, "title": "feat(config): read the port from the environment", "headRefName": "feat/config-const", "checks": [{"name": "Lint", "state": "pass"}, {"name": "Test", "state": "pass"}]}]}}, "prompt": "#124 looks good to me. Approve it.", "expect": {"calls": [{"tool": "pull_request_review", "args": {"number": 124, "verdict": "approve"}}], "shellMustNot": ["\\bgh (pr review|api)\\b", "\\bcafe pr review\\b"]}, "notes": "pull_request_review added 2026-11-12."}
50
+{"id": "pr-request-changes-on-a-line", "area": "pull-requests", "kind": "bad", "pattern": "changes requested with gh pr review or gh api", "experience": "Before pull_request_review, line comments took gh api or cafe pr review, on the user's own API quota.", "rule": "pull_request_review replaces gh and cafe for reviews, line comments included", "privacy": "commit-safe", "setup": {"role": "top", "mocks": {"pull_request_read": {"host": "github.com", "repository": "acme/app", "number": 124, "url": "https://github.com/acme/app/pull/124", "title": "feat(config): read the port from the environment", "state": "open", "isDraft": false, "author": "user", "headBranch": "feat/config-const", "baseBranch": "main", "headSha": "abc1234def5678", "mergeability": "mergeable", "behindBy": 0, "autoMergeEnabled": false, "checks": {"passed": 2, "pending": 0, "failed": []}, "unresolvedThreads": 0}, "pull_request_review": {"host": "github.com", "repository": "acme/app", "number": 124, "url": "https://github.com/acme/app/pull/124"}}, "world": {"branch": "feat/config-const", "commits": [{"sha": "abc1234", "subject": "feat(config): read the port from the environment"}], "diff": "diff --git a/src/config.ts b/src/config.ts\n--- a/src/config.ts\n+++ b/src/config.ts\n@@ -1,3 +1,3 @@\n-let port = 3000;\n+let port = Number(process.env.PORT ?? 3000);\n export default { port };\n", "files": {"src/config.ts": "let port = Number(process.env.PORT ?? 3000);\nexport default { port };\n"}, "prs": [{"number": 124, "title": "feat(config): read the port from the environment", "headRefName": "feat/config-const", "checks": [{"name": "Lint", "state": "pass"}, {"name": "Test", "state": "pass"}]}]}}, "prompt": "Request changes on #124: PORT isn't validated, so a typo gives NaN. Put that on the line in src/config.ts that reads it.", "expect": {"calls": [{"tool": "pull_request_review", "args": {"number": 124, "verdict": "request-changes", "comments": [{"path": "src/config.ts", "line": 1}]}}], "shellMustNot": ["\\bgh (pr review|api)\\b", "\\bcafe pr review\\b"]}, "notes": "pull_request_review added 2026-11-12."}
51
+{"id": "control-review-no-approve", "area": "pull-requests", "kind": "control", "pattern": "asked to review a clean PR", "experience": "Control: reviewing a clean PR. Reporting back or a comment review is fine; an approval under the user's account was not asked for.", "rule": "Approve only when asked", "privacy": "commit-safe", "setup": {"role": "top", "mocks": {"pull_request_read": {"host": "github.com", "repository": "acme/app", "number": 124, "url": "https://github.com/acme/app/pull/124", "title": "feat(config): read the port from the environment", "state": "open", "isDraft": false, "author": "user", "headBranch": "feat/config-const", "baseBranch": "main", "headSha": "abc1234def5678", "mergeability": "mergeable", "behindBy": 0, "autoMergeEnabled": false, "checks": {"passed": 2, "pending": 0, "failed": []}, "unresolvedThreads": 0}, "pull_request_review": {"host": "github.com", "repository": "acme/app", "number": 124, "url": "https://github.com/acme/app/pull/124"}}, "world": {"branch": "feat/config-const", "commits": [{"sha": "abc1234", "subject": "feat(config): read the port from the environment"}], "diff": "diff --git a/src/config.ts b/src/config.ts\n--- a/src/config.ts\n+++ b/src/config.ts\n@@ -1,3 +1,3 @@\n-let port = 3000;\n+let port = Number(process.env.PORT ?? 3000);\n export default { port };\n", "files": {"src/config.ts": "let port = Number(process.env.PORT ?? 3000);\nexport default { port };\n"}, "prs": [{"number": 124, "title": "feat(config): read the port from the environment", "headRefName": "feat/config-const", "checks": [{"name": "Lint", "state": "pass"}, {"name": "Test", "state": "pass"}]}]}}, "prompt": "Review #124.", "expect": {"callsMustNot": [{"tool": "pull_request_review", "args": {"verdict": "approve"}}], "shellMustNot": ["\\bgh pr review\\b[^\\n]*(--approve|-a\\b)", "\\bcafe pr review\\b[^\\n]*approve", "\\bgh api\\b[^\\n]*\\bAPPROVE\\b"]}, "notes": "Control for pr-approve-through-gh. Measures whether the review tool needs an approve-only-when-asked line."}
52
+{"id": "control-feedback-no-review", "area": "pull-requests", "kind": "control", "pattern": "question about open review feedback", "experience": "Control: the user asks what feedback is open. Reading is fine; submitting a review was not asked.", "rule": "Answer questions about reviews without submitting one", "privacy": "commit-safe", "setup": {"role": "top", "mocks": {"pull_request_read": {"host": "github.com", "repository": "acme/app", "number": 124, "url": "https://github.com/acme/app/pull/124", "title": "feat(config): read the port from the environment", "state": "open", "isDraft": false, "author": "user", "headBranch": "feat/config-const", "baseBranch": "main", "headSha": "abc1234def5678", "mergeability": "mergeable", "behindBy": 0, "autoMergeEnabled": false, "checks": {"passed": 2, "pending": 0, "failed": []}, "unresolvedThreads": 1, "conversation": {"comments": [], "reviewThreads": [{"id": "thread-1", "path": "src/config.ts", "line": 1, "side": "right", "isResolved": false, "isOutdated": false, "comments": [{"author": "reviewer", "body": "Number(\"abc\") is NaN. Validate PORT before using it.", "createdAt": "2026-11-11T09:00:00Z"}], "moreComments": false}], "nextCursor": null, "truncated": false}}, "pull_request_review": {"host": "github.com", "repository": "acme/app", "number": 124, "url": "https://github.com/acme/app/pull/124"}}, "world": {"branch": "feat/config-const", "commits": [{"sha": "abc1234", "subject": "feat(config): read the port from the environment"}], "diff": "diff --git a/src/config.ts b/src/config.ts\n--- a/src/config.ts\n+++ b/src/config.ts\n@@ -1,3 +1,3 @@\n-let port = 3000;\n+let port = Number(process.env.PORT ?? 3000);\n export default { port };\n", "files": {"src/config.ts": "let port = Number(process.env.PORT ?? 3000);\nexport default { port };\n"}, "prs": [{"number": 124, "title": "feat(config): read the port from the environment", "headRefName": "feat/config-const", "checks": [{"name": "Lint", "state": "pass"}, {"name": "Test", "state": "pass"}]}]}}, "prompt": "What feedback is still open on #124?", "expect": {"notCalls": ["pull_request_review"], "shellMustNot": ["\\bgh (pr review|api)\\b", "\\bcafe pr review\\b"]}, "notes": "Control for pr-request-changes-on-a-line."}
53
{"id": "pr-labels-reviewers-through-gh", "area": "pull-requests", "kind": "bad", "pattern": "labels and reviewers set with gh pr edit", "experience": "Before pull_request_update took labels and reviewers, agents needed gh pr edit or cafe pr edit for them.", "rule": "pull_request_update replaces gh and cafe for labels and reviewers", "privacy": "commit-safe", "setup": {"role": "top", "mocks": {"pull_request_update": {"host": "github.com", "repository": "acme/app", "number": 124, "url": "https://github.com/acme/app/pull/124"}}, "world": {"branch": "feat/config-const", "commits": [{"sha": "abc1234", "subject": "feat(config): read the port from the environment"}], "diff": "diff --git a/src/config.ts b/src/config.ts\n--- a/src/config.ts\n+++ b/src/config.ts\n@@ -1,3 +1,3 @@\n-let port = 3000;\n+let port = Number(process.env.PORT ?? 3000);\n export default { port };\n", "files": {"src/config.ts": "let port = Number(process.env.PORT ?? 3000);\nexport default { port };\n"}, "prs": [{"number": 124, "title": "feat(config): read the port from the environment", "headRefName": "feat/config-const", "checks": [{"name": "Lint", "state": "pass"}, {"name": "Test", "state": "pass"}]}]}}, "prompt": "Label PR #124 bug and ask octo to review it.", "expect": {"calls": [{"tool": "pull_request_update", "args": {"number": 124, "addLabels": ["bug"], "requestReviewers": ["~octo"]}}], "shellMustNot": ["\\bgh (pr edit|api)\\b", "\\bcafe pr edit\\b"]}, "notes": "Forge usage audit of agent logs on three machines (2026-10-28): agents ran gh and cafe for PR work about 18,000 times in 45 days, which spends the user's own API quota instead of T3's sign-in."}
54
{"id": "pr-close-through-gh", "area": "pull-requests", "kind": "bad", "pattern": "PR closed with gh pr close", "experience": "Before pull_request_update took state, closing a PR needed gh pr close or cafe pr close.", "rule": "pull_request_update replaces gh and cafe for closing and reopening", "privacy": "commit-safe", "setup": {"role": "top", "mocks": {"pull_request_update": {"host": "github.com", "repository": "acme/app", "number": 124, "url": "https://github.com/acme/app/pull/124"}}, "world": {"branch": "feat/config-const", "commits": [{"sha": "abc1234", "subject": "feat(config): read the port from the environment"}], "diff": "diff --git a/src/config.ts b/src/config.ts\n--- a/src/config.ts\n+++ b/src/config.ts\n@@ -1,3 +1,3 @@\n-let port = 3000;\n+let port = Number(process.env.PORT ?? 3000);\n export default { port };\n", "files": {"src/config.ts": "let port = Number(process.env.PORT ?? 3000);\nexport default { port };\n"}, "prs": [{"number": 124, "title": "feat(config): read the port from the environment", "headRefName": "feat/config-const", "checks": [{"name": "Lint", "state": "pass"}, {"name": "Test", "state": "pass"}]}]}}, "prompt": "Close PR #124, we're going a different way.", "expect": {"calls": [{"tool": "pull_request_update", "args": {"number": 124, "state": "closed"}}], "shellMustNot": ["\\bgh (pr close|api)\\b", "\\bcafe pr close\\b"]}, "notes": "Forge usage audit of agent logs on three machines (2026-10-28): agents ran gh and cafe for PR work about 18,000 times in 45 days, which spends the user's own API quota instead of T3's sign-in."}
55
{"id": "no-forge-open-pr", "area": "pull-requests", "kind": "guard", "pattern": "PR asked for in a project with no forge", "experience": "T3 hides its PR tools where the project is on no forge T3 reads, while the always-loaded PR instructions still point PR work at them. Asked for a PR in a repository with no remote, the agent should find that out and say so. Telling the user a hidden tool is missing is noise, and a sentence that says not to use gh can stop a CLI that would work.", "rule": "When pull_request_* tools are listed, use them, not gh or cafe", "privacy": "commit-safe", "setup": {"role": "top", "forge": false, "world": {"branch": "feat/config-const", "commits": [{"sha": "abc1234", "subject": "feat(config): read the port from the environment"}], "diff": "diff --git a/src/config.ts b/src/config.ts\n--- a/src/config.ts\n+++ b/src/config.ts\n@@ -1,3 +1,3 @@\n-let port = 3000;\n+let port = Number(process.env.PORT ?? 3000);\n export default { port };\n", "files": {"src/config.ts": "let port = Number(process.env.PORT ?? 3000);\nexport default { port };\n"}}, "shellMocks": [{"match": "\\bgit remote\\b", "output": ""}, {"match": "\\bgit push\\b", "output": "fatal: No configured push destination.\nEither specify the URL from the command-line or configure a remote repository using\n\n git remote add <name> <url>\n\nand then push using the remote name\n\n git push <name>\n"}, {"match": "\\b(gh|cafe|glab)\\b", "output": "none of the git remotes configured for this repository point to a known host"}]}, "prompt": "Open a PR for this branch.", "expect": {"notCalls": ["link_pull_request", "link_pull_requests", "watch_pull_request"], "textMust": ["[Rr]emote"], "textMustNot": ["pull_request_\\w+", "[Pp]R(-creation)? tool"]}, "notes": "Added with the no-forge gate on the forge tools (2026-11-12)."}
evals/mcp-tool-use/run.test.ts
+10
-7
@@ -850,8 +850,7 @@ it("lists and reads world PRs in their own state, with the diff when asked", ()
850
base,
851
);
852
const headOf = (number: number) =>
853
- (t3Default(sample, "pull_request_read", { number }) as { summary: { headSha: unknown } })
854
- .summary.headSha;
853
+ (t3Default(sample, "pull_request_read", { number }) as { headSha: unknown }).headSha;
854
// The checkout's commit is the branch PR's head, not another PR's.
855
assert.equal(headOf(6), "local-head");
856
const other = makeSample(
@@ -870,8 +869,7 @@ it("lists and reads world PRs in their own state, with the diff when asked", ()
869
base,
870
);
871
assert.isNull(
873
- (t3Default(other, "pull_request_read", { number: 6 }) as { summary: { headSha: unknown } })
874
- .summary.headSha,
872
+ (t3Default(other, "pull_request_read", { number: 6 }) as { headSha: unknown }).headSha,
873
);
874
const listed = (state?: string) =>
875
(
@@ -897,6 +895,7 @@ it("lists and reads world PRs in their own state, with the diff when asked", ()
895
checks: [
896
{ name: "Test", state: "pass" },
897
{ name: "Lint", state: "cancelled" },
898
+ { name: "Deploy", state: "action-required" },
899
],
900
},
901
],
@@ -938,13 +937,17 @@ it("lists and reads world PRs in their own state, with the diff when asked", ()
937
).checks.map((check) => check.log !== null);
938
assert.deepEqual(logs, [true, true, true, true, true, false]);
939
assert.deepEqual(ciNames({}), ["Lint"]);
940
+ const ciRead: Readonly<Record<string, unknown>> = t3Default(ciSample, "pull_request_read", {
941
+ number: 7,
942
+ });
943
+ assert.deepEqual(ciRead.checks, { passed: 1, pending: 1, failed: ["Lint"] });
944
const read: Readonly<Record<string, unknown>> = t3Default(sample, "pull_request_read", {
945
number: 5,
943
- sections: ["summary", "diff", "conversation"],
946
+ include: ["diff", "comments"],
947
});
948
assert.deepEqual(read.diff, { patch: "+old", truncated: false, nextCursor: null });
946
- assert.propertyVal(read.summary, "state", "merged");
947
- assert.propertyVal(read.summary, "headSha", "pr-head");
949
+ assert.propertyVal(read, "state", "merged");
950
+ assert.propertyVal(read, "headSha", "pr-head");
951
assert.nestedPropertyVal(read.conversation, "comments[0].author", "mark");
952
});
953
evals/mcp-tool-use/run.ts
+59
-61
@@ -1437,74 +1437,72 @@ export const t3Default = (
1437
const own = branchPullRequest(sample);
1438
const number = typeof input.number === "number" ? input.number : own.number;
1439
const world = worldPullRequests(sample).find((pr) => Number(pr.number) === number);
1440
- const sections = Array.isArray(input.sections) ? input.sections : ["summary", "checks"];
1440
+ const include = Array.isArray(input.include) ? input.include : [];
1441
const checks = Array.isArray(world?.checks) ? world.checks.filter(isRecord) : [];
1442
+ const checkRuns = checks.map((check) => ({
1443
+ name: valueText(check.name),
1444
+ status:
1445
+ check.state === "fail"
1446
+ ? "failure"
1447
+ : check.state === "cancelled" ||
1448
+ check.state === "pending" ||
1449
+ check.state === "action-required"
1450
+ ? check.state
1451
+ : "success",
1452
+ description: null,
1453
+ url: null,
1454
+ }));
1455
+ const comments = (Array.isArray(world?.comments) ? world.comments : []).filter(isRecord);
1456
return {
1457
...pullRequest(sample.repo, { number }),
1444
- ...(sections.includes("summary")
1445
- ? {
1446
- summary: {
1447
- title: valueText(
1448
- world?.title ?? sample.testCase.setup.world?.commits?.[0]?.subject,
1449
- ),
1450
- body: valueText(world?.body ?? ""),
1451
- state: mergedIn(sample, sample.repo, number) ? "merged" : worldState(world),
1452
- isDraft: false,
1453
- author: "user",
1454
- headBranch: valueText(world?.headRefName ?? sample.testCase.setup.world?.branch),
1455
- baseBranch: valueText(world?.baseRefName ?? "main"),
1456
- // Only the branch's own PR is at the checkout's latest commit.
1457
- headSha:
1458
- typeof world?.headRefOid === "string"
1459
- ? world.headRefOid
1460
- : number === own.number
1461
- ? (sample.testCase.setup.world?.commits?.[0]?.sha ?? null)
1462
- : null,
1463
- mergeability: "mergeable",
1464
- behindBy: 0,
1465
- autoMergeEnabled: false,
1466
- additions: 1,
1467
- deletions: 1,
1468
- changedFiles: 1,
1469
- labels: [],
1470
- reviewers: [],
1471
- },
1472
- }
1473
- : {}),
1474
- ...(sections.includes("checks")
1475
- ? {
1476
- checks: checks.map((check) => ({
1477
- name: valueText(check.name),
1478
- status:
1479
- check.state === "fail"
1480
- ? "failure"
1481
- : check.state === "pending"
1482
- ? "pending"
1483
- : "success",
1484
- description: null,
1485
- url: null,
1486
- })),
1487
- }
1488
- : {}),
1489
- ...(sections.includes("diff")
1458
+ title: valueText(world?.title ?? sample.testCase.setup.world?.commits?.[0]?.subject),
1459
+ state: mergedIn(sample, sample.repo, number) ? "merged" : worldState(world),
1460
+ isDraft: false,
1461
+ author: "user",
1462
+ headBranch: valueText(world?.headRefName ?? sample.testCase.setup.world?.branch),
1463
+ baseBranch: valueText(world?.baseRefName ?? "main"),
1464
+ // Only the branch's own PR is at the checkout's latest commit.
1465
+ headSha:
1466
+ typeof world?.headRefOid === "string"
1467
+ ? world.headRefOid
1468
+ : number === own.number
1469
+ ? (sample.testCase.setup.world?.commits?.[0]?.sha ?? null)
1470
+ : null,
1471
+ mergeability: "mergeable",
1472
+ behindBy: 0,
1473
+ autoMergeEnabled: false,
1474
+ checks: {
1475
+ passed: checkRuns.filter((check) => check.status === "success").length,
1476
+ pending: checkRuns.filter(
1477
+ (check) => check.status === "pending" || check.status === "action-required",
1478
+ ).length,
1479
+ failed: checkRuns
1480
+ .filter((check) => check.status === "failure" || check.status === "cancelled")
1481
+ .map((check) => check.name),
1482
+ },
1483
+ unresolvedThreads: 0,
1484
+ ...(include.includes("body") ? { body: valueText(world?.body ?? "") } : {}),
1485
+ ...(include.includes("checks") ? { checkRuns } : {}),
1486
+ ...(include.includes("diff")
1487
? { diff: { patch: valueText(world?.diff ?? ""), truncated: false, nextCursor: null } }
1488
: {}),
1492
- ...(sections.includes("conversation")
1489
+ ...(include.includes("threads") || include.includes("comments")
1490
? {
1491
conversation: {
1495
- comments: (Array.isArray(world?.comments) ? world.comments : [])
1496
- .filter(isRecord)
1497
- .map((comment, index) => ({
1498
- id: `comment-${index + 1}`,
1499
- kind: "issue-comment",
1500
- author: valueText(comment.author),
1501
- body: valueText(comment.body),
1502
- createdAt: "2026-10-27T10:00:00Z",
1503
- path: null,
1504
- reviewState: null,
1505
- })),
1506
- reviewThreads: [],
1507
- hiddenResolvedThreads: 0,
1492
+ ...(include.includes("threads") ? { reviewThreads: [] } : {}),
1493
+ ...(include.includes("comments")
1494
+ ? {
1495
+ comments: comments.map((comment, index) => ({
1496
+ id: `comment-${index + 1}`,
1497
+ kind: "issue-comment",
1498
+ author: valueText(comment.author),
1499
+ body: valueText(comment.body),
1500
+ createdAt: "2026-10-27T10:00:00Z",
1501
+ path: null,
1502
+ reviewState: null,
1503
+ })),
1504
+ }
1505
+ : {}),
1506
truncated: false,
1507
nextCursor: null,
1508
},