From 417b3c47c5e52ff9b6380449bae925d8f6ca715b Mon Sep 17 00:00:00 2001 From: Kameron Smith Date: Tue, 24 Nov 2026 11:46:41 -0500 Subject: [PATCH 1/2] fix(ci): restore the release commit and push hook baseline On release/native-0.1.10 the pre-commit hook fails on eight unused exports and the pre-push check fails on a scenario typecheck error and a stale agent context budget, so no code change can land without bypassing the hooks. Seven unused exports are used only inside their own module and lose their export. The client setThreadDelegationNudge wrapper has no caller and goes; the server command and its MCP tool stay. The upstream ACP refresh scenario imports rpcClient from scenarios/t3.ts, so the fork's identical helper moves there as upstream has it. The MCP tool list budget takes the measured size after the event subscription and delegation nudge tools landed. Model: claude-opus-5-5 Task: CLO-1066 Agent: claude-code Co-Authored-By: Claude Opus 5.5 --- apps/server/src/mcp/McpHttpServer.ts | 2 +- .../src/orchestration-v2/contextBoundary.ts | 2 +- .../src/orchestration-v2/eventSubscription.ts | 13 +++--- .../src/provider/agentContextBudget.json | 2 +- .../client-runtime/src/operations/commands.ts | 16 -------- .../mention-finds-older-linked-thread.e2e.ts | 41 +------------------ scripts/scenarios/t3.ts | 34 ++++++++++++++- 7 files changed, 43 insertions(+), 67 deletions(-) diff --git a/apps/server/src/mcp/McpHttpServer.ts b/apps/server/src/mcp/McpHttpServer.ts index 9cf2d604dbc8d..ce2c87d5d12bc 100644 --- a/apps/server/src/mcp/McpHttpServer.ts +++ b/apps/server/src/mcp/McpHttpServer.ts @@ -1350,7 +1350,7 @@ export const layerPullRequestsToolkit = toolkitRegistration( PullRequestsHandlers.layer, ).pipe(Layer.provide(PullRequestWatchService.layer)); -export const layerEventsToolkit = toolkitRegistration(EventsToolkit, EventsHandlers.layer).pipe( +const layerEventsToolkit = toolkitRegistration(EventsToolkit, EventsHandlers.layer).pipe( Layer.provide(PullRequestWatchService.layer), ); diff --git a/apps/server/src/orchestration-v2/contextBoundary.ts b/apps/server/src/orchestration-v2/contextBoundary.ts index 1d9ca8d552fa2..ff918a0126554 100644 --- a/apps/server/src/orchestration-v2/contextBoundary.ts +++ b/apps/server/src/orchestration-v2/contextBoundary.ts @@ -3,7 +3,7 @@ import type { OrchestrationV2Run, OrchestrationV2ThreadProjection } from "@t3too import { cancelledBeforeStart } from "./RestartBackgroundNote.ts"; /** A fresh-session schedule run starts a side conversation; the thread's own one continues past it. */ -export function isScheduledFreshRun( +function isScheduledFreshRun( run: Pick, turnItems: OrchestrationV2ThreadProjection["turnItems"], ): boolean { diff --git a/apps/server/src/orchestration-v2/eventSubscription.ts b/apps/server/src/orchestration-v2/eventSubscription.ts index fcb871fe5643d..be2ba0a0cc4f9 100644 --- a/apps/server/src/orchestration-v2/eventSubscription.ts +++ b/apps/server/src/orchestration-v2/eventSubscription.ts @@ -40,23 +40,20 @@ export const emptyCursor = (): SubscriptionCursor => ({ deliveredSignatures: {}, }); -export function canonicalAuthor(login: string): string { +function canonicalAuthor(login: string): string { return login .trim() .toLowerCase() .replace(/\[bot\]$/i, ""); } -export function authorIgnored( - login: string | null | undefined, - ignore: readonly string[], -): boolean { +function authorIgnored(login: string | null | undefined, ignore: readonly string[]): boolean { if (login == null || login.trim() === "") return false; const key = canonicalAuthor(login); return ignore.some((entry) => canonicalAuthor(entry) === key); } -export function normalizePullRequestUrl(raw: string): string { +function normalizePullRequestUrl(raw: string): string { const url = new URL(raw); url.hash = ""; url.search = ""; @@ -95,7 +92,7 @@ export interface DeliveryInput { readonly maxWakesPerHour?: number | null | undefined; } -export function normalizeDelivery( +function normalizeDelivery( input: DeliveryInput | undefined, ): | { readonly ok: true; readonly delivery: EventDeliveryPolicy } @@ -159,7 +156,7 @@ function validateQuietHours(hours: QuietHours): string | null { } /** Minutes from midnight in the zone. Throws when the zone is invalid. */ -export function minutesInZone(nowMs: number, timeZone: string): number { +function minutesInZone(nowMs: number, timeZone: string): number { const parts = new Intl.DateTimeFormat("en-US", { timeZone, hour: "2-digit", diff --git a/apps/server/src/provider/agentContextBudget.json b/apps/server/src/provider/agentContextBudget.json index a071e682881e3..385996c985c17 100644 --- a/apps/server/src/provider/agentContextBudget.json +++ b/apps/server/src/provider/agentContextBudget.json @@ -1,5 +1,5 @@ { "claudeSystemAppendBytes": 5930, "codexAdditionalContextBytes": 7324, - "mcpToolListJsonBytes": 61564 + "mcpToolListJsonBytes": 61917 } diff --git a/packages/client-runtime/src/operations/commands.ts b/packages/client-runtime/src/operations/commands.ts index addd7e3752bda..7bbd46edef0e2 100644 --- a/packages/client-runtime/src/operations/commands.ts +++ b/packages/client-runtime/src/operations/commands.ts @@ -630,22 +630,6 @@ export const setThreadStanding = Effect.fn("EnvironmentCommands.setThreadStandin }); }); -export interface SetThreadDelegationNudgeInput extends ThreadCommandInput { - readonly enabled: boolean; - readonly thresholds?: ReadonlyArray; -} -export const setThreadDelegationNudge = Effect.fn("EnvironmentCommands.setThreadDelegationNudge")( - function* (input: SetThreadDelegationNudgeInput) { - return yield* dispatch({ - type: "thread.delegation-nudge.set", - commandId: yield* allocateCommandId(input), - threadId: input.threadId, - enabled: input.enabled, - ...(input.thresholds === undefined ? {} : { thresholds: [...input.thresholds] }), - }); - }, -); - export interface SetThreadAutoSettleInput extends ThreadCommandInput { readonly enabled: boolean; } diff --git a/scripts/scenarios/mention-finds-older-linked-thread.e2e.ts b/scripts/scenarios/mention-finds-older-linked-thread.e2e.ts index 064f04fb92924..e6e59dd00b720 100644 --- a/scripts/scenarios/mention-finds-older-linked-thread.e2e.ts +++ b/scripts/scenarios/mention-finds-older-linked-thread.e2e.ts @@ -1,54 +1,17 @@ import * as NodeCrypto from "@effect/platform-node/NodeCrypto"; -import * as NodeWS from "@effect/platform-node/NodeWS"; -import { - CommandId, - ORCHESTRATION_PROTOCOL_VERSION, - ThreadId, - WsRpcGroup, -} from "@t3tools/contracts"; +import { CommandId, ThreadId } from "@t3tools/contracts"; import { expect } from "e2e"; import * as SecureRandom from "effect/crypto/SecureRandom"; import * as Effect from "effect/Effect"; -import * as Layer from "effect/Layer"; import * as Schema from "effect/Schema"; -import { FetchHttpClient, HttpClient, HttpClientRequest, HttpClientResponse } from "effect/http"; -import { RpcClient, RpcSerialization } from "effect/rpc"; -import { Socket } from "effect/socket"; import { T3_HOME } from "../e2e.config.ts"; import { SECOND_HOME, startSecondServer } from "./second-server.ts"; -import { makeState, runPromise, test, WEB } from "./t3.ts"; +import { makeState, rpcClient, runPromise, test, WEB } from "./t3.ts"; // A shell keeps an environment's 25 newest settled threads; older ones come from search. const NEWER_SETTLED = 25; -/** The typed RPC client of the server on `home` at `origin`, signed in through its own CLI. */ -const rpcClient = Effect.fn("scenario.rpcClient")(function* (home: string, origin: string) { - const issued = yield* makeState(home).cli(["auth", "session", "issue", "--token-only"]); - const { ticket } = yield* HttpClient.execute( - HttpClientRequest.post(`${origin}/api/auth/websocket-ticket`).pipe( - HttpClientRequest.bearerToken(issued.stdout.trim()), - ), - ).pipe( - Effect.flatMap(HttpClientResponse.filterStatusOk), - Effect.flatMap(HttpClientResponse.schemaBodyJson(Schema.Struct({ ticket: Schema.String }))), - Effect.provide(FetchHttpClient.layer), - ); - // Built into the caller's scope: `Effect.provide` would close the socket once `make` returns. - const protocol = yield* Layer.build( - RpcClient.layerProtocolSocket().pipe( - Layer.provide( - Socket.layerWebSocket( - `${origin.replace(/^http/, "ws")}/ws?orchestrationProtocol=${ORCHESTRATION_PROTOCOL_VERSION}&wsTicket=${encodeURIComponent(ticket)}`, - ), - ), - Layer.provide(RpcSerialization.layerJson), - Layer.provide(NodeWS.layerWebSocketConstructor), - ), - ); - return yield* RpcClient.make(WsRpcGroup).pipe(Effect.provideContext(protocol)); -}); - const uuid = Effect.flatMap(SecureRandom.SecureRandom, (random) => random.uuidV4()); const decodePairing = Schema.decodeEffect( Schema.fromJsonString(Schema.Struct({ credential: Schema.String })), diff --git a/scripts/scenarios/t3.ts b/scripts/scenarios/t3.ts index 113916cf94081..c3800c74ad321 100644 --- a/scripts/scenarios/t3.ts +++ b/scripts/scenarios/t3.ts @@ -1,14 +1,19 @@ // `test` for web scenarios: e2e's web test plus `t3`, which seeds state and opens the signed-in // app. `t3-mobile.ts` is the same for the iOS app. import * as NodeServices from "@effect/platform-node/NodeServices"; +import * as NodeWS from "@effect/platform-node/NodeWS"; import { test as base } from "@e2e-dev/web"; +import { ORCHESTRATION_PROTOCOL_VERSION, WsRpcGroup } from "@t3tools/contracts"; import { expect } from "e2e"; import * as HostProcess from "@t3tools/shared/HostProcess"; import * as Effect from "effect/Effect"; import * as FileSystem from "effect/FileSystem"; +import * as Layer from "effect/Layer"; import * as Path from "effect/Path"; import * as Schema from "effect/Schema"; -import { FetchHttpClient, HttpClient, HttpClientResponse } from "effect/http"; +import { FetchHttpClient, HttpClient, HttpClientRequest, HttpClientResponse } from "effect/http"; +import { RpcClient, RpcSerialization } from "effect/rpc"; +import { Socket } from "effect/socket"; import { APP_DIR, T3_HOME } from "../e2e.config.ts"; import { run } from "./shell.ts"; @@ -149,6 +154,33 @@ const environmentId = (baseUrl: string) => Effect.provide(FetchHttpClient.layer), ); +/** The typed RPC client of the server on `home` at `origin`, signed in through its own CLI. */ +export const rpcClient = Effect.fn("scenario.rpcClient")(function* (home: string, origin: string) { + const issued = yield* makeState(home).cli(["auth", "session", "issue", "--token-only"]); + const { ticket } = yield* HttpClient.execute( + HttpClientRequest.post(`${origin}/api/auth/websocket-ticket`).pipe( + HttpClientRequest.bearerToken(issued.stdout.trim()), + ), + ).pipe( + Effect.flatMap(HttpClientResponse.filterStatusOk), + Effect.flatMap(HttpClientResponse.schemaBodyJson(Schema.Struct({ ticket: Schema.String }))), + Effect.provide(FetchHttpClient.layer), + ); + // Built into the caller's scope: `Effect.provide` would close the socket once `make` returns. + const protocol = yield* Layer.build( + RpcClient.layerProtocolSocket().pipe( + Layer.provide( + Socket.layerWebSocket( + `${origin.replace(/^http/, "ws")}/ws?orchestrationProtocol=${ORCHESTRATION_PROTOCOL_VERSION}&wsTicket=${encodeURIComponent(ticket)}`, + ), + ), + Layer.provide(RpcSerialization.layerJson), + Layer.provide(NodeWS.layerWebSocketConstructor), + ), + ); + return yield* RpcClient.make(WsRpcGroup).pipe(Effect.provideContext(protocol)); +}); + export const test = base.extend<{ t3: T3 }>({ t3: async ({ app, browser }, use) => { const { state, cleanup } = makeState(T3_HOME); From 7941765bfe7733d502567e421a4e230b60fd22fc Mon Sep 17 00:00:00 2001 From: Kameron Smith Date: Tue, 24 Nov 2026 12:19:11 -0500 Subject: [PATCH 2/2] fix(test): keep replay fixtures out of the hook's repository Git exports GIT_DIR to hooks. Under pre-push, the replay workspace fixture inherited it, so its git init, config, add and commit ran against the pushing worktree: it committed "initial" onto the branch being pushed and wrote the test identity into the shared repository config. Unset the inherited repository selectors, as the server's VcsProcess already does for its own git calls. Model: claude-opus-5-5 Task: CLO-1066 Agent: claude-code Co-Authored-By: Claude Opus 5.5 --- packages/provider-testing/src/replayWorkspace.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/provider-testing/src/replayWorkspace.ts b/packages/provider-testing/src/replayWorkspace.ts index 4216ebaedc53f..adf69bcb50aae 100644 --- a/packages/provider-testing/src/replayWorkspace.ts +++ b/packages/provider-testing/src/replayWorkspace.ts @@ -19,6 +19,15 @@ class ReplayFixtureGitCommandError extends Schema.TaggedError, @@ -29,7 +38,9 @@ function runGit( > { return Effect.gen(function* () { const spawner = yield* ChildProcessSpawner.ChildProcessSpawner; - const exitCode = yield* spawner.exitCode(ChildProcess.make("git", args, { cwd })); + const exitCode = yield* spawner.exitCode( + ChildProcess.make("git", args, { cwd, env: INHERITED_REPOSITORY_ENV, extendEnv: true }), + ); if (Number(exitCode) !== 0) { return yield* new ReplayFixtureGitCommandError({ command: `git ${args.join(" ")}`,