test(server): catch client transfer regressions in CI #5350
Mergedt3dotgg(GitHub profile, opens in a new tab)merged 10 commits into
main fromrefs/pull/5350/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
- apps/server/integration/TransferBudgetReport.integration.ts line 39Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -0,0 +18,21 @@18+ readonly measuredTurnWebSocket: WebSocketTransferTotals;19+}20+21+interface ProviderTransferBudget {22+ readonly totalWireBytes: number;23+ readonly threadSnapshotWireBytes: number;24+ readonly measuredTurnWebSocketWireBytes: number;25+ readonly measuredTurnWebSocketDecodedBytes: number;26+ readonly measuredTurnWebSocketMessages: number;27+}28+29+// These caps leave roughly 30% headroom above the deterministic fixture. The30+// CI report preserves the exact values so intentional protocol growth can be31+// reviewed and the caps raised explicitly.32+const TRANSFER_BUDGET = {33+ totalWireBytes: 2_900_000,34+ threadSnapshotWireBytes: 2_600_000,35+ measuredTurnWebSocketWireBytes: 320_000,36+ measuredTurnWebSocketDecodedBytes: 1_550_000,37+ measuredTurnWebSocketMessages: 20,38+} satisfies ProviderTransferBudget;apps/server/integration/TransferBudgetReport.integration.ts line 37OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -0,0 +17,21 @@17+ readonly threadSnapshot: HttpTransferMeasurement;18+ readonly measuredTurnWebSocket: WebSocketTransferTotals;19+}20+21+interface ProviderTransferBudget {22+ readonly totalWireBytes: number;23+ readonly threadSnapshotWireBytes: number;24+ readonly measuredTurnWebSocketWireBytes: number;25+ readonly measuredTurnWebSocketDecodedBytes: number;26+ readonly measuredTurnWebSocketMessages: number;27+}28+29+// These caps leave roughly 30% headroom above the deterministic fixture. The30+// CI report preserves the exact values so intentional protocol growth can be31+// reviewed and the caps raised explicitly.32+const TRANSFER_BUDGET = {33+ totalWireBytes: 2_900_000,34+ threadSnapshotWireBytes: 2_600_000,35+ measuredTurnWebSocketWireBytes: 320_000,36+ measuredTurnWebSocketDecodedBytes: 1_550_000,37+ measuredTurnWebSocketMessages: 20,
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:S
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
- .github/scripts/thread-transfer-report.cjs line 368Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +300,21 @@300+301+async function upsertComment(github, context, pullNumber, body) {302+ const { owner, repo } = context.repo;303+ const comments = await github.paginate(github.rest.issues.listComments, {304+ owner,305+ repo,306+ issue_number: pullNumber,307+ per_page: 100,308+ });309+ const existing = comments.find(310+ (comment) =>311+ comment.user?.login === "github-actions[bot]" && comment.body?.includes(COMMENT_MARKER),312+ );313+ if (existing) {314+ await github.rest.issues.updateComment({ owner, repo, comment_id: existing.id, body });315+ } else {316+ await github.rest.issues.createComment({ owner, repo, issue_number: pullNumber, body });317+ }318+}319+320+async function publish({ github, context, core }) {
- apps/server/src/server.test.ts line 7882OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -7728,0 +7862,21 @@7862+ type: "thread.turn.start",7863+ commandId: CommandId.make(`transfer:${provider}:measured-turn`),7864+ threadId: TRANSFER_THREAD_ID,7865+ message: {7866+ messageId: MessageId.make("transfer-user-measured"),7867+ role: "user",7868+ text: "Measure the client-bound transfer for this turn.",7869+ attachments: [],7870+ },7871+ modelSelection: transferModelSelection(provider),7872+ runtimeMode: "approval-required",7873+ interactionMode: "default",7874+ createdAt: TRANSFER_MEASURED_TURN_CREATED_AT,7875+ });7876+ yield* waitForTurnQuiesced(harness, TRANSFER_MEASURED_TURN_INDEX + 1);7877+ const finalSequence = yield* harness.engine.latestSequence;7878+7879+ yield* collectQueueUntil(7880+ threadItems,7881+ (item) => item.kind === "event" && item.event.sequence >= finalSequence,7882+ `${provider} thread stream to reach sequence ${finalSequence}`,@@ -7728,0 +7863,21 @@7863+ commandId: CommandId.make(`transfer:${provider}:measured-turn`),7864+ threadId: TRANSFER_THREAD_ID,7865+ message: {7866+ messageId: MessageId.make("transfer-user-measured"),7867+ role: "user",7868+ text: "Measure the client-bound transfer for this turn.",7869+ attachments: [],7870+ },7871+ modelSelection: transferModelSelection(provider),7872+ runtimeMode: "approval-required",7873+ interactionMode: "default",7874+ createdAt: TRANSFER_MEASURED_TURN_CREATED_AT,7875+ });7876+ yield* waitForTurnQuiesced(harness, TRANSFER_MEASURED_TURN_INDEX + 1);7877+ const finalSequence = yield* harness.engine.latestSequence;7878+7879+ yield* collectQueueUntil(7880+ threadItems,7881+ (item) => item.kind === "event" && item.event.sequence >= finalSequence,7882+ `${provider} thread stream to reach sequence ${finalSequence}`,7883+ );
- .github/scripts/thread-transfer-report.cjs line 245Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +220,21 @@220+ return github.paginate(github.rest.actions.listWorkflowRunArtifacts, {221+ owner,222+ repo,223+ run_id: runId,224+ per_page: 100,225+ });226+}227+228+function findResultArtifact(artifacts) {229+ return artifacts.find((artifact) => artifact.name === ARTIFACT_NAME && !artifact.expired);230+}231+232+async function resolve({ github, context, core }) {233+ const source = context.payload.workflow_run;234+ const { owner, repo } = context.repo;235+ if (source.event !== "pull_request") {236+ core.setOutput("publish", "false");237+ return;238+ }239+240+ let pullNumber = source.pull_requests?.[0]?.number;
- .github/scripts/thread-transfer-report.cjs line 397Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -0,0 +344,21 @@344+ sha: process.env.PR_SHA,345+ conclusion: process.env.PR_CONCLUSION,346+ url: `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${process.env.PR_RUN_ID}`,347+ };348+ if (!current) {349+ await upsertCommentForCurrentHead(350+ github,351+ context,352+ core,353+ pullNumber,354+ currentRun.sha,355+ [356+ COMMENT_MARKER,357+ "## Thread transfer impact",358+ "",359+ `⚠️ The latest [CI run](${currentRun.url}) did not produce a thread transfer result for \`${currentRun.sha.slice(0, 7)}\`.`,360+ "",361+ "_This comment will update automatically after the next completed run._",362+ ].join("\n"),363+ );364+ return;
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:L
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XL
- .github/scripts/thread-transfer-report.cjs line 256Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -0,0 +232,21 @@232+async function resolve({ github, context, core }) {233+ const source = context.payload.workflow_run;234+ const { owner, repo } = context.repo;235+ if (source.event !== "pull_request") {236+ core.setOutput("publish", "false");237+ return;238+ }239+240+ let pullNumber = source.pull_requests?.[0]?.number;241+ if (!pullNumber) {242+ const associated = await github.paginate(243+ github.rest.repos.listPullRequestsAssociatedWithCommit,244+ { owner, repo, commit_sha: source.head_sha, per_page: 100 },245+ );246+ const matchingPulls = associated.filter(247+ (pull) =>248+ pull.state === "open" &&249+ pull.head.sha === source.head_sha &&250+ pull.head.ref === source.head_branch &&251+ pull.head.repo?.full_name === source.head_repository?.full_name,252+ );
- @@ -0,0 +388,21 @@388+ COMMENT_MARKER,389+ "## Thread transfer impact",390+ "",391+ `⚠️ The latest [CI run](${currentRun.url}) did not produce a thread transfer result for \`${currentRun.sha.slice(0, 7)}\`.`,392+ "",393+ "_This comment will update automatically after the next completed run._",394+ ].join("\n"),395+ { preserveResultSha: currentRun.sha },396+ );397+ return;398+ }399+400+ const baseline = readResult(process.env.BASELINE_RESULT_DIR);401+ const baselineRun = baseline402+ ? {403+ sha: process.env.BASELINE_SHA,404+ matchesBase: process.env.BASELINE_MATCHES_BASE === "true",405+ url: `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${process.env.BASELINE_RUN_ID}`,406+ }407+ : undefined;408+ const body = renderComment({ current, baseline, currentRun, baselineRun });@@ -0,0 +1,20 @@1+name: Thread Transfer Report2+3+on:4+ workflow_run:5+ workflows: [CI]6+ types: [completed]7+8+permissions:9+ actions: read10+ contents: read11+ pull-requests: write12+13+jobs:14+ publish:15+ name: Publish PR comment16+ if: github.event.workflow_run.event == 'pull_request'17+ runs-on: ubuntu-24.0418+ concurrency:19+ group: thread-transfer-report-${{ github.event.workflow_run.pull_requests[0].number || github.event.workflow_run.id }}20+ cancel-in-progress: true
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
t3dotgg(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.


Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID:
6c3f39b6-dd86-40b1-8f6d-2aea0e3bb157You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share