Compare commits

...
Author SHA1 Message Date
Cursor AgentandTheo Browne c660f28750 Raise web unit test budget to 60s and refresh flaky-test notes
The MessagesTimeline attachment-anchor test hit the 15s web budget in
CI while every package's suite competed for the same cores; match the
root config's 60s budget. Update the cloud rules to describe the fixed
flakes and point future polling waits at pollUntil.

Co-authored-by: Theo Browne <[email protected]>
2026-07-07 21:05:09 +00:00
Cursor AgentandTheo Browne 13ed3db77c Drop tight per-test timeout overrides in GitManager tests
Six cross-repo PR tests carried 12s/20s per-test timeouts from when
the suite default was Vitest's 5s. The server suite now sets a 120s
budget precisely because these git-subprocess-heavy tests can crawl on
loaded CI hosts, so the leftover overrides only shrank the budget and
made the tests time out spuriously. Remove them so the tests inherit
the configured default.

Co-authored-by: Theo Browne <[email protected]>
2026-07-07 21:05:08 +00:00
Cursor AgentandTheo Browne 0ebee5e202 Poll on the live clock for out-of-process waits in server tests
CursorAdapter.test.ts polled its mock-agent request log with bare
Effect.yieldNow loops, and ProviderRegistry.test.ts polled real
child-process probe results with TestClock.adjust + yieldNow. Neither
gives the child process or libuv any wall-clock time, so on loaded CI
hosts the session/cancel log line or the re-probe spawn landed after
the ~40 microtask hops and the tests failed on stale data.

Add a shared pollUntil test helper that sleeps on the live clock via
TestClock.withLive between attempts and dies loudly with the last
polled value on timeout, and use it for all cross-process waits in
both test files. Also make readJsonLines skip partially written
trailing lines while a child process is still appending.

