Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat(server): preserve budgeted history across provider handoffs #12352

Mergedjuliusmarmingemerged 13 commits intot3code/codex-turn-mapping fromrefs/pull/12352/headmerged by juliusmarminge View on GitHub

Showing 24 changed files with 88 additions and 5 deletions (loading 21).

x
0 of 24 viewed, 24 left
1 addition and 1 deletionapps/server/src/mcp/toolkits/orchestrator/tools.tsModified
View file
@@ -170,7 +170,7 @@
​
const ThreadReadTool = Tool.make("t3_thread_read", {
description:
- "Read durable state and a paginated timeline from a T3 thread in the calling project, or from a thread the user attached to this conversation as context. The default messages view returns user messages, assistant messages, and proposed plans; activity returns all summarized timeline items. Reading an untruncated terminal assistant result from this parent thread's direct app-owned child acknowledges that child's automatic completion delivery. Continue with afterPosition=nextPosition.",
+ "Read durable state and a paginated timeline from a T3 thread in the calling project, or from a thread the user attached to this conversation as context. The default messages view returns user messages, assistant messages, and proposed plans; activity returns all summarized timeline items. Reading an untruncated terminal assistant result from this parent thread's direct app-owned child acknowledges that child's automatic completion delivery. Continue with afterPosition=nextPosition. Recover long item text with itemId and textOffset=nextTextOffset until nextTextOffset is null; offsets count UTF-16 code units.",
parameters: OrchestratorMcpThreadReadInput,
success: OrchestratorMcpThreadReadResult,
failure: OrchestratorMcpFailure,
21 additions and 4 deletionsapps/server/src/mcp/OrchestratorMcpService.tsModified
View file
@@ -701,10 +701,13 @@
function timelineItem(input: {
readonly row: OrchestrationV2ThreadProjection["visibleTurnItems"][number];
readonly maxChars: number;
+ readonly textOffset?: number;
readonly messagesByThreadId: ReadonlyMap<ThreadId, OrchestrationV2ThreadProjection["messages"]>;
}): OrchestratorMcpThreadTimelineItem {
const text = turnItemText(input.row.item);
- const textTruncated = text !== null && text.length > input.maxChars;
+ const offset = input.textOffset ?? 0;
+ const end = offset + input.maxChars;
+ const textTruncated = text !== null && text.length > end;
const messageId =
input.row.item.type === "user_message" || input.row.item.type === "assistant_message"
? input.row.item.messageId
@@ -727,8 +730,9 @@