fix: make context and colored timeline fetches truly parallel

Address PR #1125 review feedback - both fetches now start simultaneously
via Promise.all instead of sequential-then-parallel.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Alex Newman
2026-02-16 00:11:25 -05:00
parent 34358ab33d
commit 676a3d175e
2 changed files with 9 additions and 6 deletions
+7 -4
View File
@@ -37,7 +37,12 @@ export const contextHandler: EventHandler = {
// Note: Removed AbortSignal.timeout due to Windows Bun cleanup issue (libuv assertion)
// Worker service has its own timeouts, so client-side timeout is redundant
try {
const response = await fetch(url);
// Fetch both markdown (for Claude context) and colored (for user display) truly in parallel
const colorUrl = `${url}&colors=true`;
const [response, colorResponse] = await Promise.all([
fetch(url),
fetch(colorUrl).catch(() => null)
]);
if (!response.ok) {
// Log but don't throw — context fetch failure should not block session start
@@ -48,11 +53,9 @@ export const contextHandler: EventHandler = {
};
}
// Fetch both markdown (for Claude context) and colored (for user display) in parallel
const colorUrl = `${url}&colors=true`;
const [contextResult, colorResult] = await Promise.all([
response.text(),
fetch(colorUrl).then(r => r.ok ? r.text() : '').catch(() => '')
colorResponse?.ok ? colorResponse.text() : Promise.resolve('')
]);
const additionalContext = contextResult.trim();