-
Notifications
You must be signed in to change notification settings - Fork 2.3k
fix(types): handle reasoning.encrypted content block type from Grok models #1732
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
potb
wants to merge
7
commits into
code-yeongyu:dev
Choose a base branch
from
potb:fix/1588-reasoning-encrypted
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+148
−10
Draft
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
709c4ee
fix(types): add reasoning.encrypted to ThinkingPartType union and THI…
potb 9399c37
fix(hooks): handle reasoning.encrypted in thinking-family checks
potb df8124c
fix(background-task): handle reasoning.encrypted in content extraction
potb f8cc7d7
fix(delegate-task): handle reasoning.encrypted in sync task result ex…
potb f634150
fix(unstable-agent-babysitter): handle reasoning.encrypted in thinkin…
potb 40f0a68
fix(background-task): include reasoning.encrypted in part type filters
potb 2827118
fix(thinking-block-validator): handle reasoning.encrypted in startsWi…
potb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| import { describe, expect, it } from "bun:test" | ||
| import { THINKING_TYPES } from "./constants" | ||
|
|
||
| describe("reasoning.encrypted support", () => { | ||
| //#given reasoning.encrypted is a valid thinking-family type from Grok models | ||
|
|
||
| it("should include reasoning.encrypted in THINKING_TYPES Set", () => { | ||
| //#when checking if reasoning.encrypted is in THINKING_TYPES | ||
| const result = THINKING_TYPES.has("reasoning.encrypted") | ||
|
|
||
| //#then it should return true | ||
| expect(result).toBe(true) | ||
| }) | ||
|
|
||
| it("should recognize reasoning.encrypted as a ThinkingPartType", () => { | ||
| //#given a type assertion for reasoning.encrypted | ||
| //#when assigning to ThinkingPartType | ||
| const thinkingType: import("./types").ThinkingPartType = "reasoning.encrypted" | ||
|
|
||
| //#then it should compile without error | ||
| expect(thinkingType).toBe("reasoning.encrypted") | ||
| }) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/hooks/thinking-block-validator/reasoning-encrypted.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| import { describe, expect, it } from "bun:test" | ||
|
|
||
| describe("reasoning.encrypted in thinking-family checks", () => { | ||
| //#given a helper function that checks if a type is thinking-family | ||
| const isThinkingFamily = (type: string): boolean => { | ||
cubic-dev-ai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| return type === "thinking" || type === "reasoning" || type === "reasoning.encrypted" | ||
| } | ||
|
|
||
| it("should recognize reasoning.encrypted as thinking-family type", () => { | ||
| //#when checking if reasoning.encrypted is thinking-family | ||
| const result = isThinkingFamily("reasoning.encrypted") | ||
|
|
||
| //#then it should return true | ||
| expect(result).toBe(true) | ||
| }) | ||
|
|
||
| it("should recognize reasoning as thinking-family type", () => { | ||
| //#when checking if reasoning is thinking-family | ||
| const result = isThinkingFamily("reasoning") | ||
|
|
||
| //#then it should return true | ||
| expect(result).toBe(true) | ||
| }) | ||
|
|
||
| it("should recognize thinking as thinking-family type", () => { | ||
| //#when checking if thinking is thinking-family | ||
| const result = isThinkingFamily("thinking") | ||
|
|
||
| //#then it should return true | ||
| expect(result).toBe(true) | ||
| }) | ||
|
|
||
| it("should not recognize text as thinking-family type", () => { | ||
| //#when checking if text is thinking-family | ||
| const result = isThinkingFamily("text") | ||
|
|
||
| //#then it should return false | ||
| expect(result).toBe(false) | ||
| }) | ||
| }) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
src/tools/background-task/reasoning-encrypted-extraction.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| import { describe, expect, it } from "bun:test" | ||
|
|
||
| describe("reasoning.encrypted content extraction", () => { | ||
| //#given content parts with reasoning.encrypted type | ||
|
|
||
| it("should extract text from reasoning.encrypted part when text is present", () => { | ||
| //#given a part with reasoning.encrypted type and text | ||
| const part = { type: "reasoning.encrypted" as const, text: "decrypted reasoning content" } | ||
|
|
||
| //#when filtering for text or reasoning.encrypted with text guard | ||
| const shouldInclude = !!((part.type === "text" || part.type === "reasoning" || part.type === "reasoning.encrypted") && part.text) | ||
|
|
||
| //#then it should be included | ||
| expect(shouldInclude).toBe(true) | ||
| }) | ||
|
|
||
| it("should skip reasoning.encrypted part when text is missing", () => { | ||
| //#given a part with reasoning.encrypted type but no text | ||
| const part = { type: "reasoning.encrypted" as const } | ||
|
|
||
| //#when filtering for text or reasoning.encrypted with text guard | ||
| const shouldInclude = !!((part.type === "text" || part.type === "reasoning" || part.type === "reasoning.encrypted") && (part as any).text) | ||
|
|
||
| //#then it should be excluded | ||
| expect(shouldInclude).toBe(false) | ||
| }) | ||
|
|
||
| it("should extract text from reasoning part when text is present", () => { | ||
| //#given a part with reasoning type and text | ||
| const part = { type: "reasoning" as const, text: "reasoning content" } | ||
|
|
||
| //#when filtering for text or reasoning with text guard | ||
| const shouldInclude = !!((part.type === "text" || part.type === "reasoning" || part.type === "reasoning.encrypted") && part.text) | ||
|
|
||
| //#then it should be included | ||
| expect(shouldInclude).toBe(true) | ||
| }) | ||
|
|
||
| it("should extract text from text part", () => { | ||
| //#given a part with text type | ||
| const part = { type: "text" as const, text: "text content" } | ||
|
|
||
| //#when filtering for text or reasoning with text guard | ||
| const shouldInclude = !!((part.type === "text" || part.type === "reasoning" || part.type === "reasoning.encrypted") && part.text) | ||
|
|
||
| //#then it should be included | ||
| expect(shouldInclude).toBe(true) | ||
| }) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.