Co-authored-by: Theo Browne <[email protected]>
2026-07-07 21:04:57 +00:00
b9cc8d6ef1 Set up Cursor Cloud dev environment (web + Android toolchain) (#3755)
Co-authored-by: Cursor Agent <[email protected]>
Co-authored-by: Theo Browne <[email protected]>
2026-07-07 13:18:58 -07:00
Julius MarmingeandClaude Fable 5 0e0040832c Expose Clerk Google sign-in env vars to Expo (#3772)
Co-authored-by: Claude Fable 5 <[email protected]>
2026-07-07 12:45:40 -07:00
Julius Marminge cd8b9fc8b3 Revert "Add T3 Connect onboarding for mobile and web" (#3776) 2026-07-07 12:40:12 -07:00
Julius Marminge fa6073e2e1 Add T3 Connect onboarding for mobile and web (#3765) 2026-07-07 12:39:56 -07:00
Julius Marminge 4eb1b57933 Lead with the outcome when no agents are active in the Live Activity (#3768) 2026-07-07 09:12:52 -07:00
Julius Marminge 4414f922fe Clear VCS presentation state on finish (#3764) 2026-07-07 08:54:27 -07:00
Julius Marminge 6e42231cb1 Extend Done display to 15 minutes and show up to 5 Live Activity banner rows (#3761) 2026-07-07 02:00:36 -07:00
Julius Marminge bdf5aed665 Fix Expo widget asset wiring order (#3763) 2026-07-07 02:00:10 -07:00
Julius Marminge 0b62e2eb11 Use variant-specific splash icons in mobile app (#3762) 2026-07-07 01:59:13 -07:00
Julius Marminge f9727d0853 Prevent Add Project sheet from collapsing on relayout (#3759) 2026-07-07 01:58:29 -07:00
27 changed files with 998 additions and 679 deletions

No files matched your search

+76
View File
@@ -0,0 +1,76 @@
---
description: Cursor Cloud environment setup and run notes for T3 Code (Cursor-specific; not for other editors/CI)
alwaysApply: true
---
# Cursor Cloud specific instructions
These notes apply only to Cursor Cloud agents (kept out of the shared `AGENTS.md` since T3 Code is
developed in many places). They cover the pre-provisioned VM environment and non-obvious run caveats.
## Toolchain
Pre-installed and wired into login shells (`~/.bashrc`/`~/.profile`): Node 24 (via nvm), the global
`vp` (Vite+) CLI, and its bundled pnpm. `vp` is the package manager + task runner for this repo
(`vp i`, `vp check`, `vp run typecheck`, `vp test`, `vp run --filter <pkg> <script>`).
- Node gotcha: the base image also ships an older Node on `/exec-daemon` that wins on `PATH` in
non-login shells. Run commands in a login shell (`bash -lc '...'`) or prepend
`$HOME/.nvm/versions/node/v24.13.1/bin` so Node 24 (`engines.node: ^24.13.1`) is used.
- `vp check` also runs the formatter (not just lint); markdown edits must be formatter-clean. Run
`vp check --fix` before committing.
## Running the web app
- `npm run dev` (from repo root) starts contracts (watch), web (Vite, port 5733), and the server
(`node --watch`, port 13773) together, auto-wiring `VITE_HTTP_URL`/`VITE_WS_URL`. Use
`npm run dev:server` / `npm run dev:web` for one side. If base ports are taken it auto-offsets to
the next free pair, so read the actual ports from stdout. Avoid production `build`/`start` in dev.
- Auth/pairing: the server is unauthenticated by default and prints a pairing URL to stdout on startup
(e.g. `http://localhost:5733/pair#token=XXXX`). Open that URL in the browser to pair before the web
UI can talk to the server. Server state (SQLite, auth, projects) lives under `~/.t3`
(`T3CODE_HOME`); multiple `npm run dev` instances bind different ports but share that same DB.
- Agent providers are external CLIs (`codex`, `claude`, `cursor-agent`, `opencode`) probed on `PATH`.
Without one installed the UI loads but no agent can run. Claude Code
(`npm i -g @anthropic-ai/claude-code`) works headlessly using `ANTHROPIC_API_KEY` from the
environment (the server forwards `process.env` to the child; no interactive `claude auth login`
needed). Provider probing runs at startup and refreshes roughly every 5 minutes — restart the dev
server to pick up a newly installed provider CLI immediately.
## Android native builds (apps/mobile)
The Android toolchain is pre-installed and wired into login shells: OpenJDK 17
(`JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64`; the base image's default `java` is 21, so builds must
use `JAVA_HOME`), and the Android SDK at `$HOME/Android/Sdk` (`ANDROID_HOME`/`ANDROID_SDK_ROOT`) with
platform-tools, `platforms;android-36`, `build-tools;36.0.0`, `ndk;27.1.12297006`, and `cmake;3.22.1`.
Gradle auto-downloads any additional pinned SDK packages on demand.
- Generate the native project first: from `apps/mobile`,
`EXPO_NO_GIT_STATUS=1 APP_VARIANT=development npx expo prebuild --clean --platform android`
(the `android/` folder is generated, not committed). RN 0.85 defaults: compileSdk/targetSdk 36,
minSdk 24, NDK `27.1.12297006` (see `react-native/gradle/libs.versions.toml`).
- Build with Gradle from `apps/mobile/android`, e.g. `./gradlew :app:assembleDebug`. First build is
slow (Kotlin + C++/NDK codegen). Limit ABIs to speed things up, e.g.
`-PreactNativeArchitectures=arm64-v8a`. Verified working end-to-end on a native module:
`./gradlew :react-native-worklets:assembleDebug` compiles Kotlin + C++ and emits an AAR + `.so`s.
- No emulator: this VM has no `/dev/kvm` (nested virtualization), so a hardware-accelerated Android
emulator will not run. Use a physical device (`adb`) or EAS cloud builds (`vp run eas:android:*`) to
actually run the app. The full IDE GUI is unnecessary here — the SDK/NDK/Gradle toolchain that
Android Studio bundles is what is installed.
- Known blocker for the full-app `:app:assembleDebug` (pre-existing, app-level — not the environment):
`:react-native-screens:compileDebugKotlin` fails because `patches/[email protected]`
adds new codegen props (`subtitle`, `largeSubtitle`, `navigationItemStyle`,
`headerCenterBarButtonItems`, `headerToolbarItems`) to the JS spec + iOS native code but includes no
Android Kotlin setters, so the generated `ScreenStackHeaderConfigManagerInterface` is unimplemented.
The mobile README documents only iOS for local builds and routes Android through EAS. Fixing local
Android app builds requires an app/patch change (add the Android Kotlin setters), which is out of
scope for environment setup.
## Known flaky tests (unrelated to setup)
Previously flaky suites (`GitManager` cross-repo PR timeouts, `ProviderRegistry` codex binaryPath
re-probe, `CursorAdapter` interrupt/cancel log polling) were fixed by removing tight per-test
timeout overrides and polling on the live clock via `apps/server/src/provider/testUtils/pollUntil.ts`.
If a test needs to wait for out-of-process work (child processes, real spawns, file appends from
another process) under `it.effect`'s `TestClock`, use `pollUntil` — `Effect.yieldNow` loops and
`TestClock.adjust` provide no wall-clock time and will flake on loaded CI hosts.
+4 -1
View File
@@ -57,7 +57,10 @@ jobs:
with:
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}
packager: pnpm
# npm, not pnpm: this only installs eas-cli into the action's own
# tool dir, and pnpm 11 hard-fails that install on dtrace-provider's
# ignored build script (no allowBuilds config outside the repo).
packager: npm
- name: Pull preview environment variables
if: steps.expo-token.outputs.present == 'true'
+4 -1
View File
@@ -80,7 +80,10 @@ jobs:
with:
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}
packager: pnpm
# npm, not pnpm: this only installs eas-cli into the action's own
# tool dir, and pnpm 11 hard-fails that install on dtrace-provider's
# ignored build script (no allowBuilds config outside the repo).
packager: npm
- name: Pull production environment variables
if: steps.expo-token.outputs.present == 'true'
+21 -5
View File
@@ -15,6 +15,7 @@ const VARIANT_CONFIG: Record<
readonly appName: string;
readonly scheme: string;
readonly iosIcon: string;
readonly splashIcon: string;
readonly iosBundleIdentifier: string;
readonly androidPackage: string;
readonly relyingParty?: string;
@@ -24,6 +25,7 @@ const VARIANT_CONFIG: Record<
appName: "T3 Code Dev",
scheme: "t3code-dev",
iosIcon: "./assets/icon-composer-dev.icon",
splashIcon: "./assets/splash-icon-dev.png",
iosBundleIdentifier: "com.t3tools.t3code.dev",
androidPackage: "com.t3tools.t3code.dev",
relyingParty: "clerk.t3.codes",
@@ -32,6 +34,7 @@ const VARIANT_CONFIG: Record<
appName: "T3 Code Preview",
scheme: "t3code-preview",
iosIcon: "./assets/icon-composer-prod.icon",
splashIcon: "./assets/splash-icon-prod.png",
iosBundleIdentifier: "com.t3tools.t3code.preview",
androidPackage: "com.t3tools.t3code.preview",
relyingParty: "clerk.t3.codes",
@@ -40,6 +43,7 @@ const VARIANT_CONFIG: Record<
appName: "T3 Code",
scheme: "t3code",
iosIcon: "./assets/icon-composer-prod.icon",
splashIcon: "./assets/splash-icon-prod.png",
iosBundleIdentifier: "com.t3tools.t3code",
androidPackage: "com.t3tools.t3code",
relyingParty: "clerk.t3.codes",
@@ -131,12 +135,12 @@ const config: ExpoConfig = {
[
"expo-splash-screen",
{
image: "./assets/splash-icon.png",
image: variant.splashIcon,
resizeMode: "contain",
backgroundColor: "#ffffff",
imageWidth: 220,
dark: {
image: "./assets/splash-icon.png",
image: variant.splashIcon,
backgroundColor: "#0a0a0a",
},
},
@@ -155,6 +159,12 @@ const config: ExpoConfig = {
},
],
"./plugins/withIosCocoaPodsUuidCache.cjs",
// Must be listed BEFORE expo-widgets: same-type mods run last-registered-
// first, so registering earlier makes this plugin's mods run AFTER
// expo-widgets' — its dangerous mod wipes ios/ExpoWidgetsTarget/ (which
// would delete the asset catalog) and its xcodeproj mod creates the widget
// target (which must exist before the compile phase can be attached).
"./plugins/withWidgetLogoAsset.cjs",
[
"expo-widgets",
{
@@ -174,9 +184,6 @@ const config: ExpoConfig = {
],
},
],
// Must run after expo-widgets so the widget target exists when it wires in
// the branded logo asset catalog.
"./plugins/withWidgetLogoAsset.cjs",
"./plugins/withIosSceneLifecycle.cjs",
"./plugins/withAndroidCleartextTraffic.cjs",
],
@@ -189,6 +196,15 @@ const config: ExpoConfig = {
publishableKey: repoEnv.EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY ?? null,
jwtTemplate: repoEnv.EXPO_PUBLIC_CLERK_JWT_TEMPLATE ?? null,
},
// Native Google sign-in credentials. @clerk/expo reads these from `extra`
// under their exact env-var names (not nested), and its config plugin reads
// the iOS URL scheme at prebuild to register it in Info.plist.
// Unset values must be omitted (not null): the public manifest serializes
// null to {}, which is truthy and would defeat Clerk's fallback checks.
EXPO_PUBLIC_CLERK_GOOGLE_WEB_CLIENT_ID: repoEnv.EXPO_PUBLIC_CLERK_GOOGLE_WEB_CLIENT_ID,
EXPO_PUBLIC_CLERK_GOOGLE_IOS_CLIENT_ID: repoEnv.EXPO_PUBLIC_CLERK_GOOGLE_IOS_CLIENT_ID,
EXPO_PUBLIC_CLERK_GOOGLE_ANDROID_CLIENT_ID: repoEnv.EXPO_PUBLIC_CLERK_GOOGLE_ANDROID_CLIENT_ID,
EXPO_PUBLIC_CLERK_GOOGLE_IOS_URL_SCHEME: repoEnv.EXPO_PUBLIC_CLERK_GOOGLE_IOS_URL_SCHEME,
observability: {
tracesUrl: repoEnv.EXPO_PUBLIC_OTLP_TRACES_URL ?? "https://api.axiom.co/v1/traces",
tracesDataset: repoEnv.EXPO_PUBLIC_OTLP_TRACES_DATASET ?? null,
File renamed without changes.

Before

Width:  |  Height:  |  Size: 2.0 MiB

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

@@ -9,8 +9,10 @@
// drops the compiled Assets.car into the extension bundle. Marked
// alwaysOutOfDate so the build system always runs it.
//
// Idempotent across re-runs. Returns true when it added the phase, false when it
// was already present or the target was not found.
// Idempotent across re-runs. Returns true when it added the phase, false when
// it was already present. Throws when the target does not exist — that means
// this ran before expo-widgets created the target (plugin ordering bug) and
// silently skipping would ship a widget without its assets.
const PHASE_NAME = "Compile Widget Assets";
@@ -20,8 +22,8 @@ const ACTOOL_SCRIPT = [
"set -e",
'CATALOG="${SRCROOT}/ExpoWidgetsTarget/Assets.xcassets"',
'if [ ! -d "$CATALOG" ]; then',
' echo "warning: widget asset catalog not found at $CATALOG"',
" exit 0",
' echo "error: widget asset catalog not found at $CATALOG (expo-widgets wiped it? check plugin ordering in app.config.ts)"',
" exit 1",
"fi",
'DEST="${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"',
'mkdir -p "$DEST"',
@@ -51,7 +53,13 @@ function findByName(map, name) {
function addWidgetAssetCatalog(proj, opts) {
const objects = proj.hash.project.objects;
const target = findByName(objects.PBXNativeTarget, opts.targetName);
if (!target) return false;
if (!target) {
throw new Error(
`addWidgetAssetCatalog: target "${opts.targetName}" not found — ` +
"withWidgetLogoAsset must be registered before expo-widgets so its " +
"xcodeproj mod runs after the widget target is created.",
);
}
const phases = target.value.buildPhases || [];
const existing = objects.PBXShellScriptBuildPhase || {};
+9 -3
View File
@@ -5,9 +5,15 @@
// expo-widgets generates ExpoWidgetsTarget without a Resources build phase and
// has no asset support, so this plugin (a) writes an SVG template image set into
// the generated widget asset catalog and (b) wires that catalog into the widget
// target with a dedicated Resources build phase. Both steps are idempotent and
// survive `expo prebuild --clean`. Must be listed AFTER "expo-widgets" in the
// plugins array so the widget target exists when this runs.
// target with an actool build phase.
//
// ORDERING: must be listed BEFORE "expo-widgets" in the plugins array. Expo
// chains same-type mods so the last-registered runs FIRST; registering this
// plugin earlier makes its mods run AFTER expo-widgets' mods. That matters
// twice: expo-widgets' dangerous mod rmSync's ios/ExpoWidgetsTarget/ (deleting
// any catalog written before it), and its xcodeproj mod is what creates the
// widget target. Listed after expo-widgets, both steps silently no-op on a
// fresh prebuild — which is how prod build 8 shipped without the logo.
const path = require("path");
const fs = require("fs");
@@ -26,5 +26,5 @@ if (added) {
fs.writeFileSync(pbxprojPath, proj.writeSync());
console.log("Added widget asset-compile phase to ExpoWidgetsTarget.");
} else {
console.log("No change: phase already present or target not found.");
console.log("No change: phase already present.");
}
@@ -112,7 +112,12 @@ function AddProjectShell(props: { readonly children: ReactNode }) {
const insets = useSafeAreaInsets();
return (
<View className="flex-1 bg-sheet">
// collapsable={false} is load-bearing: if this wrapper is flattened, the
// ScrollView lands directly under RNSSafeAreaView and RNS's formSheet
// scroll-view frame correction mistakes this full-height wrapper for a
// "header" sibling, coercing the ScrollView to zero height (blank sheet
// as soon as the sheet re-lays-out, e.g. when the keyboard opens).
<View collapsable={false} className="flex-1 bg-sheet">
<ScrollView
keyboardShouldPersistTaps="handled"
contentInsetAdjustmentBehavior="automatic"
@@ -199,6 +199,70 @@ describe("AgentActivity widget layout", () => {
).not.toContain("widgetURL");
});
it("leads with the outcome instead of a zero count when nothing is active", () => {
const layout = AgentActivity(
{
...props,
subtitle: "Agent work completed",
activeCount: 0,
activities: [makeRow({ phase: "completed", status: "Done" })],
},
environment as never,
);
const banner = JSON.stringify(layout.banner);
expect(banner).toContain("Agent work completed");
expect(banner).not.toContain("0 active");
expect(banner).toContain("#6ee7b7"); // emerald-300 header tint
expect(JSON.stringify(layout.compactTrailing)).toContain("Done");
expect(JSON.stringify(layout.compactTrailing)).not.toContain("0 active");
expect(JSON.stringify(layout.expandedLeading)).toContain("Done");
expect(JSON.stringify(layout.minimal)).toContain("checkmark.circle.fill");
expect(JSON.stringify(layout.bannerSmall)).toContain("Done");
});
it("reads Failed when the finished work ended in failure", () => {
const layout = AgentActivity(
{
...props,
subtitle: "Agent work failed",
activeCount: 0,
activities: [makeRow({ phase: "failed", status: "Failed" })],
},
environment as never,
);
const banner = JSON.stringify(layout.banner);
expect(banner).toContain("Agent work failed");
expect(banner).toContain("#fca5a5"); // red-300 header tint
expect(JSON.stringify(layout.compactTrailing)).toContain("Failed");
expect(JSON.stringify(layout.expandedLeading)).toContain("Failed");
expect(JSON.stringify(layout.minimal)).toContain("xmark.octagon.fill");
});
it("lets a failure dominate mixed finished outcomes across every presentation", () => {
const layout = AgentActivity(
{
...props,
// The server subtitle keys off the newest terminal row (completed
// here); the layout must still read Failed everywhere so the header
// text never disagrees with the tint, count slots, or minimal glyph.
subtitle: "Agent work completed",
activeCount: 0,
activities: [
makeRow({ phase: "completed", status: "Done" }),
makeRow({ threadId: "thread-2", phase: "failed", status: "Failed" }),
],
},
environment as never,
);
const banner = JSON.stringify(layout.banner);
expect(banner).toContain("Agent work failed");
expect(banner).not.toContain("Agent work completed");
expect(banner).toContain("#fca5a5"); // red-300 header tint
expect(JSON.stringify(layout.compactTrailing)).toContain("Failed");
expect(JSON.stringify(layout.expandedLeading)).toContain("Failed");
expect(JSON.stringify(layout.minimal)).toContain("xmark.octagon.fill");
});
it("renders up to five rows in the banner", () => {
const layout = AgentActivity(
{
+21 -8
View File
@@ -123,16 +123,28 @@ export function AgentActivity(
? phaseTint(failedRow.phase)
: tint;
// With nothing active the aggregate only carries recently finished work, so
// "0 active agents" (and a lone "0" in the expanded island) read as broken.
// Lead with the outcome instead. The outcome is derived here from the rows
// rather than taken from the server subtitle (which keys off the newest
// terminal row): every presentation — header text, tint, count slots,
// minimal glyph — must agree, and a failure anywhere should dominate a
// newer success.
const allDone = props.activeCount === 0;
const doneLabel = failedRow ? "Failed" : "Done";
const outcomeLabel = failedRow ? "Agent work failed" : "Agent work completed";
// Header copy: "5 active agents" + (", 1 needs attention"). The banner renders
// the two parts in-line so the attention half can carry the accent color;
// `summary` is the short form for tight spots (expanded center, watch card).
const agentWord = props.activeCount === 1 ? "agent" : "agents";
const agentsLabel = `${props.activeCount} active ${agentWord}`;
const agentsLabel = allDone ? outcomeLabel : `${props.activeCount} active ${agentWord}`;
const attentionSuffix =
attentionRows.length > 0
? `${attentionRows.length} need${attentionRows.length === 1 ? "s" : ""} attention`
: "";
const summary = attentionSuffix || `${props.activeCount} active`;
const activeLabel = allDone ? doneLabel : `${props.activeCount} active`;
const summary = attentionSuffix || activeLabel;
// Any registered scheme variant routes back to this app; taps are delivered
// to the widget's containing app, so the prod scheme is safe for all builds.
@@ -142,8 +154,6 @@ export function AgentActivity(
? `t3code://${deepLinkRow.deepLink.slice(1)}`
: null;
const activeLabel = `${props.activeCount} active`;
// A scannable status glyph per phase — reads faster than colored words and
// ties the compact / expanded / banner / watch presentations together.
type SFName = NonNullable<ComponentProps<typeof Image>["systemName"]>;
@@ -245,7 +255,9 @@ export function AgentActivity(
<Text
modifiers={[
font({ weight: "semibold", size: 13 }),
foregroundStyle(primaryForeground),
// The all-done header carries the outcome tint (emerald /
// red) the way the Done/Failed status labels do.
foregroundStyle(allDone ? headerTint : primaryForeground),
lineLimit(1),
]}
>
@@ -322,16 +334,17 @@ export function AgentActivity(
</Text>
),
// The shared/minimal form is a ~22pt circle — a single signal reads there,
// the wordmark does not. Show the blocking phase glyph, else the mark.
// the wordmark does not. Show the blocking/outcome phase glyph, else the
// mark (all-done shows the hero row's checkmark/cross).
minimal:
attentionRow || failedRow
(attentionRow || failedRow || allDone) && heroRow
? renderGlyph(phaseSymbol(heroRow.phase), 13, phaseTint(heroRow.phase))
: renderLogo(11, tint),
expandedLeading: (
<HStack spacing={5} alignment="center" modifiers={[padding({ leading: 4, vertical: 4 })]}>
{renderLogo(15, tint)}
<Text modifiers={[font({ weight: "bold", size: 13 }), foregroundStyle(tint)]}>
{`${props.activeCount}`}
{allDone ? doneLabel : `${props.activeCount}`}
</Text>
</HStack>
),
+232 -246
View File
@@ -1008,73 +1008,70 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => {
}),
);
it.effect(
"status detects cross-repo PRs from the upstream remote URL owner",
() =>
Effect.gen(function* () {
const repoDir = yield* makeTempDir("t3code-git-manager-");
yield* initRepo(repoDir);
const forkDir = yield* createBareRemote();
yield* runGit(repoDir, ["remote", "add", "fork-seed", forkDir]);
yield* runGit(repoDir, ["checkout", "-b", "statemachine"]);
NodeFS.writeFileSync(NodePath.join(repoDir, "fork-pr.txt"), "fork pr\n");
yield* runGit(repoDir, ["add", "fork-pr.txt"]);
yield* runGit(repoDir, ["commit", "-m", "Fork PR branch"]);
yield* runGit(repoDir, ["push", "-u", "fork-seed", "statemachine"]);
yield* runGit(repoDir, ["checkout", "-b", "t3code/pr-488/statemachine"]);
yield* runGit(repoDir, ["branch", "--set-upstream-to", "fork-seed/statemachine"]);
yield* configureVisibleRemoteUrlWithLocalRewrite(
repoDir,
"fork-seed",
"[email protected]:jasonLaster/codething-mvp.git",
forkDir,
);
it.effect("status detects cross-repo PRs from the upstream remote URL owner", () =>
Effect.gen(function* () {
const repoDir = yield* makeTempDir("t3code-git-manager-");
yield* initRepo(repoDir);
const forkDir = yield* createBareRemote();
yield* runGit(repoDir, ["remote", "add", "fork-seed", forkDir]);
yield* runGit(repoDir, ["checkout", "-b", "statemachine"]);
NodeFS.writeFileSync(NodePath.join(repoDir, "fork-pr.txt"), "fork pr\n");
yield* runGit(repoDir, ["add", "fork-pr.txt"]);
yield* runGit(repoDir, ["commit", "-m", "Fork PR branch"]);
yield* runGit(repoDir, ["push", "-u", "fork-seed", "statemachine"]);
yield* runGit(repoDir, ["checkout", "-b", "t3code/pr-488/statemachine"]);
yield* runGit(repoDir, ["branch", "--set-upstream-to", "fork-seed/statemachine"]);
yield* configureVisibleRemoteUrlWithLocalRewrite(
repoDir,
"fork-seed",
"[email protected]:jasonLaster/codething-mvp.git",
forkDir,
);
const { manager, ghCalls } = yield* makeManager({
ghScenario: {
prListSequence: [
// @effect-diagnostics-next-line preferSchemaOverJson:off
JSON.stringify([]),
// @effect-diagnostics-next-line preferSchemaOverJson:off
JSON.stringify([]),
// @effect-diagnostics-next-line preferSchemaOverJson:off
JSON.stringify([
{
number: 488,
title: "Rebase this PR on latest main",
url: "https://github.com/pingdotgg/codething-mvp/pull/488",
baseRefName: "main",
headRefName: "statemachine",
state: "OPEN",
updatedAt: "2026-03-10T07:00:00Z",
isCrossRepository: true,
headRepository: {
nameWithOwner: "jasonLaster/codething-mvp",
},
headRepositoryOwner: {
login: "jasonLaster",
},
const { manager, ghCalls } = yield* makeManager({
ghScenario: {
prListSequence: [
// @effect-diagnostics-next-line preferSchemaOverJson:off
JSON.stringify([]),
// @effect-diagnostics-next-line preferSchemaOverJson:off
JSON.stringify([]),
// @effect-diagnostics-next-line preferSchemaOverJson:off
JSON.stringify([
{
number: 488,
title: "Rebase this PR on latest main",
url: "https://github.com/pingdotgg/codething-mvp/pull/488",
baseRefName: "main",
headRefName: "statemachine",
state: "OPEN",
updatedAt: "2026-03-10T07:00:00Z",
isCrossRepository: true,
headRepository: {
nameWithOwner: "jasonLaster/codething-mvp",
},
]),
],
},
});
headRepositoryOwner: {
login: "jasonLaster",
},
},
]),
],
},
});
const status = yield* manager.status({ cwd: repoDir });
expect(status.refName).toBe("t3code/pr-488/statemachine");
expect(status.pr).toEqual({
number: 488,
title: "Rebase this PR on latest main",
url: "https://github.com/pingdotgg/codething-mvp/pull/488",
baseRef: "main",
headRef: "statemachine",
state: "open",
});
expect(ghCalls).toContain(
"pr list --head jasonLaster:statemachine --state all --limit 20 --json number,title,url,baseRefName,headRefName,state,mergedAt,updatedAt,isCrossRepository,headRepository,headRepositoryOwner",
);
}),
20_000,
const status = yield* manager.status({ cwd: repoDir });
expect(status.refName).toBe("t3code/pr-488/statemachine");
expect(status.pr).toEqual({
number: 488,
title: "Rebase this PR on latest main",
url: "https://github.com/pingdotgg/codething-mvp/pull/488",
baseRef: "main",
headRef: "statemachine",
state: "open",
});
expect(ghCalls).toContain(
"pr list --head jasonLaster:statemachine --state all --limit 20 --json number,title,url,baseRefName,headRefName,state,mergedAt,updatedAt,isCrossRepository,headRepository,headRepositoryOwner",
);
}),
);
it.effect(
@@ -1190,7 +1187,6 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => {
),
).toBe(false);
}),
20_000,
);
it.effect("status returns merged PR state when latest PR was merged", () =>
@@ -1884,65 +1880,62 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => {
}),
);
it.effect(
"returns existing cross-repo PR metadata using the fork owner selector",
() =>
Effect.gen(function* () {
const repoDir = yield* makeTempDir("t3code-git-manager-");
yield* initRepo(repoDir);
yield* runGit(repoDir, ["checkout", "-b", "statemachine"]);
const forkDir = yield* createBareRemote();
yield* runGit(repoDir, ["remote", "add", "fork-seed", forkDir]);
yield* runGit(repoDir, ["push", "-u", "fork-seed", "statemachine"]);
yield* configureVisibleRemoteUrlWithLocalRewrite(
repoDir,
"fork-seed",
"[email protected]:octocat/codething-mvp.git",
forkDir,
);
it.effect("returns existing cross-repo PR metadata using the fork owner selector", () =>
Effect.gen(function* () {
const repoDir = yield* makeTempDir("t3code-git-manager-");
yield* initRepo(repoDir);
yield* runGit(repoDir, ["checkout", "-b", "statemachine"]);
const forkDir = yield* createBareRemote();
yield* runGit(repoDir, ["remote", "add", "fork-seed", forkDir]);
yield* runGit(repoDir, ["push", "-u", "fork-seed", "statemachine"]);
yield* configureVisibleRemoteUrlWithLocalRewrite(
repoDir,
"fork-seed",
"[email protected]:octocat/codething-mvp.git",
forkDir,
);
const { manager, ghCalls } = yield* makeManager({
ghScenario: {
prListSequence: [
// @effect-diagnostics-next-line preferSchemaOverJson:off
JSON.stringify([]),
// @effect-diagnostics-next-line preferSchemaOverJson:off
JSON.stringify([
{
number: 142,
title: "Existing fork PR",
url: "https://github.com/pingdotgg/codething-mvp/pull/142",
baseRefName: "main",
headRefName: "statemachine",
state: "OPEN",
isCrossRepository: true,
headRepository: {
nameWithOwner: "octocat/codething-mvp",
},
headRepositoryOwner: {
login: "octocat",
},
const { manager, ghCalls } = yield* makeManager({
ghScenario: {
prListSequence: [
// @effect-diagnostics-next-line preferSchemaOverJson:off
JSON.stringify([]),
// @effect-diagnostics-next-line preferSchemaOverJson:off
JSON.stringify([
{
number: 142,
title: "Existing fork PR",
url: "https://github.com/pingdotgg/codething-mvp/pull/142",
baseRefName: "main",
headRefName: "statemachine",
state: "OPEN",
isCrossRepository: true,
headRepository: {
nameWithOwner: "octocat/codething-mvp",
},
]),
],
},
});
headRepositoryOwner: {
login: "octocat",
},
},
]),
],
},
});
const result = yield* runStackedAction(manager, {
cwd: repoDir,
action: "commit_push_pr",
});
const result = yield* runStackedAction(manager, {
cwd: repoDir,
action: "commit_push_pr",
});
expect(result.pr.status).toBe("opened_existing");
expect(result.pr.number).toBe(142);
expect(
ghCalls.some((call) =>
call.includes("pr list --head octocat:statemachine --state open --limit 1"),
),
).toBe(true);
expect(ghCalls.some((call) => call.startsWith("pr create "))).toBe(false);
}),
12_000,
expect(result.pr.status).toBe("opened_existing");
expect(result.pr.number).toBe(142);
expect(
ghCalls.some((call) =>
call.includes("pr list --head octocat:statemachine --state open --limit 1"),
),
).toBe(true);
expect(ghCalls.some((call) => call.startsWith("pr create "))).toBe(false);
}),
);
it.effect(
@@ -2042,149 +2035,142 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => {
false,
);
}),
20_000,
);
it.effect(
"prefers owner-qualified selectors before bare branch names for cross-repo PRs",
() =>
Effect.gen(function* () {
const repoDir = yield* makeTempDir("t3code-git-manager-");
yield* initRepo(repoDir);
yield* runGit(repoDir, ["checkout", "-b", "statemachine"]);
const forkDir = yield* createBareRemote();
yield* runGit(repoDir, ["remote", "add", "fork-seed", forkDir]);
yield* runGit(repoDir, ["push", "-u", "fork-seed", "statemachine"]);
yield* runGit(repoDir, ["checkout", "-b", "t3code/pr-142/statemachine"]);
yield* runGit(repoDir, ["branch", "--set-upstream-to", "fork-seed/statemachine"]);
yield* configureVisibleRemoteUrlWithLocalRewrite(
repoDir,
"fork-seed",
"[email protected]:octocat/codething-mvp.git",
forkDir,
);
it.effect("prefers owner-qualified selectors before bare branch names for cross-repo PRs", () =>
Effect.gen(function* () {
const repoDir = yield* makeTempDir("t3code-git-manager-");
yield* initRepo(repoDir);
yield* runGit(repoDir, ["checkout", "-b", "statemachine"]);
const forkDir = yield* createBareRemote();
yield* runGit(repoDir, ["remote", "add", "fork-seed", forkDir]);
yield* runGit(repoDir, ["push", "-u", "fork-seed", "statemachine"]);
yield* runGit(repoDir, ["checkout", "-b", "t3code/pr-142/statemachine"]);
yield* runGit(repoDir, ["branch", "--set-upstream-to", "fork-seed/statemachine"]);
yield* configureVisibleRemoteUrlWithLocalRewrite(
repoDir,
"fork-seed",
"[email protected]:octocat/codething-mvp.git",
forkDir,
);
const { manager, ghCalls } = yield* makeManager({
ghScenario: {
prListByHeadSelector: {
// @effect-diagnostics-next-line preferSchemaOverJson:off
"t3code/pr-142/statemachine": JSON.stringify([]),
// @effect-diagnostics-next-line preferSchemaOverJson:off
statemachine: JSON.stringify([
{
number: 41,
title: "Unrelated same-repo PR",
url: "https://github.com/pingdotgg/codething-mvp/pull/41",
baseRefName: "main",
headRefName: "statemachine",
const { manager, ghCalls } = yield* makeManager({
ghScenario: {
prListByHeadSelector: {
// @effect-diagnostics-next-line preferSchemaOverJson:off
"t3code/pr-142/statemachine": JSON.stringify([]),
// @effect-diagnostics-next-line preferSchemaOverJson:off
statemachine: JSON.stringify([
{
number: 41,
title: "Unrelated same-repo PR",
url: "https://github.com/pingdotgg/codething-mvp/pull/41",
baseRefName: "main",
headRefName: "statemachine",
},
]),
// @effect-diagnostics-next-line preferSchemaOverJson:off
"octocat:statemachine": JSON.stringify([
{
number: 142,
title: "Existing fork PR",
url: "https://github.com/pingdotgg/codething-mvp/pull/142",
baseRefName: "main",
headRefName: "statemachine",
state: "OPEN",
isCrossRepository: true,
headRepository: {
nameWithOwner: "octocat/codething-mvp",
},
]),
// @effect-diagnostics-next-line preferSchemaOverJson:off
"octocat:statemachine": JSON.stringify([
{
number: 142,
title: "Existing fork PR",
url: "https://github.com/pingdotgg/codething-mvp/pull/142",
baseRefName: "main",
headRefName: "statemachine",
state: "OPEN",
isCrossRepository: true,
headRepository: {
nameWithOwner: "octocat/codething-mvp",
},
headRepositoryOwner: {
login: "octocat",
},
headRepositoryOwner: {
login: "octocat",
},
]),
// @effect-diagnostics-next-line preferSchemaOverJson:off
"fork-seed:statemachine": JSON.stringify([]),
},
},
]),
// @effect-diagnostics-next-line preferSchemaOverJson:off
"fork-seed:statemachine": JSON.stringify([]),
},
});
},
});
const result = yield* runStackedAction(manager, {
cwd: repoDir,
action: "commit_push_pr",
});
const result = yield* runStackedAction(manager, {
cwd: repoDir,
action: "commit_push_pr",
});
expect(result.pr.status).toBe("opened_existing");
expect(result.pr.number).toBe(142);
expect(result.pr.status).toBe("opened_existing");
expect(result.pr.number).toBe(142);
const ownerSelectorCallIndex = ghCalls.findIndex((call) =>
call.includes("pr list --head octocat:statemachine --state open --limit 1"),
);
expect(ownerSelectorCallIndex).toBeGreaterThanOrEqual(0);
expect(ghCalls.some((call) => call.startsWith("pr create "))).toBe(false);
}),
12_000,
const ownerSelectorCallIndex = ghCalls.findIndex((call) =>
call.includes("pr list --head octocat:statemachine --state open --limit 1"),
);
expect(ownerSelectorCallIndex).toBeGreaterThanOrEqual(0);
expect(ghCalls.some((call) => call.startsWith("pr create "))).toBe(false);
}),
);
it.effect(
"stops probing head selectors after finding an existing PR",
() =>
Effect.gen(function* () {
const repoDir = yield* makeTempDir("t3code-git-manager-");
yield* initRepo(repoDir);
yield* runGit(repoDir, ["checkout", "-b", "statemachine"]);
const forkDir = yield* createBareRemote();
yield* runGit(repoDir, ["remote", "add", "fork-seed", forkDir]);
yield* runGit(repoDir, ["push", "-u", "fork-seed", "statemachine"]);
yield* runGit(repoDir, ["checkout", "-b", "t3code/pr-142/statemachine"]);
yield* runGit(repoDir, ["branch", "--set-upstream-to", "fork-seed/statemachine"]);
yield* configureVisibleRemoteUrlWithLocalRewrite(
repoDir,
"fork-seed",
"[email protected]:octocat/codething-mvp.git",
forkDir,
);
it.effect("stops probing head selectors after finding an existing PR", () =>
Effect.gen(function* () {
const repoDir = yield* makeTempDir("t3code-git-manager-");
yield* initRepo(repoDir);
yield* runGit(repoDir, ["checkout", "-b", "statemachine"]);
const forkDir = yield* createBareRemote();
yield* runGit(repoDir, ["remote", "add", "fork-seed", forkDir]);
yield* runGit(repoDir, ["push", "-u", "fork-seed", "statemachine"]);
yield* runGit(repoDir, ["checkout", "-b", "t3code/pr-142/statemachine"]);
yield* runGit(repoDir, ["branch", "--set-upstream-to", "fork-seed/statemachine"]);
yield* configureVisibleRemoteUrlWithLocalRewrite(
repoDir,
"fork-seed",
"[email protected]:octocat/codething-mvp.git",
forkDir,
);
const { manager, ghCalls } = yield* makeManager({
ghScenario: {
prListByHeadSelector: {
// @effect-diagnostics-next-line preferSchemaOverJson:off
"octocat:statemachine": JSON.stringify([
{
number: 142,
title: "Existing fork PR",
url: "https://github.com/pingdotgg/codething-mvp/pull/142",
baseRefName: "main",
headRefName: "statemachine",
state: "OPEN",
isCrossRepository: true,
headRepository: {
nameWithOwner: "octocat/codething-mvp",
},
headRepositoryOwner: {
login: "octocat",
},
const { manager, ghCalls } = yield* makeManager({
ghScenario: {
prListByHeadSelector: {
// @effect-diagnostics-next-line preferSchemaOverJson:off
"octocat:statemachine": JSON.stringify([
{
number: 142,
title: "Existing fork PR",
url: "https://github.com/pingdotgg/codething-mvp/pull/142",
baseRefName: "main",
headRefName: "statemachine",
state: "OPEN",
isCrossRepository: true,
headRepository: {
nameWithOwner: "octocat/codething-mvp",
},
]),
// @effect-diagnostics-next-line preferSchemaOverJson:off
"fork-seed:statemachine": JSON.stringify([]),
// @effect-diagnostics-next-line preferSchemaOverJson:off
"t3code/pr-142/statemachine": JSON.stringify([]),
// @effect-diagnostics-next-line preferSchemaOverJson:off
statemachine: JSON.stringify([]),
},
headRepositoryOwner: {
login: "octocat",
},
},
]),
// @effect-diagnostics-next-line preferSchemaOverJson:off
"fork-seed:statemachine": JSON.stringify([]),
// @effect-diagnostics-next-line preferSchemaOverJson:off
"t3code/pr-142/statemachine": JSON.stringify([]),
// @effect-diagnostics-next-line preferSchemaOverJson:off
statemachine: JSON.stringify([]),
},
});
},
});
const result = yield* runStackedAction(manager, {
cwd: repoDir,
action: "commit_push_pr",
});
const result = yield* runStackedAction(manager, {
cwd: repoDir,
action: "commit_push_pr",
});
expect(result.pr.status).toBe("opened_existing");
expect(result.pr.number).toBe(142);
expect(result.pr.status).toBe("opened_existing");
expect(result.pr.number).toBe(142);
const openLookupCalls = ghCalls.filter((call) => call.includes("--state open --limit 1"));
expect(openLookupCalls).toHaveLength(1);
expect(openLookupCalls[0]).toContain(
"pr list --head octocat:statemachine --state open --limit 1",
);
}),
12_000,
const openLookupCalls = ghCalls.filter((call) => call.includes("--state open --limit 1"));
expect(openLookupCalls).toHaveLength(1);
expect(openLookupCalls[0]).toContain(
"pr list --head octocat:statemachine --state open --limit 1",
);
}),
);
it.effect("creates PR when one does not already exist", () =>
@@ -28,6 +28,7 @@ import {
import { ServerConfig } from "../../config.ts";
import { ServerSettingsService } from "../../serverSettings.ts";
import type { CursorAdapterShape } from "../Services/CursorAdapter.ts";
import { pollUntil } from "../testUtils/pollUntil.ts";
import { makeCursorAdapter } from "./CursorAdapter.ts";
const decodeCursorSettings = Schema.decodeSync(CursorSettings);
@@ -97,36 +98,34 @@ async function readJsonLines(filePath: string) {
.split("\n")
.map((line) => line.trim())
.filter((line) => line.length > 0)
.map((line) => JSON.parse(line) as Record<string, unknown>);
.flatMap((line) => {
// The mock agent appends lines from a separate process, so a poll may
// observe a partially written trailing line. Skip it; the next poll
// sees the complete line.
try {
return [JSON.parse(line) as Record<string, unknown>];
} catch {
return [];
}
});
}
async function waitForFileContent(filePath: string, attempts = 40) {
for (let attempt = 0; attempt < attempts; attempt += 1) {
try {
const raw = await NodeFSP.readFile(filePath, "utf8");
if (raw.trim().length > 0) {
return raw;
}
} catch {}
await Effect.runPromise(Effect.yieldNow);
}
throw new Error(`Timed out waiting for file content at ${filePath}`);
function waitForFileContent(filePath: string) {
return pollUntil({
poll: Effect.promise(() => NodeFSP.readFile(filePath, "utf8").catch(() => "")),
until: (raw) => raw.trim().length > 0,
description: `file content at ${filePath}`,
});
}
function waitForJsonLogMatch(
filePath: string,
predicate: (entry: Record<string, unknown>) => boolean,
attempts = 40,
) {
return Effect.gen(function* () {
for (let attempt = 0; attempt < attempts; attempt += 1) {
const requests = yield* Effect.promise(() => readJsonLines(filePath));
if (requests.some(predicate)) {
return requests;
}
yield* Effect.yieldNow;
}
return yield* Effect.promise(() => readJsonLines(filePath));
return pollUntil({
poll: Effect.promise(() => readJsonLines(filePath)),
until: (entries) => entries.some(predicate),
description: `a matching json log entry in ${filePath}`,
});
}
@@ -353,7 +352,7 @@ cursorAdapterTestLayer("CursorAdapterLive", (it) => {
yield* adapter.stopSession(threadId);
const exitLog = yield* Effect.promise(() => waitForFileContent(exitLogPath));
const exitLog = yield* waitForFileContent(exitLogPath);
assert.include(exitLog, "SIGTERM");
}),
);
@@ -405,7 +404,7 @@ cursorAdapterTestLayer("CursorAdapterLive", (it) => {
yield* adapter.stopSession(threadId);
const exitLog = yield* Effect.promise(() => waitForFileContent(exitLogPath));
const exitLog = yield* waitForFileContent(exitLogPath);
assert.equal(exitLog.match(/SIGTERM/g)?.length ?? 0, 2);
}),
);
@@ -516,7 +515,7 @@ cursorAdapterTestLayer("CursorAdapterLive", (it) => {
modelSelection,
});
yield* Effect.promise(() => waitForFileContent(requestLogPath));
yield* waitForFileContent(requestLogPath);
const requestsAfterStart = yield* Effect.promise(() => readJsonLines(requestLogPath));
const configIdsAfterStart = requestsAfterStart.flatMap((entry) =>
@@ -49,6 +49,7 @@ import type { ProviderInstance } from "../ProviderDriver.ts";
import * as ProviderInstanceRegistry from "../Services/ProviderInstanceRegistry.ts";
import * as ProviderRegistry from "../Services/ProviderRegistry.ts";
import { makeManualOnlyProviderMaintenanceCapabilities } from "../providerMaintenance.ts";
import { pollUntil } from "../testUtils/pollUntil.ts";
const decodeServerSettings = Schema.decodeSync(ServerSettings);
const encodeServerSettings = Schema.encodeSync(ServerSettings);
const encodedDefaultServerSettings = encodeServerSettings(DEFAULT_SERVER_SETTINGS);
@@ -1132,17 +1133,15 @@ it.layer(Layer.mergeAll(NodeServices.layer, ServerSettingsModule.layerTest(), Te
yield* Effect.gen(function* () {
const registry = yield* ProviderRegistry.ProviderRegistry;
let providers = yield* registry.getProviders;
for (
let attempts = 0;
attempts < 50 &&
providers.find((provider) => provider.instanceId === "codex_personal")?.status !==
"error";
attempts += 1
) {
yield* Effect.yieldNow;
providers = yield* registry.getProviders;
}
// The probe spawns a real child process, so its ENOENT arrives on
// the live event loop — poll with real wall-clock pauses.
const providers = yield* pollUntil({
poll: registry.getProviders,
until: (current) =>
current.find((provider) => provider.instanceId === "codex_personal")?.status ===
"error",
description: "the codex_personal probe error snapshot to reach the aggregator",
});
const codexPersonal = providers.find(
(provider) => provider.instanceId === "codex_personal",
);
@@ -1228,19 +1227,15 @@ it.layer(Layer.mergeAll(NodeServices.layer, ServerSettingsModule.layerTest(), Te
const registry = yield* ProviderRegistry.ProviderRegistry;
// Boot-time probe: the default codex instance is enabled with
// `firstMissing`, so the real spawner yields ENOENT and the
// snapshot should be `status: "error"`.
let initialProviders = yield* registry.getProviders;
for (
let attempts = 0;
attempts < 50 &&
initialProviders.find((provider) => provider.instanceId === "codex")?.status !==
"error";
attempts += 1
) {
yield* TestClock.adjust("10 millis");
yield* Effect.yieldNow;
initialProviders = yield* registry.getProviders;
}
// snapshot should be `status: "error"`. The spawn error arrives
// on the live event loop, so poll with real wall-clock pauses
// while still nudging the virtual clock for any test timers.
const initialProviders = yield* pollUntil({
poll: TestClock.adjust("10 millis").pipe(Effect.andThen(registry.getProviders)),
until: (providers) =>
providers.find((provider) => provider.instanceId === "codex")?.status === "error",
description: "the boot-time codex probe to fail against the first missing binary",
});
const initialCodex = initialProviders.find(
(provider) => provider.instanceId === "codex",
);
@@ -1264,22 +1259,21 @@ it.layer(Layer.mergeAll(NodeServices.layer, ServerSettingsModule.layerTest(), Te
// Poll until the injected process boundary observes the new
// executable. This verifies the public settings-to-probe behavior
// without depending on timestamps assigned by TestClock.
const refreshed = yield* Effect.gen(function* () {
for (let attempts = 0; attempts < 60; attempts += 1) {
const providers = yield* registry.getProviders;
// without depending on timestamps assigned by TestClock. The
// settings stream, reconcile, and re-probe all hop through real
// fibers and a real child-process spawn, so give them wall-clock
// time between attempts.
const refreshed = yield* pollUntil({
poll: TestClock.adjust("50 millis").pipe(Effect.andThen(registry.getProviders)),
until: (providers) => {
const codex = providers.find((provider) => provider.instanceId === "codex");
if (
return (
codex !== undefined &&
codex.status === "error" &&
spawnedCommands.includes(secondMissing)
) {
return providers;
}
yield* TestClock.adjust("50 millis");
yield* Effect.yieldNow;
}
return yield* registry.getProviders;
);
},
description: "the codex re-probe against the second missing binary",
});
const reprobedCodex = refreshed.find((provider) => provider.instanceId === "codex");
@@ -0,0 +1,69 @@
import * as Clock from "effect/Clock";
import * as Duration from "effect/Duration";
import * as Effect from "effect/Effect";
import * as TestClock from "effect/testing/TestClock";
const describeValue = (value: unknown) => {
try {
const text = JSON.stringify(value);
if (text === undefined) {
return String(value);
}
return text.length > 2_000 ? `${text.slice(0, 2_000)}…` : text;
} catch {
return String(value);
}
};
export interface PollUntilOptions<A, E, R> {
/** Effect run on each attempt; its latest result is checked with `until`. */
readonly poll: Effect.Effect<A, E, R>;
/** Predicate on the polled value that ends the wait. */
readonly until: (value: A) => boolean;
/** Human-readable description of what is being waited for, used in the timeout error. */
readonly description: string;
/** Wall-clock budget for the whole wait. Defaults to 10 seconds. */
readonly timeout?: Duration.Input;
/** Wall-clock pause between attempts. Defaults to 25 millis. */
readonly interval?: Duration.Input;
}
/**
* Repeatedly runs `poll` until `until` matches, sleeping on the live clock
* between attempts.
*
* Tests running under `@effect/vitest`'s `it.effect` / `it.layer` are on the
* `TestClock`, where `Effect.sleep` only advances via `TestClock.adjust` and
* `Effect.yieldNow` yields no wall-clock time at all. Polling loops built from
* those primitives give out-of-process work — mock agent child processes,
* real `ChildProcessSpawner` probes, libuv I/O callbacks — essentially zero
* real time to complete, which makes them flaky on loaded CI hosts. Sleeping
* via `TestClock.withLive` lets the event loop and child processes make
* progress while the rest of the test stays on the virtual clock.
*
* Dies with a descriptive error (including the last polled value) when the
* budget is exhausted, so a timeout fails loudly instead of letting a later
* assertion fail on stale data.
*/
export const pollUntil = <A, E, R>(options: PollUntilOptions<A, E, R>) =>
Effect.gen(function* () {
const timeoutMillis = Duration.toMillis(options.timeout ?? "10 seconds");
const interval = options.interval ?? "25 millis";
const startedAt = yield* TestClock.withLive(Clock.currentTimeMillis);
for (;;) {
const value = yield* options.poll;
if (options.until(value)) {
return value;
}
const now = yield* TestClock.withLive(Clock.currentTimeMillis);
if (now - startedAt >= timeoutMillis) {
return yield* Effect.die(
new Error(
`Timed out after ${timeoutMillis}ms waiting for ${options.description}. ` +
`Last polled value: ${describeValue(value)}`,
),
);
}
yield* TestClock.withLive(Effect.sleep(interval));
}
});
+5 -3
View File
@@ -58,9 +58,11 @@ const unitTestProject = {
include: ["src/**/*.test.{ts,tsx}"],
// The web runtime suite exercises auth bootstrap, saved environments,
// and websocket subscription lifecycles. Under the full monorepo test
// run, those async tests can exceed Vitest's default 5s budget.
hookTimeout: 15_000,
testTimeout: 15_000,
// run every package's suite competes for the same CI cores, so even
// import/transform of heavy components (e.g. MessagesTimeline) has blown
// a 15s budget. Match the root config's 60s budget.
hookTimeout: 60_000,
testTimeout: 60_000,
},
} satisfies TestProjectInlineConfiguration;
@@ -736,7 +736,7 @@ describe("makeAggregateState", () => {
...state,
threadId: "thread-done" as RelayAgentActivityState["threadId"],
phase: "completed",
updatedAt: "1970-01-01T00:50:00.000Z",
updatedAt: "1970-01-01T00:44:00.000Z",
};
const aggregate = AgentActivityPublisher.makeAggregateState({
activeStates: [active, staleCompleted],
@@ -769,7 +769,7 @@ describe("makeAggregateState", () => {
});
expect(
AgentActivityPublisher.makeAggregateState({
activeStates: [{ ...lingeringCompleted, updatedAt: "1970-01-01T00:50:00.000Z" }],
activeStates: [{ ...lingeringCompleted, updatedAt: "1970-01-01T00:44:00.000Z" }],
terminalState: null,
nowMs: hourMs,
}),
@@ -789,16 +789,25 @@ describe("makeAggregateState", () => {
updatedAt: "1970-01-01T00:59:00.000Z",
};
const aggregate = AgentActivityPublisher.makeAggregateState({
activeStates: [mkActive("a-1"), mkActive("a-2"), mkActive("a-3"), justCompleted],
activeStates: [
mkActive("a-1"),
mkActive("a-2"),
mkActive("a-3"),
mkActive("a-4"),
mkActive("a-5"),
justCompleted,
],
terminalState: null,
nowMs: hourMs,
});
expect(aggregate?.activeCount).toBe(3);
expect(aggregate?.activeCount).toBe(5);
expect(aggregate?.activities).toMatchObject([
{ threadId: "a-1" },
{ threadId: "a-2" },
{ threadId: "a-3" },
{ threadId: "a-4" },
{ threadId: "a-5" },
]);
});
});
@@ -13,6 +13,7 @@ import * as Option from "effect/Option";
import {
isExpiredAgentActivityState,
isTerminalPhase,
MAX_ACTIVITY_ROWS,
sanitizeAgentActivityAggregateState,
} from "./agentActivityPayloads.ts";
@@ -228,7 +229,7 @@ function terminalAggregateState(state: RelayAgentActivityState): RelayAgentActiv
// How long a finished thread keeps its Done/Failed row in the aggregate while
// other agents are still active. Long enough to be seen on the lock screen,
// short enough that the activity list stays about live work.
export const TERMINAL_AGENT_ACTIVITY_DISPLAY_TTL_MS = 5 * 60 * 1_000;
export const TERMINAL_AGENT_ACTIVITY_DISPLAY_TTL_MS = 15 * 60 * 1_000;
function isRecentTerminalState(state: RelayAgentActivityState, nowMs: number): boolean {
if (!isTerminalPhase(state)) {
@@ -273,7 +274,7 @@ export function makeAggregateState(input: {
subtitle: newest.phase === "failed" ? "Agent work failed" : "Agent work completed",
activeCount: 0,
updatedAt: newest.updatedAt,
activities: recentTerminal.slice(0, 3).map(aggregateRowForState),
activities: recentTerminal.slice(0, MAX_ACTIVITY_ROWS).map(aggregateRowForState),
});
}
// Recently finished threads ride along after the active ones (display slots
@@ -282,7 +283,10 @@ export function makeAggregateState(input: {
const recentTerminalStates = input.activeStates
.filter((state) => isRecentTerminalState(state, input.nowMs))
.sort((a, b) => b.updatedAt.localeCompare(a.updatedAt));
const displayedStates = [...activeStates.slice(0, 3), ...recentTerminalStates].slice(0, 3);
const displayedStates = [
...activeStates.slice(0, MAX_ACTIVITY_ROWS),
...recentTerminalStates,
].slice(0, MAX_ACTIVITY_ROWS);
const updatedAt = [...activeStates, ...recentTerminalStates].reduce((latest, state) =>
state.updatedAt.localeCompare(latest.updatedAt) > 0 ? state : latest,
).updatedAt;
@@ -373,7 +373,7 @@ describe("ApnsDeliveries", () => {
...aggregate,
title: longTitle,
subtitle: longTitle,
activities: [0, 1, 2, 3].map((index) =>
activities: [0, 1, 2, 3, 4, 5].map((index) =>
Object.assign({}, aggregate.activities[0]!, {
projectTitle: longTitle,
threadTitle: longTitle,
@@ -396,7 +396,7 @@ describe("ApnsDeliveries", () => {
const payloadAggregate = queuedJobs[0]?.payload.aggregate;
expect(payloadAggregate?.title.length).toBeLessThanOrEqual(120);
expect(payloadAggregate?.subtitle.length).toBeLessThanOrEqual(120);
expect(payloadAggregate?.activities).toHaveLength(3);
expect(payloadAggregate?.activities).toHaveLength(5);
expect(payloadAggregate?.activities[0]?.projectTitle.length).toBeLessThanOrEqual(120);
expect(payloadAggregate?.activities[0]?.status.length).toBeLessThanOrEqual(40);
expect(payloadAggregate?.activities[0]?.deepLink).toBe("/");
@@ -43,7 +43,9 @@ export function isExpiredAgentActivityState(
const MAX_SUMMARY_TEXT_LENGTH = 120;
const MAX_STATUS_TEXT_LENGTH = 40;
const MAX_DEEP_LINK_LENGTH = 512;
const MAX_ACTIVITY_ROWS = 3;
// The Live Activity banner (lock screen / Notification Center) renders up to
// five rows; the expanded Dynamic Island shows the top three of these.
export const MAX_ACTIVITY_ROWS = 5;
function truncateText(value: string, maxLength: number): string {
const trimmed = value.trim();
+1 -1
View File
@@ -48,7 +48,7 @@
"engines": {
"node": "^24.13.1"
},
"packageManager": "pnpm@10.24.0",
"packageManager": "pnpm@11.10.0",
"msw": {
"workerDirectory": [
"apps/web/public"
@@ -155,6 +155,46 @@ describe("vcsActionState", () => {
});
});
it("clears running presentation state once the action finishes", () => {
const initial = beginVcsActionState({
operation: "run_change_request",
label: "Running source control action",
actionId,
});
const pushing = applyVcsActionProgressEvent(
initial,
progress({
actionId,
action,
cwd,
kind: "phase_started",
phase: "push",
label: "Pushing...",
}),
);
const finished = applyVcsActionProgressEvent(
pushing,
progress({
actionId,
action,
cwd,
kind: "action_finished",
result,
}),
);
expect(finished).toMatchObject({
isRunning: false,
operation: "run_change_request",
actionId,
action,
currentLabel: null,
currentPhaseLabel: null,
lastOutputLine: null,
error: null,
});
});
it("retains a terminal action error for presentation", () => {
const initial = beginVcsActionState({
operation: "run_change_request",
@@ -386,12 +386,10 @@ export function applyVcsActionProgressEvent(
};
case "action_finished":
return {
...current,
isRunning: false,
...EMPTY_VCS_ACTION_STATE,
actionId: event.actionId,
action: event.action,
operation: "run_change_request",
error: null,
};
case "action_failed":
return {
+40 -1
View File
@@ -1,3 +1,42 @@
diff --git a/android/src/main/java/com/swmansion/rnscreens/ScreenStackHeaderConfigViewManager.kt b/android/src/main/java/com/swmansion/rnscreens/ScreenStackHeaderConfigViewManager.kt
index 03d8d9f3a5c403c93282d53cbacf1a339e877e85..54d5eabc6c8a408e711a5be97286fdbb8ab1c461 100644
--- a/android/src/main/java/com/swmansion/rnscreens/ScreenStackHeaderConfigViewManager.kt
+++ b/android/src/main/java/com/swmansion/rnscreens/ScreenStackHeaderConfigViewManager.kt
@@ -103,6 +103,34 @@ class ScreenStackHeaderConfigViewManager :
config.setTitle(title)
}
+ // The t3 patch adds these iOS glass-chrome props to the native spec; they have
+ // no Android implementation, but the codegen-generated interface requires the
+ // setters to exist. No-ops keep the Android build compiling.
+ override fun setSubtitle(
+ config: ScreenStackHeaderConfig,
+ subtitle: String?,
+ ) = Unit
+
+ override fun setLargeSubtitle(
+ config: ScreenStackHeaderConfig,
+ largeSubtitle: String?,
+ ) = Unit
+
+ override fun setNavigationItemStyle(
+ config: ScreenStackHeaderConfig,
+ navigationItemStyle: String?,
+ ) = Unit
+
+ override fun setHeaderCenterBarButtonItems(
+ config: ScreenStackHeaderConfig,
+ headerCenterBarButtonItems: ReadableArray?,
+ ) = Unit
+
+ override fun setHeaderToolbarItems(
+ config: ScreenStackHeaderConfig,
+ headerToolbarItems: ReadableArray?,
+ ) = Unit
+
override fun setTitleFontFamily(
config: ScreenStackHeaderConfig,
titleFontFamily: String?,
diff --git a/ios/RNSBarButtonItem.h b/ios/RNSBarButtonItem.h
index ea5325ea8d17b1ddfa790ff8dab48ce83142d4d3..acd2fd7ceb7162ed300abc4d3c9f0c24f4d63898 100644
--- a/ios/RNSBarButtonItem.h
@@ -1067,7 +1106,7 @@ index b7568ecfebd4f4420f2a8d3fec5184d7fc728dd1..41ca1f273f0175929e73105faa463978
onPressHeaderBarButtonMenuItem?: CT.DirectEventHandler<OnPressHeaderBarButtonMenuItemEvent> | undefined;
synchronousShadowStateUpdatesEnabled?: CT.WithDefault<boolean, false>;
diff --git a/lib/typescript/types.d.ts b/lib/typescript/types.d.ts
index 3b384e03891e38e936f370372a682d73440e7ec2..1e3a966806c8b8b312f75fb367f758efe49dde9d 100644
index 3b384e03891e38e936f370372a682d73440e7ec2..861ffed850e90f27916c427853b503dbe6ee9840 100644
--- a/lib/typescript/types.d.ts
+++ b/lib/typescript/types.d.ts
@@ -10,6 +10,7 @@ export type SearchBarCommands = {
+295 -319
View File
File diff suppressed because it is too large. Load diff
+17 -10
View File
@@ -5,6 +5,23 @@ packages:
- packages/*
- scripts
# Successor to onlyBuiltDependencies/ignoredBuiltDependencies (pnpm 11).
# true = allowed to run build scripts; false mirrors the pnpm 10 behavior
# where anything outside onlyBuiltDependencies was silently not built.
allowBuilds:
browser-tabs-lock: false
bufferutil: false
core-js: false
electron: true
electron-winstaller: false
esbuild: true
msgpackr-extract: true
msw: false
node-pty: true
sharp: true
utf-8-validate: false
workerd: false
catalog:
"@clerk/backend": 3.8.4
"@clerk/clerk-js": 6.22.0
@@ -34,16 +51,6 @@ catalog:
vite-plus: 0.2.2
yaml: ^2.9.0
ignoredBuiltDependencies:
- msw
onlyBuiltDependencies:
- electron
- esbuild
- msgpackr-extract
- node-pty
- sharp
overrides:
"@clerk/backend": "catalog:"
"@clerk/clerk-js": "catalog:"