Skip to content

Commit c221515

Browse files
Merge remote-tracking branch 'origin/main' into pi-prompt-section
2 parents 4243ae3 + 012e4ec commit c221515

86 files changed

Lines changed: 2801 additions & 645 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/actions/setup-ci-deps/action.yml‎

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,34 @@ runs:
1818
path: ~/.vite-plus
1919
key: vite-plus-home-v1-${{ runner.os }}-${{ runner.arch }}-${{ steps.vp.outputs.version }}
2020

21+
- name: Setup Vite+
22+
uses: voidzero-dev/setup-vp@v1
23+
with:
24+
node-version-file: package.json
25+
cache: false
26+
run-install: false
27+
28+
- name: Resolve pnpm store path
29+
id: pnpm_store
30+
shell: bash
31+
run: |
32+
store_path="$(vp pm cache dir)"
33+
echo "path=$store_path" >> "$GITHUB_OUTPUT"
34+
35+
# setup-vp's shared cache key ignores install filters. Keep full installs in a
36+
# separate namespace, including fallback restores.
2137
# The pnpm store stays a cache tarball on the runner's own disk. A store on a
2238
# Blacksmith sticky disk mounts in under a second, but pnpm then copies every
2339
# package across filesystems instead of hard-linking it: install took 28-49s
2440
# against 9s plus an 11s restore.
25-
- name: Setup Vite+
26-
uses: voidzero-dev/setup-vp@v1
41+
- name: Cache full pnpm store
42+
uses: actions/cache@v6
2743
with:
28-
node-version-file: package.json
29-
cache: true
30-
run-install: true
44+
path: ${{ steps.pnpm_store.outputs.path }}
45+
key: pnpm-full-v1-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('pnpm-lock.yaml', 'pnpm-workspace.yaml', 'package.json') }}
46+
restore-keys: |
47+
pnpm-full-v1-${{ runner.os }}-${{ runner.arch }}-
48+
49+
- name: Install dependencies
50+
shell: bash
51+
run: vp install

‎.github/workflows/ci.yml‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -482,8 +482,6 @@ jobs:
482482
!/apps/mobile/modules/t3-terminal/Vendor/**/*.a
483483
sparse-checkout-cone-mode: false
484484

485-
# A full install: a filtered one that misses the cache first saves its
486-
# partial store under the shared lockfile key for every later job.
487485
- name: Setup Vite+
488486
uses: ./.github/actions/setup-ci-deps
489487

‎.github/workflows/release.yml‎

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,8 @@ jobs:
129129
!/.repos/
130130
sparse-checkout-cone-mode: false
131131

132-
- name: Setup Vite+
133-
uses: voidzero-dev/setup-vp@v1
134-
with:
135-
node-version-file: package.json
136-
cache: true
137-
run-install: true
132+
- name: Setup dependencies
133+
uses: ./.github/actions/setup-ci-deps
138134
env:
139135
pnpm_config_cache_dir: ${{ runner.temp }}/pnpm-metadata
140136

@@ -247,12 +243,8 @@ jobs:
247243
!/.repos/
248244
sparse-checkout-cone-mode: false
249245

250-
- name: Setup Vite+
251-
uses: voidzero-dev/setup-vp@v1
252-
with:
253-
node-version-file: package.json
254-
cache: true
255-
run-install: true
246+
- name: Setup dependencies
247+
uses: ./.github/actions/setup-ci-deps
256248

257249
- name: Ensure Electron runtime is installed
258250
run: vp run --filter @t3tools/desktop ensure:electron
@@ -281,12 +273,8 @@ jobs:
281273
!/.repos/
282274
sparse-checkout-cone-mode: false
283275

284-
- name: Setup Vite+
285-
uses: voidzero-dev/setup-vp@v1
286-
with:
287-
node-version-file: package.json
288-
cache: true
289-
run-install: true
276+
- name: Setup dependencies
277+
uses: ./.github/actions/setup-ci-deps
290278

291279
- name: Ensure Electron runtime is installed
292280
run: vp run --filter @t3tools/desktop ensure:electron
@@ -325,12 +313,8 @@ jobs:
325313
!/.repos/
326314
sparse-checkout-cone-mode: false
327315

328-
- name: Setup Vite+
329-
uses: voidzero-dev/setup-vp@v1
330-
with:
331-
node-version-file: package.json
332-
cache: true
333-
run-install: true
316+
- name: Setup dependencies
317+
uses: ./.github/actions/setup-ci-deps
334318

335319
# No Electron setup here: `t3` (apps/server) has no Electron dependency
336320
# and none of its tests touch the runtime. Only the non-server `test`

