Skip to content

Commit 9ba4688

Browse files
Merge remote-tracking branch 'origin/main' into pr-32681
2 parents 09e12cd + e5b0718 commit 9ba4688

18 files changed

Lines changed: 385 additions & 62 deletions

‎apps/mobile/src/components/ui/useBarInset.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ export function useBarOverlap(): number {
3838
}
3939

4040
/**
41-
* The content's top safe area under the AppBar: a translucent bar's height, zero under a solid
42-
* one or on Android, where the bar sits in flow. For scroll content insets, which must not
43-
* double-count a solid bar.
41+
* The content's top safe area under the AppBar: the height of the iOS bar its column lays content
42+
* under, glass or solid, and zero on Android, where the bar sits in flow. For manual scroll
43+
* content insets.
4444
*/
4545
export function useContentTopInset(): number {
4646
const insets = useSafeAreaInsets();

‎apps/mobile/src/features/layout/workspace/workspace-list-insets.ts‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@ import { useSafeAreaInsets } from "react-native-safe-area-context";
22

33
import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../../native/native-glass";
44

5-
/** A workspace list scrolls under its bar where the bar is glass; under a solid bar it starts below. */
6-
export const WORKSPACE_LIST_SCROLL_INSETS = {
7-
automaticallyAdjustsScrollIndicatorInsets: NATIVE_LIQUID_GLASS_SUPPORTED,
8-
contentInsetAdjustmentBehavior: NATIVE_LIQUID_GLASS_SUPPORTED ? "automatic" : "never",
9-
} as const;
10-
115
/** How far an empty workspace list keeps its message below a glass bar and its search. */
126
export function useWorkspaceListEmptyTopInset(): number {
137
const insets = useSafeAreaInsets();

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1496,7 +1496,6 @@ function ThreadDetailBody(
14961496
keyboardOffset={composerKeyboardOffset}
14971497
sendingWithKeyboard={sendingWithKeyboard}
14981498
fitShortFeedToViewport={questionInFlow && !isKeyboardVisible}
1499-
contentTopInset={0}
15001499
contentBottomInset={
15011500
questionInFlow
15021501
? 0

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ import { getReviewSectionIdForCheckpoint } from "../review/reviewModel";
170170
import { setReviewSelectedSectionId } from "../review/reviewState";
171171
import { Menu } from "../../components/ui/Menu";
172172
import { useAndroidControlSizing } from "../../components/ui/useAndroidControlSizing";
173-
import { useBarInset } from "../../components/ui/useBarInset";
173+
import { useBarInset, useContentTopInset } from "../../components/ui/useBarInset";
174174
import { copyPromptLink } from "../prompt-links/prompt-link-actions";
175175
import { parseReviewCommentMessageSegments } from "../review/reviewCommentSelection";
176176
import {
@@ -332,7 +332,6 @@ export interface ThreadFeedProps {
332332
readonly keyboardOffset: number;
333333
readonly sendingWithKeyboard?: boolean;
334334
readonly fitShortFeedToViewport?: boolean;
335-
readonly contentTopInset?: number;
336335
readonly contentBottomInset?: number;
337336
readonly historyControls?: ThreadFeedHistoryControls;
338337
readonly contentMaxWidth?: number;
@@ -2772,10 +2771,12 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
27722771
const markdownContentWidth = Math.max(0, contentWidth - ASSISTANT_ROW_HORIZONTAL_PADDING * 2);
27732772
const reviewCommentBubbleWidth = Math.min(Math.max(280, contentWidth * 0.85), contentWidth);
27742773
const barInset = useBarInset();
2775-
const topContentInset = props.contentTopInset ?? barInset;
2774+
const columnTopInset = useContentTopInset();
27762775
const bottomContentInset = props.contentBottomInset ?? 18;
27772776
const usesNativeAutomaticInsets =
27782777
props.usesAutomaticContentInsets === true && Platform.OS === "ios";
2778+
// Without the native contentInset, a list-header spacer clears the bar the column lays content under.
2779+
const topContentInset = usesNativeAutomaticInsets ? 0 : columnTopInset;
27792780
const anchorTopInset = usesNativeAutomaticInsets ? barInset : topContentInset;
27802781

27812782
const theme = useUniwindTheme();
@@ -3200,7 +3201,9 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
32003201
if (state) onIsAtEndChange?.(state.isAtEnd);
32013202
};
32023203
const handleScroll = (event: NativeSyntheticEvent<NativeScrollEvent>) => {
3203-
reportHeaderMaterialVisibility(event.nativeEvent.contentOffset.y + anchorTopInset > 6);
3204+
reportHeaderMaterialVisibility(
3205+
event.nativeEvent.contentOffset.y + (usesNativeAutomaticInsets ? barInset : 0) > 6,
3206+
);
32043207
handleMetricsChange();
32053208
};
32063209
// oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to the list's end state to report it to the parent

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ import { usePendingTaskListActions } from "../home/usePendingTaskListActions";
4848
import { useThreadListActions } from "../home/useThreadListActions";
4949
import { useFabScroll } from "../home/FabScrollContext";
5050
import { WorkspaceListHeader } from "../layout/workspace/WorkspaceListHeader";
51-
import { WORKSPACE_LIST_SCROLL_INSETS } from "../layout/workspace/workspace-list-insets";
5251
import { WorkspaceSidebarColumn } from "../layout/workspace/WorkspaceSidebarColumn";
5352
import {
5453
ThreadListV2PendingRow,
@@ -592,7 +591,9 @@ function ThreadNavigationSidebarPane(props: ThreadNavigationSidebarProps) {
592591
itemsAreEqual={sidebarItemsAreEqual}
593592
keyExtractor={(item) => item.key}
594593
renderItem={renderListItem}
595-
{...WORKSPACE_LIST_SCROLL_INSETS}
594+
automaticallyAdjustsScrollIndicatorInsets
595+
// The column lays the list under its bar, glass or solid; UIKit insets it past both.
596+
contentInsetAdjustmentBehavior="automatic"
596597
contentContainerStyle={[
597598
styles.threadListContent,
598599
{

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

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4931,6 +4931,114 @@ it.layer(McpProviderSessions.layer)("OpenCode2 adapter", (it) => {
49314931
}).pipe(Effect.scoped, Effect.provide(IdAllocator.layer)),
49324932
);
49334933

4934+
it.effect("shows a question asked while OpenCode wakes for a background reply", () =>
4935+
Effect.gen(function* () {
4936+
const OTHER = "ses_other00000000000000000000";
4937+
const gate = makeProviderReplayGate(["continued"]);
4938+
const offered =
4939+
yield* Deferred.make<ProviderContinuationRequests.ProviderContinuationRequest>();
4940+
const { runtime, thread } = yield* resumed(
4941+
[
4942+
out("session.get", { sessionID: OTHER }),
4943+
replyData("session.get", sessionInfo({ id: OTHER })),
4944+
out("permission.list", { sessionID: OTHER }),
4945+
replyData("permission.list", []),
4946+
out("session.form.list", { sessionID: OTHER }),
4947+
replyData("session.form.list", []),
4948+
...backgroundLaunch(CHILD),
4949+
event("session.execution.succeeded", { sessionID: SESSION }),
4950+
event("session.execution.succeeded", { sessionID: CHILD }),
4951+
childReport("msg_report", "CHILD_OK"),
4952+
event("session.execution.started", { sessionID: SESSION }),
4953+
event("session.inbox.delivered", { sessionID: SESSION, inboxID: "msg_report" }),
4954+
event("form.created", { form: colorForm }),
4955+
// Handled after the form, so its update proves the form reached the adapter.
4956+
event("session.model.selected", {
4957+
sessionID: OTHER,
4958+
model: { providerID: "opencode", id: "big-pickle", variant: "none" },
4959+
}),
4960+
// Released once the continuation started, so its update follows the replay.
4961+
event(
4962+
"session.model.selected",
4963+
{
4964+
sessionID: OTHER,
4965+
model: { providerID: "opencode", id: "big-pickle", variant: "thinking" },
4966+
},
4967+
"continued",
4968+
),
4969+
out("session.form.reply", {
4970+
sessionID: SESSION,
4971+
formID: colorForm.id,
4972+
answer: { q0: "Red" },
4973+
}),
4974+
reply("session.form.reply", null),
4975+
event("session.execution.succeeded", { sessionID: SESSION }),
4976+
],
4977+
{ replayGate: gate },
4978+
).pipe(
4979+
Effect.provideService(ProviderContinuationRequests.ProviderContinuationRequests, {
4980+
offer: (request) => Deferred.succeed(offered, request).pipe(Effect.asVoid),
4981+
take: Effect.never,
4982+
}),
4983+
);
4984+
yield* runtime.resumeThread({
4985+
providerThread: {
4986+
...thread,
4987+
id: ProviderThreadId.make("provider-thread:opencode2-adapter:other"),
4988+
nativeThreadRef: { driver: OPENCODE_PROVIDER, nativeId: OTHER, strength: "strong" },
4989+
},
4990+
threadId,
4991+
modelSelection: bigPickle,
4992+
runtimePolicy: policy(),
4993+
});
4994+
const collected: Array<ProviderAdapter.ProviderAdapterV2Event> = [];
4995+
const formSeen = yield* Deferred.make<void>();
4996+
const replayed = yield* Deferred.make<void>();
4997+
const ended = yield* Deferred.make<void>();
4998+
const otherVariant = (event: ProviderAdapter.ProviderAdapterV2Event) =>
4999+
event.type === "provider_thread.updated" &&
5000+
event.providerThread.nativeThreadRef?.nativeId === OTHER
5001+
? event.providerThread.nativeMetadata?.modelSelection?.options?.[0]?.value
5002+
: undefined;
5003+
yield* runtime.events.pipe(
5004+
Stream.tap((event) =>
5005+
Effect.gen(function* () {
5006+
collected.push(event);
5007+
if (otherVariant(event) === "none") yield* Deferred.succeed(formSeen, undefined);
5008+
if (otherVariant(event) === "thinking") yield* Deferred.succeed(replayed, undefined);
5009+
if (collected.filter((entry) => entry.type === "turn.terminal").length === 2) {
5010+
yield* Deferred.succeed(ended, undefined);
5011+
}
5012+
}),
5013+
),
5014+
Stream.runDrain,
5015+
Effect.forkScoped,
5016+
);
5017+
yield* runtime.startTurn(withLineage(thread));
5018+
const offer = yield* Deferred.await(offered);
5019+
yield* Deferred.await(formSeen);
5020+
yield* runtime.startTurn(continuationTurn(thread, offer));
5021+
gate.release("continued");
5022+
yield* Deferred.await(replayed);
5023+
const requests = collected.flatMap((event) =>
5024+
event.type === "runtime_request.updated" && event.runtimeRequest.status === "pending"
5025+
? [event.runtimeRequest]
5026+
: [],
5027+
);
5028+
assert.deepEqual(
5029+
requests.map((request) => request.nativeRequestRef?.nativeId),
5030+
[colorForm.id],
5031+
);
5032+
yield* runtime.respondToRuntimeRequest({
5033+
requestId: requests[0]!.id,
5034+
answers: { q0: "Red" },
5035+
});
5036+
yield* Deferred.await(ended);
5037+
const last = collected.findLast((event) => event.type === "turn.terminal");
5038+
assert.equal(last?.type === "turn.terminal" ? last.status : undefined, "completed");
5039+
}).pipe(Effect.scoped),
5040+
);
5041+
49345042
it.effect("ends a follow-up turn a steer joined exactly once", () =>
49355043
Effect.gen(function* () {
49365044
const reportText = `<subagent sessionID="${CHILD}" state="completed" description="Sleep">\nCHILD_OK\n</subagent>`;

‎apps/server/src/provider/antigravityUsageLimits.test.ts‎

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ const fixture = Effect.fn("AntigravityUsageTest.fixture")(function* (
6565
userId?: string;
6666
userInfoAt?: number;
6767
missingToken?: boolean;
68-
authMethod?: "oauth-personal" | "gemini-api-key";
68+
authMethod?: "oauth-personal" | "oauth-business" | "gemini-api-key";
6969
} = {},
7070
) {
7171
const fs = yield* FileSystem.FileSystem;
@@ -330,11 +330,12 @@ describe("Antigravity subscription limits", () => {
330330
}).pipe(Effect.scoped, Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))),
331331
);
332332

333-
// Oracle: the existing endpoint merge keeps the most-used reading.
334-
it.effect("keeps the used endpoint reading and its reset over an untouched reading", () =>
333+
// Oracle: workspace sign-ins are metered on cloudcode-pa, so its reading wins even when less used.
334+
it.effect("reports a business account's quota from the endpoint it is metered on", () =>
335335
Effect.gen(function* () {
336336
yield* TestClock.setTime(DateTime.toEpochMillis(DateTime.makeUnsafe("2026-10-21T10:16:04Z")));
337337
const { probe } = yield* fixture({
338+
authMethod: "oauth-business",
338339
summaryByHost: {
339340
"daily-cloudcode-pa.googleapis.com": {
340341
buckets: [
@@ -383,9 +384,8 @@ describe("Antigravity subscription limits", () => {
383384
id: "3p-weekly",
384385
label: "Claude & GPT (shared) · Weekly",
385386
kind: "weekly",
386-
usedPercent: 50,
387+
usedPercent: 0,
387388
windowDurationMins: 10080,
388-
resetsAt: "2026-10-27T10:16:04.000Z",
389389
},
390390
]);
391391
}).pipe(Effect.scoped, Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))),
@@ -474,7 +474,43 @@ describe("Antigravity subscription limits", () => {
474474
const byId = new Map(limits.windows.map((window) => [window.id, window]));
475475
expect(byId.get("gemini-weekly")?.label).toBe("Gemini · Weekly");
476476
expect(byId.get("3p-5h")?.usedPercent).toBeCloseTo(70);
477-
expect(byId.get("3p-weekly")?.usedPercent).toBe(100);
477+
expect(byId.get("3p-weekly")?.usedPercent).toBe(50);
478+
}).pipe(Effect.scoped, Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))),
479+
);
480+
481+
// Oracle: reported payloads for a personal sign-in, whose runtime meters on the daily endpoint.
482+
it.effect("reports a personal account's quota from the daily endpoint it is metered on", () =>
483+
Effect.gen(function* () {
484+
yield* TestClock.setTime(DateTime.toEpochMillis(DateTime.makeUnsafe("2026-11-07T12:00:00Z")));
485+
const argon = (remainingFraction: number, resetTime: string) => ({
486+
groups: [
487+
{
488+
displayName: "Gemini 4 Argon",
489+
buckets: [
490+
{
491+
bucketId: "gemini-argon-wtu-weekly",
492+
window: "weekly",
493+
remainingFraction,
494+
resetTime,
495+
},
496+
],
497+
},
498+
],
499+
});
500+
const { probe } = yield* fixture({
501+
authMethod: "oauth-personal",
502+
summaryByHost: {
503+
"daily-cloudcode-pa.googleapis.com": argon(0.8623059, "2026-11-14T08:41:35Z"),
504+
"cloudcode-pa.googleapis.com": argon(0, "2026-11-08T18:27:14Z"),
505+
},
506+
});
507+
expect((yield* probe).windows).toEqual([
508+
expect.objectContaining({
509+
id: "gemini-argon-wtu-weekly",
510+
usedPercent: expect.closeTo(13.77, 2),
511+
resetsAt: "2026-11-14T08:41:35.000Z",
512+
}),
513+
]);
478514
}).pipe(Effect.scoped, Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))),
479515
);
480516

‎apps/server/src/provider/antigravityUsageLimits.ts‎

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,14 @@ import {
1515
makeUsageLimits,
1616
} from "@t3tools/provider-core/server/usageLimits";
1717

18-
const ENDPOINTS = [
19-
"https://daily-cloudcode-pa.googleapis.com",
20-
"https://cloudcode-pa.googleapis.com",
21-
];
18+
const DAILY_ENDPOINT = "https://daily-cloudcode-pa.googleapis.com";
19+
const PROD_ENDPOINT = "https://cloudcode-pa.googleapis.com";
20+
// The ACP runtime meters consumer tiers on the daily host and GCP-terms tiers on prod.
21+
// The sign-in method stands in for the tier.
22+
const ENDPOINTS = {
23+
"oauth-personal": [DAILY_ENDPOINT, PROD_ENDPOINT],
24+
"oauth-business": [PROD_ENDPOINT, DAILY_ENDPOINT],
25+
};
2226
const SUMMARY_WINDOW_MINS = new Map([
2327
["5h", 5 * 60],
2428
["weekly", 7 * 24 * 60],
@@ -269,7 +273,8 @@ export const makeAntigravityUsageProbe = Effect.fn("makeAntigravityUsageProbe")(
269273
accessToken = cached.accessToken;
270274
account = cached.account;
271275
}
272-
// Merge endpoints because quota groups differ; keep each bucket's most-used reading.
276+
const endpoints = ENDPOINTS[input.authMethod];
277+
// Merge endpoints because quota groups differ; the metered host's reading of a bucket wins.
273278
const fetchWindows = Effect.fn("AntigravityUsageProbe.fetchWindows")(function* <E>(
274279
operation: string,
275280
parse: (
@@ -278,7 +283,7 @@ export const makeAntigravityUsageProbe = Effect.fn("makeAntigravityUsageProbe")(
278283
) => Effect.Effect<ServerProviderUsageWindow[], E>,
279284
) {
280285
const responses = yield* Effect.forEach(
281-
ENDPOINTS,
286+
endpoints,
282287
(endpoint) =>
283288
Effect.gen(function* () {
284289
// Capture each request after auth, so refresh latency does not widen the tolerance.
@@ -302,8 +307,7 @@ export const makeAntigravityUsageProbe = Effect.fn("makeAntigravityUsageProbe")(
302307
);
303308
const windows = new Map<string, ServerProviderUsageWindow>();
304309
for (const window of responses.flat()) {
305-
const previous = windows.get(window.id);
306-
if (!previous || window.usedPercent > previous.usedPercent) windows.set(window.id, window);
310+
if (!windows.has(window.id)) windows.set(window.id, window);
307311
}
308312
return [...windows.values()];
309313
});

‎apps/server/src/vcs/GitVcsDriver.test.ts‎

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,33 @@ it.effect("checkpoint capture skips an ignored project while keeping its allowed
406406
}).pipe(Effect.scoped, Effect.provide(layerGitContract)),
407407
);
408408

409+
it.effect.each([
410+
{ workspace: "the repository root", subdirectory: "" },
411+
{ workspace: "a subdirectory", subdirectory: "sub" },
412+
])(
413+
"checkpoint capture keeps new files in $workspace when the root .gitignore has a blank CRLF line",
414+
({ subdirectory }) =>
415+
Effect.gen(function* () {
416+
const fs = yield* FileSystem.FileSystem;
417+
const path = yield* Path.Path;
418+
const driver = yield* GitVcsDriver.makeVcsDriverShape();
419+
const parent = yield* fs.makeTempDirectoryScoped({ prefix: "t3-checkpoint-crlf-ignore-" });
420+
const { git, checkpointRef } = yield* makeCheckpointFixture(driver, parent);
421+
yield* fs.writeFileString(path.join(parent, ".gitignore"), "a.txt\r\n\r\nb.txt\r\n");
422+
const cwd = path.join(parent, subdirectory);
423+
yield* fs.makeDirectory(cwd, { recursive: true });
424+
yield* fs.writeFileString(path.join(cwd, "notes.md"), "notes\n");
425+
const notesPath = subdirectory === "" ? "notes.md" : `${subdirectory}/notes.md`;
426+
427+
yield* driver.checkpoints.captureCheckpoint({ cwd, checkpointRef });
428+
429+
assert.include(
430+
(yield* git(["ls-tree", "-r", "--name-only", checkpointRef])).stdout.split("\n"),
431+
notesPath,
432+
);
433+
}).pipe(Effect.scoped, Effect.provide(layerGitContract)),
434+
);
435+
409436
it.effect.each([
410437
{ tracking: "committed-only", committed: ["committed.txt"], staged: [] },
411438
{ tracking: "staged-only", committed: [], staged: ["staged.txt"] },
@@ -1007,7 +1034,6 @@ it.effect.each(["committed", "unborn"] as const)(
10071034
"rev-parse",
10081035
"config",
10091036
...(head === "committed" ? ["read-tree", "ls-files"] : []),
1010-
"check-ignore",
10111037
"add",
10121038
"write-tree",
10131039
"commit-tree",
@@ -1060,13 +1086,13 @@ it.effect.skipIf(HostProcess.Platform.defaultValue() === "win32")(
10601086
const commands = yield* captureRecordingGitCommands(cwd, checkpointRef);
10611087

10621088
assert.deepStrictEqual(commands, [
1089+
"rev-parse",
10631090
"rev-parse",
10641091
"rev-parse",
10651092
"config",
10661093
"rev-parse",
10671094
"read-tree",
10681095
"ls-files",
1069-
"check-ignore",
10701096
"add",
10711097
"write-tree",
10721098
"commit-tree",

0 commit comments

Comments
 (0)