Skip to content

Commit 18f488f

Browse files
committed
Merge feat/dte-v2-1-dynamic-thinking-effort (53f22dc) into feat/dte-v2-2-per-request-effort
2 parents 82358bd + 53f22dc commit 18f488f

39 files changed

Lines changed: 930 additions & 50 deletions

‎.github/workflows/label-pr-review-state.yml‎

Lines changed: 47 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ name: Label PR review state
33
on:
44
schedule:
55
- cron: "0 * * * *" # hourly fallback
6+
push:
7+
branches: [main]
68
workflow_dispatch:
79
inputs:
810
pull_request_number:
@@ -27,7 +29,7 @@ permissions:
2729
# This privileged workflow only reads PR/check metadata and writes issue labels,
2830
# comments, and commit statuses. All unspecified permissions, including contents,
2931
# are none; no fork code or configuration is checked out or executed.
30-
pull-requests: read
32+
pull-requests: write
3133
issues: write
3234
checks: read
3335
statuses: write
@@ -83,6 +85,7 @@ jobs:
8385
const guideMarker = '<!-- zoo-code-pr-review-process -->';
8486
const codeRabbitLabelMarkerPrefix = '<!-- coderabbit-review-label:';
8587
const codeRabbitLogin = 'coderabbitai[bot]';
88+
const codeRabbitLogins = new Set([codeRabbitLogin, 'coderabbitai']);
8689
const codeRabbitActiveLabel = 'coderabbit-review-active';
8790
const reviewGateName = 'Zoo Code / PR review gate';
8891
const reconciliationCheckName = 'Zoo Code / reconcile PR review state';
@@ -95,7 +98,7 @@ jobs:
9598
}
9699
97100
// When triggered by a single PR event, only reconcile that PR.
98-
// The hourly schedule and workflow_dispatch reconcile all open PRs.
101+
// Main-branch pushes, the hourly schedule, and workflow_dispatch reconcile all open PRs.
99102
let prs;
100103
let eventPrNumbers = [];
101104
if (context.payload.pull_request?.number) {
@@ -180,6 +183,19 @@ jobs:
180183
}
181184
const currentLabels = new Set(pr.labels.map(l => l.name));
182185
const labelErrors = [];
186+
if (desiredLabel && !currentLabels.has(desiredLabel)) {
187+
try {
188+
await github.rest.issues.addLabels({
189+
owner, repo, issue_number: pr.number, labels: [desiredLabel],
190+
});
191+
currentLabels.add(desiredLabel);
192+
pr.labels.push({ name: desiredLabel });
193+
} catch (err) {
194+
const error = new Error(`Could not add desired label: ${err.message}`);
195+
error.preserveStateLabels = true;
196+
throw error;
197+
}
198+
}
183199
for (const label of stateLabels) {
184200
if (label !== desiredLabel && currentLabels.has(label)) {
185201
try {
@@ -198,17 +214,6 @@ jobs:
198214
}
199215
}
200216
}
201-
if (desiredLabel && !currentLabels.has(desiredLabel)) {
202-
try {
203-
await github.rest.issues.addLabels({
204-
owner, repo, issue_number: pr.number, labels: [desiredLabel],
205-
});
206-
currentLabels.add(desiredLabel);
207-
pr.labels.push({ name: desiredLabel });
208-
} catch (err) {
209-
labelErrors.push(err);
210-
}
211-
}
212217
if (desiredLabel !== 'awaiting-author' && currentLabels.has('stale-awaiting-author')) {
213218
try {
214219
await github.rest.issues.removeLabel({
@@ -328,6 +333,7 @@ jobs:
328333
conflict: 'Resolve the merge conflicts. The review sequence resumes after the branch is mergeable.',
329334
'ci-pending': 'Wait for required CI checks; awaiting-maintainer requires CI and automated review completion.',
330335
'ci-failed': 'Fix the failing required CI checks; awaiting-maintainer requires CI and automated review completion.',
336+
'mergeability-pending': 'Wait for GitHub to finish calculating mergeability.',
331337
'configuration-error': 'Repository rules must not require this advisory workflow\'s own gate or reconciliation job.',
332338
'coderabbit-changes': 'Address automated review findings and push fixes.',
333339
coderabbit: 'Required CI passed. Waiting for automated review of the latest commit.',
@@ -626,10 +632,11 @@ jobs:
626632
const latest = new Map();
627633
for (const r of reviews) {
628634
const reviewer = r.user.login.toLowerCase();
635+
const reviewerKey = codeRabbitLogins.has(reviewer) ? codeRabbitLogin : reviewer;
629636
if (r.state === 'DISMISSED') {
630-
latest.delete(reviewer);
637+
latest.delete(reviewerKey);
631638
} else if (r.state !== 'COMMENTED') {
632-
latest.set(reviewer, r);
639+
latest.set(reviewerKey, r);
633640
}
634641
}
635642
@@ -641,6 +648,7 @@ jobs:
641648
for (const review of latest.values()) {
642649
if (review.commit_id !== pr.head.sha ||
643650
review.user?.type === 'Bot' ||
651+
codeRabbitLogins.has(review.user?.login.toLowerCase()) ||
644652
review.user?.login.toLowerCase() === pr.user?.login.toLowerCase()) {
645653
continue;
646654
}
@@ -700,6 +708,24 @@ jobs:
700708
phase = 'approved';
701709
}
702710
711+
if (desiredLabel === 'awaiting-maintainer') {
712+
const { data: latestPrDetail } = await github.rest.pulls.get({
713+
owner, repo, pull_number: pr.number,
714+
});
715+
if (latestPrDetail.mergeable === false && latestPrDetail.mergeable_state === 'dirty') {
716+
core.info(`PR #${pr.number}: has merge conflicts — labeling has-conflicts`);
717+
await updateReviewGate(pr, 'conflict', false);
718+
await setCodeRabbitReviewActive(pr, false);
719+
await reconcileLabels(pr, 'has-conflicts');
720+
await updateReviewGuide(pr, 'conflict', existingGuide);
721+
continue;
722+
}
723+
if (latestPrDetail.mergeable === null || latestPrDetail.mergeable_state === 'unknown') {
724+
desiredLabel = null;
725+
phase = 'mergeability-pending';
726+
}
727+
}
728+
703729
core.info(
704730
`PR #${pr.number}: CI passing, reviews=${latest.size}, ` +
705731
`coderabbit=${freshCodeRabbitReview?.state ?? (automatedAuthor ? 'optional' : 'pending')}, ` +
@@ -739,10 +765,12 @@ jobs:
739765
} catch (cleanupError) {
740766
metadataErrors.push(cleanupError);
741767
}
742-
try {
743-
await reconcileLabels(pr, null);
744-
} catch (cleanupError) {
745-
metadataErrors.push(cleanupError);
768+
if (!error.preserveStateLabels) {
769+
try {
770+
await reconcileLabels(pr, null);
771+
} catch (cleanupError) {
772+
metadataErrors.push(cleanupError);
773+
}
746774
}
747775
const detail = error.status
748776
? `${error.message} (HTTP ${error.status}${error.response?.data?.message ? `: ${error.response.data.message}` : ''})`

‎packages/types/src/providers/anthropic.ts‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,23 @@ export const anthropicModels = {
164164
supportsTemperature: false,
165165
description: "Claude Opus 5 is Anthropic's most capable model for complex agentic coding and enterprise work.",
166166
},
167+
"claude-fable-5-1": {
168+
maxTokens: 128_000, // Overridden to 8k if `enableReasoningEffort` is false.
169+
contextWindow: 1_000_000,
170+
supportsImages: true,
171+
supportsPromptCache: true,
172+
inputPrice: 10.0, // $10 per million input tokens
173+
outputPrice: 50.0, // $50 per million output tokens
174+
cacheWritesPrice: 12.5, // $12.50 per million tokens (5-minute cache)
175+
cacheReadsPrice: 0.25, // $0.25 per million tokens (2.5% of base input price)
176+
// Fable 5.1 only accepts adaptive thinking (or an omitted thinking field).
177+
// Manual budget_tokens and non-default sampling parameters return a 400.
178+
supportsReasoningBudget: true,
179+
supportsReasoningBinary: true,
180+
supportsTemperature: false,
181+
description:
182+
"Claude Fable 5.1 extends Fable 5 with stronger long-running agentic coding, multistep research, and document work.",
183+
},
167184
"claude-fable-5": {
168185
maxTokens: 128_000, // Overridden to 8k if `enableReasoningEffort` is false.
169186
contextWindow: 1_000_000,

‎packages/types/src/providers/bedrock.ts‎

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,24 @@ export const bedrockModels = {
252252
cachableFields: ["system", "messages", "tools"],
253253
description: "Claude Opus 5 is Anthropic's most capable model for complex agentic coding and enterprise work.",
254254
},
255+
"anthropic.claude-fable-5-1": {
256+
maxTokens: 128_000,
257+
contextWindow: 1_000_000,
258+
supportsImages: true,
259+
supportsPromptCache: true,
260+
supportsReasoningBudget: true,
261+
supportsReasoningBinary: true,
262+
supportsTemperature: false,
263+
inputPrice: 10.0,
264+
outputPrice: 50.0,
265+
cacheWritesPrice: 12.5,
266+
cacheReadsPrice: 0.25,
267+
minTokensPerCachePoint: 512,
268+
maxCachePoints: 4,
269+
cachableFields: ["system", "messages", "tools"],
270+
description:
271+
"Claude Fable 5.1 extends Fable 5 with stronger long-running agentic coding, multistep research, and document work.",
272+
},
255273
"anthropic.claude-fable-5": {
256274
maxTokens: 8192,
257275
contextWindow: 1_000_000,
@@ -643,7 +661,7 @@ export const BEDROCK_1M_CONTEXT_MODEL_IDS = [
643661
// - Claude Opus 4.6
644662
// - Claude Opus 4.7
645663
// - Claude Opus 5
646-
// - Claude Fable 5 (cross-region inference only — can only be used through an inference profile)
664+
// - Claude Fable 5 and 5.1 (cross-region inference only — can only be used through an inference profile)
647665
export const BEDROCK_GLOBAL_INFERENCE_MODEL_IDS = [
648666
"anthropic.claude-sonnet-4-20250514-v1:0",
649667
"anthropic.claude-sonnet-4-5-20250929-v1:0",
@@ -655,6 +673,7 @@ export const BEDROCK_GLOBAL_INFERENCE_MODEL_IDS = [
655673
"anthropic.claude-opus-4-7",
656674
"anthropic.claude-opus-4-8",
657675
"anthropic.claude-opus-5",
676+
"anthropic.claude-fable-5-1",
658677
"anthropic.claude-fable-5",
659678
] as const
660679

‎packages/types/src/providers/openrouter.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export const OPEN_ROUTER_PROMPT_CACHING_MODELS = new Set([
4545
"anthropic/claude-opus-4.5",
4646
"anthropic/claude-opus-4.6",
4747
"anthropic/claude-opus-5",
48+
"anthropic/claude-fable-5.1",
4849
"anthropic/claude-fable-5",
4950
"anthropic/claude-haiku-4.5",
5051
"google/gemini-2.5-flash-preview",
@@ -78,6 +79,7 @@ export const OPEN_ROUTER_REASONING_BUDGET_MODELS = new Set([
7879
"anthropic/claude-opus-4.5",
7980
"anthropic/claude-opus-4.6",
8081
"anthropic/claude-opus-5",
82+
"anthropic/claude-fable-5.1",
8183
"anthropic/claude-fable-5",
8284
"anthropic/claude-sonnet-4",
8385
"anthropic/claude-sonnet-4.5",

‎packages/types/src/providers/vercel-ai-gateway.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export const VERCEL_AI_GATEWAY_PROMPT_CACHING_MODELS = new Set([
1414
"anthropic/claude-opus-4.5",
1515
"anthropic/claude-opus-4.6",
1616
"anthropic/claude-opus-5",
17+
"anthropic/claude-fable-5.1",
1718
"anthropic/claude-fable-5",
1819
"anthropic/claude-sonnet-4",
1920
"anthropic/claude-sonnet-4.6",
@@ -60,6 +61,7 @@ export const VERCEL_AI_GATEWAY_VISION_AND_TOOLS_MODELS = new Set([
6061
"anthropic/claude-opus-4.5",
6162
"anthropic/claude-opus-4.6",
6263
"anthropic/claude-opus-5",
64+
"anthropic/claude-fable-5.1",
6365
"anthropic/claude-fable-5",
6466
"anthropic/claude-sonnet-4",
6567
"anthropic/claude-sonnet-4.5",

‎packages/types/src/providers/vertex.ts‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,21 @@ export const vertexModels = {
489489
supportsTemperature: false,
490490
description: "Claude Opus 5 is Anthropic's most capable model for complex agentic coding and enterprise work.",
491491
},
492+
"claude-fable-5-1": {
493+
maxTokens: 128_000,
494+
contextWindow: 1_000_000,
495+
supportsImages: true,
496+
supportsPromptCache: true,
497+
inputPrice: 10.0,
498+
outputPrice: 50.0,
499+
cacheWritesPrice: 12.5,
500+
cacheReadsPrice: 0.25,
501+
supportsReasoningBudget: true,
502+
supportsReasoningBinary: true,
503+
supportsTemperature: false,
504+
description:
505+
"Claude Fable 5.1 extends Fable 5 with stronger long-running agentic coding, multistep research, and document work.",
506+
},
492507
"claude-fable-5": {
493508
maxTokens: 8192,
494509
contextWindow: 1_000_000,

‎src/api/providers/__tests__/anthropic-vertex.spec.ts‎

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -992,6 +992,24 @@ describe("VertexHandler", () => {
992992
expect(model.info.supportsTemperature).toBe(false)
993993
})
994994

995+
it("should return Claude Fable 5.1 model info", () => {
996+
const handler = new AnthropicVertexHandler({
997+
apiModelId: "claude-fable-5-1",
998+
vertexProjectId: "test-project",
999+
vertexRegion: "us-central1",
1000+
})
1001+
1002+
const model = handler.getModel()
1003+
expect(model.id).toBe("claude-fable-5-1")
1004+
expect(model.info.maxTokens).toBe(128_000)
1005+
expect(model.info.contextWindow).toBe(1_000_000)
1006+
expect(model.info.cacheReadsPrice).toBe(0.25)
1007+
expect(model.info.supportsReasoningBinary).toBe(true)
1008+
expect(model.info.supportsReasoningBudget).toBe(true)
1009+
expect(model.info.supportsPromptCache).toBe(true)
1010+
expect(model.info.supportsTemperature).toBe(false)
1011+
})
1012+
9951013
it("should return Claude Sonnet 5 model info", () => {
9961014
const handler = new AnthropicVertexHandler({
9971015
apiModelId: "claude-sonnet-5",
@@ -1266,6 +1284,37 @@ describe("VertexHandler", () => {
12661284
enableReasoningEffort: true,
12671285
})
12681286

1287+
const mockCreate = vitest
1288+
.fn()
1289+
.mockImplementation(async () =>
1290+
asyncStreamFrom([
1291+
{ type: "message_start", message: { usage: { input_tokens: 10, output_tokens: 5 } } },
1292+
]),
1293+
)
1294+
fableHandler["client"].messages.create = mockCreate
1295+
1296+
await fableHandler.createMessage("You are a helpful assistant", [{ role: "user", content: "Hello" }]).next()
1297+
1298+
expect(mockCreate).toHaveBeenCalledWith(
1299+
expect.objectContaining({
1300+
thinking: { type: "adaptive" },
1301+
}),
1302+
undefined,
1303+
)
1304+
1305+
const request = mockCreate.mock.calls[0][0]
1306+
expect(request.thinking).not.toHaveProperty("budget_tokens")
1307+
expect(request.temperature).toBeUndefined()
1308+
})
1309+
1310+
it("should use adaptive thinking for Claude Fable 5.1", async () => {
1311+
const fableHandler = new AnthropicVertexHandler({
1312+
apiModelId: "claude-fable-5-1",
1313+
vertexProjectId: "test-project",
1314+
vertexRegion: "us-central1",
1315+
enableReasoningEffort: true,
1316+
})
1317+
12691318
const mockCreate = vitest
12701319
.fn()
12711320
.mockImplementation(async () =>

0 commit comments

Comments
 (0)