‎apps/mobile/src/features/threads/ThreadFeed.tsx‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import {
3434
} from "@t3tools/contracts";
3535
import { renderAssistantCitationsAsText } from "@t3tools/shared/assistantCitations";
3636
import { encodeComposerContextFragment } from "@t3tools/shared/composerContextClipboard";
37-
import { parseThreadLinkHref } from "@t3tools/shared/threadLinks";
37+
import { parseThreadLinkHref, resolveThreadLinkRef } from "@t3tools/shared/threadLinks";
3838
import { PROMPT_LINK_MAX_PROMPT_LENGTH } from "@t3tools/shared/promptLinks";
3939
import {
4040
parseComposerContextHref,
@@ -1788,9 +1788,13 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
17881788
const onMarkdownLinkPress = (href: string, imageEmbed = false) => {
17891789
const linkedThreadId = parseThreadLinkHref(href);
17901790
if (linkedThreadId) {
1791+
const source = scopeThreadRef(props.environmentId, linkedThreadId);
1792+
const target =
1793+
resolveThreadLinkRef(source, appAtomRegistry.get(environmentThreadShells.threadRefsAtom)) ??
1794+
source;
17911795
navigation.navigate("Thread", {
1792-
environmentId: String(props.environmentId),
1793-
threadId: String(linkedThreadId),
1796+
environmentId: String(target.environmentId),
1797+
threadId: String(target.threadId),
17941798
});
17951799
return;
17961800
}

‎apps/server/src/mcp/OrchestratorMcpService.ts‎

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1453,6 +1453,13 @@ const make = Effect.gen(function* () {
14531453
null);
14541454
const resultTransfer = taskResultTransfer(parentProjection, childProjection, task) ?? null;
14551455
const terminalStatus = terminalRun === undefined ? null : taskStatusForRun(terminalRun);
1456+
const latestTerminalSummary = canExposeTaskRunResult(terminalRun)
1457+
? terminalRun.id === childRun?.id
1458+
? derivedResult
1459+
: subagentResultForRun(childProjection, terminalRun).text
1460+
: null;
1461+
const resultContextTransferId = resultTransfer?.id ?? null;
1462+
const latestTerminalResultContextTransferId = resultTransferForRun(terminalRun)?.id ?? null;
14561463
const response = {
14571464
taskId: task.id,
14581465
childThreadId: task.childThreadId,
@@ -1464,16 +1471,16 @@ const make = Effect.gen(function* () {
14641471
providerInstanceId: task.providerInstanceId,
14651472
model: task.model,
14661473
summary: derivedResult,
1467-
resultContextTransferId: resultTransfer?.id ?? null,
1474+
resultContextTransferId,
14681475
latestTerminalRunId: terminalRun?.id ?? null,
14691476
latestTerminalStatus:
14701477
terminalStatus !== null && isTerminalTaskStatus(terminalStatus) ? terminalStatus : null,
1471-
latestTerminalSummary: canExposeTaskRunResult(terminalRun)
1472-
? terminalRun.id === childRun?.id
1473-
? derivedResult
1474-
: subagentResultForRun(childProjection, terminalRun).text
1475-
: null,
1476-
latestTerminalResultContextTransferId: resultTransferForRun(terminalRun)?.id ?? null,
1478+
latestTerminalSummary:
1479+
latestTerminalSummary === derivedResult ? null : latestTerminalSummary,
1480+
latestTerminalResultContextTransferId:
1481+
latestTerminalResultContextTransferId === resultContextTransferId
1482+
? null
1483+
: latestTerminalResultContextTransferId,
14771484
hasPendingQuestion:
14781485
!isTerminalTaskStatus(status) &&
14791486
childControls.runtimeRequests.some(

‎apps/server/src/mcp/OrchestratorMcpToolkit.integration.test.ts‎

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -136,16 +136,15 @@ const delegatedTaskStatusTranscriptFile = new URL(
136136
import.meta.url,
137137
);
138138

139-
const readDelegatedTaskStatusTranscript = Effect.fn("readDelegatedTaskStatusTranscript")(
140-
function* () {
141-
const fs = yield* FileSystem.FileSystem;
142-
const text = yield* fs.readFileString(
143-
decodeURIComponent(delegatedTaskStatusTranscriptFile.pathname),
144-
);
145-
return yield* decodeProviderReplayNdjson(text);
146-
},
147-
Effect.provide(NodeServices.layer),
148-
);
139+
const readDelegatedTaskStatusTranscript = Effect.fn("readDelegatedTaskStatusTranscript")(function* (
140+
followupResult: string,
141+
) {
142+
const fs = yield* FileSystem.FileSystem;
143+
const text = yield* fs.readFileString(
144+
decodeURIComponent(delegatedTaskStatusTranscriptFile.pathname),
145+
);
146+
return yield* decodeProviderReplayNdjson(text.replaceAll(queuedFollowupResult, followupResult));
147+
}, Effect.provide(NodeServices.layer));
149148

150149
interface CapturedTurn {
151150
readonly instanceId: ProviderInstanceId;
@@ -1757,10 +1756,10 @@ describe("orchestrator MCP toolkit", () => {
17571756
hasPendingChildRuns: false,
17581757
latestTerminalRunId: delegated.childRunId,
17591758
latestTerminalStatus: "completed",
1760-
latestTerminalSummary: delegatedResult,
1759+
latestTerminalSummary: null,
1760+
latestTerminalResultContextTransferId: null,
17611761
});
17621762
expect(delegatedStatus.resultContextTransferId).not.toBeNull();
1763-
expect(delegatedStatus.latestTerminalResultContextTransferId).not.toBeNull();
17641763

17651764
yield* expectOffersToStay(0);
17661765

@@ -3990,11 +3989,14 @@ describe("orchestrator MCP toolkit", () => {
39903989
),
39913990
);
39923991

3993-
it.live("reports running and queued child follow-ups from a Codex replay transcript", () =>
3992+
it.live.each([
3993+
{ label: "distinct", result: queuedFollowupResult, latestSummary: queuedFollowupResult },
3994+
{ label: "identical", result: delegatedResult, latestSummary: null },
3995+
])("reports $label child results", ({ result, latestSummary }) =>
39943996
Effect.scoped(
39953997
Effect.gen(function* () {
39963998
const cwd = yield* checkpointWorkspace("delegated-task-status");
3997-
const rawTranscript = yield* readDelegatedTaskStatusTranscript();
3999+
const rawTranscript = yield* readDelegatedTaskStatusTranscript(result);
39984000
const transcript = yield* CodexOrchestratorReplayHarness.decodeTranscript(
39994001
materializeReplayTranscriptWorkspace(rawTranscript, cwd),
40004002
);
@@ -4163,12 +4165,10 @@ describe("orchestrator MCP toolkit", () => {
41634165
hasPendingChildRuns: false,
41644166
latestTerminalRunId: delegated.childRunId,
41654167
latestTerminalStatus: "completed",
4166-
latestTerminalSummary: delegatedResult,
4168+
latestTerminalSummary: null,
4169+
latestTerminalResultContextTransferId: null,
41674170
});
41684171
expect(delegated.resultContextTransferId).not.toBeNull();
4169-
expect(delegated.latestTerminalResultContextTransferId).toBe(
4170-
delegated.resultContextTransferId,
4171-
);
41724172

41734173
const delegatedChild = yield* orchestrator.getThreadProjection(delegated.childThreadId);
41744174
expect(delegatedChild.thread.lineage.relationshipToParent).toBe("subagent");
@@ -4262,8 +4262,8 @@ describe("orchestrator MCP toolkit", () => {
42624262
hasPendingChildRuns: true,
42634263
latestTerminalRunId: delegated.childRunId,
42644264
latestTerminalStatus: "completed",
4265-
latestTerminalSummary: delegatedResult,
4266-
latestTerminalResultContextTransferId: delegated.resultContextTransferId,
4265+
latestTerminalSummary: null,
4266+
latestTerminalResultContextTransferId: null,
42674267
});
42684268

42694269
const finalSequence = yield* orchestrator.getThreadEventSequence(delegated.childThreadId);
@@ -4336,7 +4336,7 @@ describe("orchestrator MCP toolkit", () => {
43364336
finishedParent.subagents.find((task) => task.id === followupTasks[1]!.id),
43374337
).toMatchObject({
43384338
status: "completed",
4339-
result: queuedFollowupResult,
4339+
result,
43404340
});
43414341
expect(
43424342
finishedParent.contextTransfers.filter(
@@ -4363,9 +4363,18 @@ describe("orchestrator MCP toolkit", () => {
43634363
hasPendingChildRuns: false,
43644364
latestTerminalRunId: queuedFollowup.runId,
43654365
latestTerminalStatus: "completed",
4366-
latestTerminalSummary: queuedFollowupResult,
4366+
latestTerminalSummary: latestSummary,
43674367
});
4368-
expect(finalStatus.latestTerminalResultContextTransferId).not.toBeNull();
4368+
const followupTransfer = finishedParent.contextTransfers.find(
4369+
(transfer) =>
4370+
transfer.type === "subagent_result" &&
4371+
transfer.sourcePoint.runId === queuedFollowup.runId,
4372+
);
4373+
expect(followupTransfer).toBeDefined();
4374+
expect(finalStatus.latestTerminalResultContextTransferId).toBe(followupTransfer?.id);
4375+
expect(finalStatus.latestTerminalResultContextTransferId).not.toBe(
4376+
delegated.resultContextTransferId,
4377+
);
43694378
const read = yield* invoke("t3_thread_read", {
43704379
threadId: delegated.childThreadId,
43714380
limit: 100,

‎apps/server/src/mcp/toolkits/orchestrator/tools.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export const DelegateTaskTool = Tool.make("delegate_task", {
7878

7979
const TaskStatusTool = Tool.make("task_status", {
8080
description:
81-
"Needs an agent running inside a T3 thread. Read a T3-owned delegated task created by this parent thread. childRunId identifies the original delegated run. workState distinguishes working, waiting_for_children, and result_available; a completed turn with live nested work is not a completed task. summary is the final task result, including provider errors on failure, and remains stable after publication. hasPendingChildRuns reports later queued or executing turns in the backing child thread, even after the task is terminal; it does not reopen the task, and task_cancel stops those turns too. Turns held in a stopped queue wait for the user and do not count. latestTerminal* provides later non-monitor turn results. Reading a terminal result acknowledges its automatic parent delivery.",
81+
"Needs an agent running inside a T3 thread. Read a T3-owned delegated task created by this parent thread. childRunId identifies the original delegated run. workState distinguishes working, waiting_for_children, and result_available; a completed turn with live nested work is not a completed task. summary is the final task result, including provider errors on failure, and remains stable after publication. hasPendingChildRuns reports later queued or executing turns in the backing child thread, even after the task is terminal; it does not reopen the task, and task_cancel stops those turns too. Turns held in a stopped queue wait for the user and do not count. latestTerminal* provides later non-monitor turn results; latestTerminalSummary and latestTerminalResultContextTransferId are independently null when they exactly repeat summary and resultContextTransferId, respectively. Reading a terminal result acknowledges its automatic parent delivery.",
8282
parameters: OrchestratorMcpTaskStatusInput,
8383
success: OrchestratorMcpDelegateTaskResult,
8484
failure: OrchestratorMcpFailure,

‎apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import {
3434
NodeId,
3535
type OrchestrationV2AppThread,
3636
type OrchestrationV2ProviderThread,
37+
OrchestrationV2UserInputQuestion,
3738
ProjectId,
3839
ProviderInstanceId,
3940
type ProviderInstanceEnvironment,
@@ -102,6 +103,10 @@ import {
102103
projectionFor,
103104
} from "../testkit/fixtures/shared.ts";
104105

106+
const decodeUserInputQuestions = Schema.decodeUnknownSync(
107+
Schema.Array(OrchestrationV2UserInputQuestion),
108+
);
109+
105110
const DEFAULT_CLAUDE_SETTINGS = Schema.decodeSync(ClaudeSettings)({});
106111
const AUTO_COMPACT_CLAUDE_SETTINGS = Schema.decodeSync(ClaudeSettings)({
107112
autoCompactWindow: "300000",
@@ -332,6 +337,31 @@ describe("ClaudeAdapterV2 runtime query policy", () => {
332337
);
333338
});
334339

340+
it("fills blank AskUserQuestion descriptions from trimmed labels", () => {
341+
const questions = decodeUserInputQuestions(
342+
ClaudeAdapterV2.claudeUserInputQuestions({
343+
questions: [
344+
{
345+
header: "Naming",
346+
question: "Which name?",
347+
options: [
348+
{ label: "Recorder", description: " Matches the package name. " },
349+
{ label: " Keep ", description: "" },
350+
{ label: " Other ", description: " \t\n " },
351+
{ label: " Ask later " },
352+
],
353+
},
354+
],
355+
}),
356+
);
357+
assert.deepEqual(questions[0]?.options, [
358+
{ label: "Recorder", description: "Matches the package name." },
359+
{ label: "Keep", description: "Keep" },
360+
{ label: "Other", description: "Other" },
361+
{ label: "Ask later", description: "Ask later" },
362+
]);
363+
});
364+
335365
it("normalizes Claude todo and proposed-plan tool input", () => {
336366
assert.deepEqual(
337367
ClaudeAdapterV2.claudeTodoSteps({

‎apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3354,13 +3354,9 @@ export function claudeUserInputQuestions(
33543354
const optionRecord = option as Record<string, unknown>;
33553355
const label = typeof optionRecord.label === "string" ? optionRecord.label.trim() : "";
33563356
if (label.length === 0) return [];
3357-
return [
3358-
{
3359-
label,
3360-
description:
3361-
typeof optionRecord.description === "string" ? optionRecord.description.trim() : "",
3362-
},
3363-
];
3357+
const description =
3358+
typeof optionRecord.description === "string" ? optionRecord.description.trim() : "";
3359+
return [{ label, description: description || label }];
33643360
})
33653361
: [];
33663362
return [

0 commit comments

Comments
 (0)