[Bug]: TypeScript GET-with-body requests remain pending after a truncated response
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 85/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- node.js, typescript
- Ambito
- backend-api-design
Direzione di ricerca
Inizia da clients/typescript/src/client/http-client.ts, concentrandoti sul fallback esclusivo di Node per GET con body e sulla relativa callback IncomingMessage. Esegui la riproduzione dell’issue, quindi individua i test esistenti di HttpClient esportato e aggiungi una copertura di regressione per una risposta distrutta prima che arrivi la lunghezza del contenuto dichiarata. Il lavoro è concluso quando questo caso viene rifiutato tempestivamente con l’errore di trasporto come causa, mentre le risposte complete e il comportamento esistente in caso di errori della richiesta restano invariati.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Is there an existing issue for the same bug?
- I searched existing issues and open pull requests. #5611 / #5612 concern caller cancellation; that patch does not handle a response stream failing after headers arrive.
Bug Description
The TypeScript HttpClient GET-with-body transport leaves its promise pending when the server closes a response before its declared content length is received. It listens for errors on ClientRequest, but not on the separate IncomingMessage response stream. A request configured with a 1000 ms timeout remains pending after 1500 ms because the socket has already closed.
This reproduces against main at 1fbfd37f6fb21491ed733fc92d409aff1517ff4a, using the actual exported client on Node 24.18.0. No agent server, credentials or model calls are needed.
Steps to Reproduce
Save this as repro-response.mjs in the repository root, then run node --experimental-transform-types repro-response.mjs:
import { createServer } from 'node:http';
import { once } from 'node:events';
import { HttpClient } from './clients/typescript/src/client/http-client.ts';
const server = createServer((_request, response) => {
response.writeHead(200, { 'Content-Type': 'application/json', 'Content-Length': '100' });
response.write('{"events":');
setImmediate(() => response.destroy());
});
server.listen(0, '127.0.0.1');
await once(server, 'listening');
const client = new HttpClient({ baseUrl: `http://127.0.0.1:${server.address().port}`, timeout: 1000 });
try {
console.log(await Promise.race([
client.get('/batch', { data: ['event-1'] }).then(
() => 'resolved', (error) => `rejected: ${error.message}`
),
new Promise((resolve) => setTimeout(() => resolve('still pending'), 1500)),
]));
} finally {
server.closeAllConnections();
server.close();
}
Actual output: still pending.
Expected Behavior
Reject the request promptly when its response stream fails, retaining the transport error as the cause. Do not resolve with partial data or leave the request pending indefinitely. Complete responses and existing request-error behavior should remain unchanged.
Adding an error listener to the existing IncomingMessage callback, using the same rejection convention as req.on('error'), makes the identical reproduction report rejected: Request failed: aborted.
Scope
This concerns the existing Node-only GET-with-body fallback in clients/typescript/src/client/http-client.ts. The browser fetch path, public API, schemas, Python server and caller-cancellation fix are separate. OpenAI Codex assisted with diagnosis and the local reproduction.
OpenHands AI triage
The following comments and acceptance criteria were added by the OpenHands AI agent.
Triage
clients/typescript/ owns this Node-only fallback, and the report pins a concrete gap in it: requestWithBodyOnGet() in clients/typescript/src/client/http-client.ts attaches error and timeout handling to the ClientRequest but nothing to the IncomingMessage response stream, so a response destroyed after headers arrive leaves the returned promise unsettled. That path is what the GET-with-body batch endpoints use (BashClient.batchGetEvents, conversation events). Scope is the smallest coherent one: make that fallback settle when its response stream fails, reusing the rejection convention the method already applies to request errors, plus regression coverage.
Non-goals: the browser fetch path in request(), the public HttpClient options/API and exported types, the generated agent-server schema, the Python SDK and agent server, caller-owned cancellation (#5611 / #5612), and retry/backoff policy.
Actual Behavior
client.get('/batch', { data: ['event-1'] }) with timeout: 1000 against a server that destroys the response after writing {"events": still prints still pending at 1500 ms; the promise neither resolves nor rejects. The reproduction uses the exported client on Node 24.18.0 and needs no agent server, credentials, or model calls.
Acceptance Criteria
- A GET request with a JSON body whose response stream is destroyed after the headers arrive rejects instead of remaining pending: the reproduction with
timeout: 1000reports a rejection before the 1500 ms deadline rather thanstill pending. - The rejection preserves the transport error as
causeand follows the existingRequest failed: <message>convention already used forClientRequesterrors, so a truncated response rejects withRequest failed: aborted. - A complete GET-with-body response still resolves with the parsed body, status, statusText, and headers.
- Existing request-error behavior is unchanged: connection-level failures and the configured request timeout keep their current rejection messages and
cause. - No public API change is needed to observe the fix: no new option, parameter, or exported type, and the browser
fetchpath is untouched. - Automated coverage exercises the exported
HttpClientagainst a server that closes the response before its declaredContent-Lengthis received and asserts the promise rejects, so the pending-promise regression cannot silently return.
- Lingua principale
- Python
- Stelle
- 1.4k
- Fork
- 797
- Merge medio
- 1g 17h
- PR unite (30g)
- 354
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di OpenHands/software-agent-sdk
-
[Bug]: `list_directory` reports a complete listing as truncated when a directory has exactly 500 entriesForse già presa @balabommablock-cpu l’ha presa 29 giorni fa. Apertabug priority:low ready-for-dev
Difficoltà 2/5 1-3 ore Idoneità per principianti 87/100
OpenHands/software-agent-sdk#6133 ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: Command hook that exits 1 is treated as blocking when its stdout is a JSON `deny` or `continue: false`Forse già presa Una pull request collegata a questa issue è aperta o già unita. Apertabug priority:low ready-for-dev
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
OpenHands/software-agent-sdk#6116 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: Document whether `prompt_tokens` includes `cache_read_tokens` in accumulated token usageForse già presa @Jaxon1216 l’ha presa 36 giorni fa. Apertapriority:low ready-for-dev
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
OpenHands/software-agent-sdk#5975 ·
I maintainer di solito rispondono entro 1 giorno
-
priority:low
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
OpenHands/software-agent-sdk#5708 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug] Unauthenticated model-info lookup still emits GET /v1/model/info when key is NoneForse già presa @daviskay75 l’ha presa 49 giorni fa. Apertapriority:low
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
OpenHands/software-agent-sdk#5454 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di OpenHands/software-agent-sdk
Issue simili
-
[Bug]: reme CLI crashes when the running server used a relative config pathForse già presa @nurlanmnn l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
agentscope-ai/ReMe#770 ·
I maintainer di solito rispondono entro 1 giorno
-
Pi: paused model calls are reported as "not signed in" when the model's provider comes from an extensionForse già presa @balcsida l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
microsoft/TokenEconomizer#288 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 67/100
sickn33/agentic-awesome-skills#2437 ·
I maintainer di solito rispondono entro 1 giorno
-
site-bug triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
ethereum/consensus-specs#5846 ·
I maintainer di solito rispondono entro 1 giorno