Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
70e4319
fix(web): switching back to a thread no longer jumps through its HTML…
pouyarezvani Nov 18, 2026
a93e61a
fix(mobile): A document whose upload failed can be retried in the com…
mwolson Nov 18, 2026
281d3e1
fix(server): running a paused one-time task by hand no longer deletes…
juliusmarminge Nov 18, 2026
a1b1a63
fix(server): codex text generation identifies as T3 Code (#38464)
juliusmarminge Nov 18, 2026
7c67d19
fix(server): review diff previews reuse the cached repository layout …
amv146 Nov 18, 2026
01cfac4
fix(web): Paste as Text pastes text when the clipboard also holds an …
juliusmarminge Nov 18, 2026
f5f8c8d
fix(web): opening a file in the preview browser shows its current con…
juliusmarminge Nov 18, 2026
77f87ea
fix(github): page closing pull requests past the first twenty on issu…
StiensWout Nov 18, 2026
b648395
fix(web): older comments no longer reappear after refreshing an issue…
StiensWout Nov 18, 2026
9758cf9
fix(web): typing into a simulator no longer answers a waiting questio…
ipanasenko Nov 18, 2026
8a6342e
fix(server): keep-awake logs a hold only once acquired and reports wh…
juliusmarminge Nov 18, 2026
37e9217
fix(server): write the Windows service task as UTF-16LE so non-ASCII …
juliusmarminge Nov 18, 2026
a1f8dcf
fix(muse): failed Muse text generation explains Muse's error category…
saphid Nov 18, 2026
486ba48
fix(server): imported Claude threads show prompts, not Claude Code ma…
dominikzabcik Nov 18, 2026
316c325
fix(server): a resumed Claude subagent keeps its earlier result (#34663)
ahalekelly Nov 18, 2026
ce884e3
fix(server): a preview navigation request issued before its frame exi…
Isaac-b-ux Nov 18, 2026
d0a754d
fix(server): label Copilot rg calls as file searches (#38512)
amv146 Nov 18, 2026
75514df
fix(web): keep Ready pending label until its request finishes (#38517)
Yash-Singh1 Nov 18, 2026
1c41c5e
fix(azure-devops): issue lists reuse each project's states and surviv…
juliusmarminge Nov 18, 2026
fe1f1a5
fix(acp): Devin terminals no longer inherit the launching thread's T3…
ianrowe12 Nov 18, 2026
0d405f6
fix(web): a ~\ home path opens as a read-only home file, not as a pro…
SouthCarpet Nov 18, 2026
e6265a9
fix(web): thread jump hints re-check when a modifier changes while th…
juliusmarminge Nov 18, 2026
3babab1
fix(server): Changes base follows the remote a plain recorded base br…
juliusmarminge Nov 18, 2026
2d558c4
fix(web): the issue viewer shows why a refresh failed (#38537)
StiensWout Nov 18, 2026
3a5c4d5
Merge remote-tracking branch 'origin/main' into upstream-sync
D3SOX Nov 18, 2026
1609536
test(server): read the repaired service unit as its encoding
D3SOX Nov 18, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion apps/mobile/src/components/ComposerAttachmentStrip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@ function ComposerFileAttachment(
const canPreview = isPdfFile(attachment) && props.onPressPreview !== undefined;
const sourceIdentifier = `draft-file:${attachment.id}`;
const onPressDocument = props.onPressDocument;
const upload = useComposerAttachmentUploadState(props.environmentId, attachment.id);
const showsUploadBadge = upload !== undefined && upload.status !== "ready";
return (
<>
<PresentationSource identifier={sourceIdentifier}>
Expand All @@ -235,7 +237,7 @@ function ComposerFileAttachment(
className={
props.compact
? "items-center justify-center bg-subtle"
: "items-center justify-center gap-1 bg-subtle px-2"
: `items-center justify-center gap-1 bg-subtle px-2${showsUploadBadge ? " pb-4" : ""}`
}
style={style}
>
Expand Down
62 changes: 17 additions & 45 deletions apps/mobile/src/features/issues/IssueRouteScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { RegistryContext, useAtomValue } from "@effect/atom-react";
import { StackActions, useNavigation, type StaticScreenProps } from "@react-navigation/native";
import { issueEventSentence } from "@t3tools/client-runtime/issue-presentation";
import { sourceControlClients } from "@t3tools/client-runtime/source-control-clients";
import { prependIssueComments } from "@t3tools/client-runtime/state/issues";
import { createIssueCommentPager } from "@t3tools/client-runtime/state/issues";
import type {
IssueComment,
IssueEvent,
Expand All @@ -12,7 +13,7 @@ import type {
} from "@t3tools/contracts";
import { AsyncResult } from "effect/reactivity";
import { T, useGT, useMessages, Var } from "gt-react-native";
import { useRef, useState } from "react";
import { useContext, useState } from "react";
import { Linking, Platform, Pressable, Share, View } from "react-native";
import { KeyboardStickyView } from "react-native-keyboard-controller";

Expand Down Expand Up @@ -403,32 +404,23 @@ function IssueRoute({ params }: { readonly params: IssueParams }) {
const detailAtom = issueEnvironment.detail(target);
const detailQuery = useEnvironmentQuery(detailAtom);
const pullRefresh = usePullToRefresh(detailAtom);
const registry = useContext(RegistryContext);
const [pager] = useState(() => createIssueCommentPager(detailAtom));
const { comments, nextCursor, loadingOlder, canLoadOlder } = useAtomValue(pager.view);
const detail = detailQuery.data;
const issue: IssueSummary | null = detail ?? params.initialSummary ?? null;
const access = useIssueAccess(params, detail);

const loadComments = useAtomCommand(issueEnvironment.comments, { reportFailure: false });
const postComment = useAtomCommand(issueEnvironment.comment, { reportFailure: false });
const setState = useAtomCommand(issueEnvironment.setState, { reportFailure: false });
const [older, setOlder] = useState<{
readonly seed: string | null;
readonly comments: ReadonlyArray<IssueComment>;
readonly cursor: string | null;
} | null>(null);
const [busy, setBusy] = useState<"older" | "comment" | "state" | null>(null);
const [busy, setBusy] = useState<"comment" | "state" | null>(null);
const [error, setError] = useState<string | null>(null);
const [composerHeight, setComposerHeight] = useState(0);

// Older pages are tied to the cursor the detail was read with; a refreshed detail starts over.
const olderComments = detail && older?.seed === detail.commentsCursor ? older.comments : [];
const nextCursor = !detail
? null
: older?.seed === detail.commentsCursor
? older.cursor
: detail.commentsCursor;
const timeline = detail
? [
...prependIssueComments(detail.comments, olderComments).map((comment) => ({
...comments.map((comment) => ({
key: `c:${comment.id}`,
at: comment.createdAt,
content: (
Expand All @@ -447,7 +439,7 @@ function IssueRoute({ params }: { readonly params: IssueParams }) {
kind: NonNullable<typeof busy>,
command: () => Promise<AsyncResult.AsyncResult<unknown, unknown>>,
) => {
if (busy !== null) return false;
if (busy !== null || registry.get(pager.view).loadingOlder) return false;
setBusy(kind);
setError(null);
const failure = issueCommandError(await command());
Expand All @@ -457,28 +449,13 @@ function IssueRoute({ params }: { readonly params: IssueParams }) {
if (failure === null) refreshIssueLists(target.environmentId);
return failure === null;
};
// Counts refreshes, so a page asked for before one is not laid over the read that follows it.
const refreshes = useRef(0);
const loadOlder = async () => {
if (!detail || nextCursor === null || busy !== null) return;
const asked = refreshes.current;
setBusy("older");
setError(null);
const result = await loadComments({
...target,
input: { ...target.input, cursor: nextCursor },
});
setBusy(null);
if (asked !== refreshes.current) return;
if (AsyncResult.isFailure(result)) {
setError(gt("Older comments could not be read."));
return;
}
setOlder({
seed: detail.commentsCursor,
comments: prependIssueComments(olderComments, result.value.comments),
cursor: result.value.nextCursor,
if (busy !== null) return;
const failure = await pager.loadOlder(registry, (cursor) => {
setError(null);
return loadComments({ ...target, input: { ...target.input, cursor } });
});
if (failure) setError(gt("Older comments could not be read."));
};
const submitComment = (body: string) =>
access?.comment === true
Expand Down Expand Up @@ -575,12 +552,7 @@ function IssueRoute({ params }: { readonly params: IssueParams }) {
refreshControl={
<RefreshControl
refreshing={pullRefresh.refreshing}
onRefresh={() => {
// Older pages are cached under the cursor, which a refresh can hand back unchanged.
refreshes.current += 1;
setOlder(null);
pullRefresh.onRefresh();
}}
onRefresh={() => void pager.refresh(registry, pullRefresh.onRefresh)}
/>
}
contentContainerStyle={{
Expand Down Expand Up @@ -652,8 +624,8 @@ function IssueRoute({ params }: { readonly params: IssueParams }) {
</PullRequestSectionHeading>
{nextCursor !== null ? (
<Button
label={busy === "older" ? gt("Loading…") : gt("Load older comments")}
disabled={busy !== null}
label={loadingOlder ? gt("Loading…") : gt("Load older comments")}
disabled={busy !== null || !canLoadOlder}
onPress={() => void loadOlder()}
/>
) : null}
Expand Down
9 changes: 7 additions & 2 deletions apps/mobile/src/features/threads/ThreadComposer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ import {
composerStripAttachments,
type DraftComposerFileAttachment,
} from "../../lib/composerImages";
import { composerAttachmentUploadKey } from "../../lib/composerAttachmentUploadQueue";
import {
buildModelOptions,
isModelSelectionUnavailable,
Expand Down Expand Up @@ -352,8 +353,6 @@ export const ThreadComposer = function ThreadComposer(props: ThreadComposerProps
draftMessage.trim().length > 0 ||
draftAttachments.length > 0 ||
(queuedEdit?.existingAttachments.length ?? 0) > 0;
// Only media belongs above the composer; every other file reads as its inline chip.
const stripAttachments = composerStripAttachments(draftAttachments);
// Stopping the agent is not what the send button means in edit mode.
const showStopAction =
stopping || (!sending && !hasContent && props.canStopThread && queuedEdit === null);
Expand All @@ -373,6 +372,12 @@ export const ThreadComposer = function ThreadComposer(props: ThreadComposerProps
AuthOrchestrationOperateScope,
);
const uploadStates = useAtomValue(composerAttachmentUploadsAtom);
const stripAttachments = composerStripAttachments(
draftAttachments,
(attachment) =>
uploadStates[composerAttachmentUploadKey(props.environmentId, attachment.id)]?.status ===
"failed",
);
const attachmentsUploading =
props.connectionState === "connected" &&
composerAttachmentsStillUploading({
Expand Down
16 changes: 11 additions & 5 deletions apps/mobile/src/lib/composerImages.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,10 +332,16 @@ describe("composerStripAttachments", () => {

it("keeps media beside a document rather than dropping the whole strip", async () => {
const { composerStripAttachments } = await import("./composerImages");
expect(composerStripAttachments([doc, image, video] as never).map((a) => a.id)).toEqual([
"img-1",
"vid-1",
]);
expect(
composerStripAttachments([doc, image, video] as never, () => false).map((a) => a.id),
).toEqual(["img-1", "vid-1"]);
});

it("shows a document whose upload failed, so it can be retried", async () => {
const { composerStripAttachments } = await import("./composerImages");
expect(
composerStripAttachments([doc, image] as never, (a) => a.id === "doc-1").map((a) => a.id),
).toEqual(["doc-1", "img-1"]);
});

it("keeps oversized document-picked images visible while sending them as files", async () => {
Expand All @@ -350,7 +356,7 @@ describe("composerStripAttachments", () => {
sizeBytes: PROVIDER_SEND_TURN_MAX_IMAGE_BYTES + 1,
};

expect(composerStripAttachments([oversizedImage])).toEqual([oversizedImage]);
expect(composerStripAttachments([oversizedImage], () => false)).toEqual([oversizedImage]);
expect(isComposerImageAttachment(oversizedImage)).toBe(false);
});
});
9 changes: 7 additions & 2 deletions apps/mobile/src/lib/composerImages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,20 @@ export async function createPastedTextComposerAttachment(input: {

export type DraftComposerAttachment = DraftComposerImageAttachment | DraftComposerFileAttachment;

/** Non-media attachments require chip references; missing references mean lost draft files. */
/**
* Non-media attachments require chip references; missing references mean lost draft files.
* A chip cannot retry an upload, so a document whose upload failed joins the strip.
*/
export function composerStripAttachments(
attachments: ReadonlyArray<DraftComposerAttachment>,
uploadFailed: (attachment: DraftComposerAttachment) => boolean,
): ReadonlyArray<DraftComposerAttachment> {
return attachments.filter(
(attachment) =>
attachment.type === "image" ||
imageMimeType(attachment) !== null ||
videoMimeType(attachment) !== null,
videoMimeType(attachment) !== null ||
uploadFailed(attachment),
);
}

Expand Down
4 changes: 2 additions & 2 deletions apps/mobile/src/state/use-pull-to-refresh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ export function usePullToRefresh<A, E>(atom: Atom.Atom<AsyncResult.AsyncResult<A
[atom],
);

const onRefresh = (beforeRefresh?: (signal: AbortSignal) => Promise<unknown>) => {
const onRefresh = async (beforeRefresh?: (signal: AbortSignal) => Promise<unknown>) => {
if (!atom || (request.current?.atom === atom && !request.current.controller.signal.aborted))
return;
request.current?.controller.abort();
const controller = new AbortController();
request.current = { atom, controller };
setRefreshingAtom(atom);
void Promise.resolve()
await Promise.resolve()
.then(() => {
if (!controller.signal.aborted) return beforeRefresh?.(controller.signal);
})
Expand Down
77 changes: 52 additions & 25 deletions apps/server/src/background/KeepAwake.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import * as Duration from "effect/Duration";
import * as Effect from "effect/Effect";
import * as Fiber from "effect/Fiber";
import * as FileSystem from "effect/FileSystem";
import * as Layer from "effect/Layer";
import * as Ref from "effect/Ref";
import * as ChildProcess from "effect/process/ChildProcess";
import * as ChildProcessSpawner from "effect/process/ChildProcessSpawner";
import * as Schedule from "effect/Schedule";
Expand All @@ -19,9 +21,12 @@ import * as Settings from "../serverSettings.ts";
const RELEASE_GRACE = Duration.seconds(60);

// ES_CONTINUOUS | ES_SYSTEM_REQUIRED, held by the calling thread until the script ends.
const WINDOWS_HOLD_SCRIPT = `$t = Add-Type -Name Power -Namespace T3 -PassThru -MemberDefinition '[DllImport("kernel32.dll")] public static extern uint SetThreadExecutionState(uint f);'; [void]$t::SetThreadExecutionState([uint32]2147483649)`;
const WINDOWS_HOLD_SCRIPT = `$t = Add-Type -Name Power -Namespace T3 -PassThru -MemberDefinition '[DllImport("kernel32.dll")] public static extern uint SetThreadExecutionState(uint f);'; [void]$t::SetThreadExecutionState([uint32]2147483649); [Console]::Out.WriteLine()`;

/** Each command holds its inhibitor until it exits, and exits on its own if the server dies. */
/**
* Each command writes a line to stdout once it holds its inhibitor, holds it until it exits, and
* exits on its own if the server dies.
*/
function inhibitorCommand(
platform: NodeJS.Platform,
serverPid: number,
Expand Down Expand Up @@ -49,7 +54,11 @@ function inhibitorCommand(
}
switch (platform) {
case "darwin":
return { command: "caffeinate", args: ["-i", "-w", String(serverPid)], stdin: "ignore" };
return {
command: "sh",
args: ["-c", 'echo && exec caffeinate -i -w "$0"', String(serverPid)],
stdin: "ignore",
};
case "linux":
return {
command: "systemd-inhibit",
Expand All @@ -58,10 +67,11 @@ function inhibitorCommand(
"--who=T3 Code",
"--why=Agents are working",
"--mode=block",
"tail",
`--pid=${serverPid}`,
"-f",
"/dev/null",
// systemd-inhibit starts this only after logind grants the lock.
"sh",
"-c",
'echo && exec tail --pid="$0" -f /dev/null',
String(serverPid),
],
stdin: "ignore",
};
Expand Down Expand Up @@ -117,8 +127,12 @@ const retryWithBackoff =

class KeepAwakeInhibitorExited extends Schema.TaggedError<KeepAwakeInhibitorExited>()(
"KeepAwakeInhibitorExited",
{ exitCode: Schema.Number },
) {}
{ exitCode: Schema.Number, stderr: Schema.String },
) {
override get message(): string {
return `sleep inhibitor exited with code ${this.exitCode}${this.stderr ? `: ${this.stderr}` : ""}`;
}
}

export const layer = Layer.effectDiscard(
Effect.gen(function* () {
Expand Down Expand Up @@ -188,29 +202,42 @@ export const layer = Layer.effectDiscard(
}),
);

const holdOnce = spawner
.spawn(
const holdOnce = Effect.gen(function* () {
const child = yield* spawner.spawn(
ChildProcess.make(command.command, command.args, {
detached: false,
shell: false,
stdin: command.stdin,
stdout: "ignore",
stderr: "ignore",
stdout: "pipe",
stderr: "pipe",
}),
)
.pipe(
Effect.tap((child) =>
Effect.logInfo("keep-awake holding sleep inhibitor", { pid: Number(child.pid) }),
),
Effect.tap(() =>
Effect.addFinalizer(() => Effect.logInfo("keep-awake released sleep inhibitor")),
),
Effect.flatMap((child) => child.exitCode),
Effect.flatMap((exitCode) =>
Effect.fail(new KeepAwakeInhibitorExited({ exitCode: Number(exitCode) })),
);
const stderr = yield* child.stderr.pipe(
Stream.decodeText(),
Stream.mkString,
Effect.forkScoped,
);
const held = yield* Ref.make(false);
yield* Effect.addFinalizer(() =>
Effect.when(Effect.logInfo("keep-awake released sleep inhibitor"), Ref.get(held)),
);
yield* child.stdout.pipe(
Stream.take(1),
Stream.runForEach(() =>
Ref.set(held, true).pipe(
Effect.andThen(
Effect.logInfo("keep-awake holding sleep inhibitor", { pid: Number(child.pid) }),
),
),
),
Effect.scoped,
Effect.forkScoped,
);
const exitCode = yield* child.exitCode;
return yield* new KeepAwakeInhibitorExited({
exitCode: Number(exitCode),
stderr: (yield* Fiber.join(stderr)).trim(),
});
}).pipe(Effect.scoped);
const hold = holdOnce.pipe(
retryWithBackoff("keep-awake sleep inhibitor stopped"),
Effect.ignore,
Expand Down
5 changes: 4 additions & 1 deletion apps/server/src/cli/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import {
} from "../cloud/pinnedRuntime.ts";
import {
compareExactServiceVersions,
decodeServiceUnit,
isExactServiceVersion,
SERVICE_LAUNCHER_PROTOCOL,
} from "../cloud/serviceProtocol.ts";
Expand Down Expand Up @@ -585,7 +586,9 @@ export const runUpdate = Effect.fn("cli.update.run")(function* (input: {
// A handed-off service install rewrites the unit later, while the old launcher may be stopped.
if (servicePlan?.handedOff !== true) {
// A stopped service's unit still names the launcher runtime it will start.
const unit = yield* fs.readFileString(status.unitPath).pipe(Effect.option);
const unit = yield* fs
.readFile(status.unitPath)
.pipe(Effect.map(decodeServiceUnit), Effect.option);
yield* prunePinnedRuntimes({
baseDir: input.baseDir,
keep: [currentVersion, targetVersion],
Expand Down
Loading
Loading