Chat image download from URL has no timeout and ignores its cancellation token
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 72/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- electron, typescript
Línea de trabajo
Empieza en src/vs/platform/webContentExtractor/node/sharedWebContentExtractorService.ts, donde readImageWithMetadata llama a fetch sin signal ni plazo. Lee los stubs existentes en src/vs/platform/webContentExtractor/test/node/sharedWebContentExtractorService.test.ts y luego añade una prueba que compruebe que se pasa un signal y que cancelar el token aborta la solicitud. Se considera terminado cuando fetch está limitado por un timeout y vinculado al CancellationToken, y las pruebas pasan.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Does this issue occur when all extensions are disabled?: Yes (core code path, no extension involved)
- VS Code Version:
mainat 742a9ae378720f2526ed7128fbc47ec2a285f1b1 (found by reading the source, not reproduced in a build) - OS Version: any
SharedWebContentExtractorService.readImageWithMetadata downloads an image from an arbitrary URL with a plain fetch and no deadline:
The CancellationToken is checked once before the request and is never connected to the fetch, so even a cancelled token cannot abort it. In practice every workbench caller passes CancellationToken.None anyway:
- chat drag and drop:
chatDragAndDrop.ts#L446 - attachments:
chatAttachmentModel.ts#L203 - input part:
chatInputPart.ts#L2900 - copy image:
chatImageActions.ts#L50 - image generation batch:
chatImageGenerationBatchPart.ts#L282 - download:
workbench/browser/download.ts#L36
Steps to Reproduce:
- Serve a URL that accepts the connection and never sends a response (for example
nc -l 8080). - Drag
http://localhost:8080/a.pnginto the Chat input, or paste it as an image attachment. - Nothing aborts the request, so the attachment stays pending until Node's fetch gives up after undici's default headers/body timeouts (300 s each), and there is no way to cancel it from the UI.
Expected: the request is bounded and cancellable. A small fix is to pass a signal that combines a timeout with the token, e.g.
const controller = new AbortController();
const listener = token.onCancellationRequested(() => controller.abort());
try {
const response = await fetch(uri.toString(true), {
headers: { ... },
signal: AbortSignal.any([controller.signal, AbortSignal.timeout(30_000)]),
});
...
} finally {
listener.dispose();
}
The existing tests in src/vs/platform/webContentExtractor/test/node/sharedWebContentExtractorService.test.ts stub fetch, so a case asserting that a signal is passed and that cancelling the token aborts it would fit there. I can send a PR with that if it helps.
- Lenguaje dominante
- TypeScript
- Estrellas
- 196k
- Forks
- 43.9k
- Merge medio
- 12 h 49 min
- PR fusionados (30 d)
- 682
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de microsoft/vscode
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
testplan-item
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
Los mantenedores suelen responder en 1 día
-
testplan-item
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Los mantenedores suelen responder en 1 día
-
testplan-item
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
Todos los issues de microsoft/vscode
Issues similares
-
bug done
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
neavo/LinguaGacha#1124 ·
Los mantenedores suelen responder en 1 día
-
[fullsend] E2E: backstage-microsoft-auth — catalogQuery missing error handler for network errorsPosiblemente ocupada @fullsend-ai-coder la tomó hoy. Abiertoe2e-failure ready-to-code
Dificultad 2/5 Menos de una hora Aptitud para principiantes 78/100
redhat-developer/rhdh-plugin-export-overlays#4821 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
brylie/mission-island#225 ·
Los mantenedores suelen responder en 1 día
-
enhancement from-app needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
nightly-labs/openbot#14986 ·
Los mantenedores suelen responder en 1 día
-
status/need-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
google-gemini/gemini-cli#30412 · 1 comentario ·
Los mantenedores suelen responder en 1 día