Repository navigation
Conversation
`registerNodeInstrumentation` called `configureHttpDispatcher()` with no timeout, so the Web UI always used the built-in five minutes and ignored the user's `httpIdleTimeoutMs`. A provider stream that stayed quiet for longer was aborted with a bare `terminated`, while the same setting applied correctly to CLI sessions. Read the agent directory's `settings.json` the way the CLI does and pass the value to the dispatcher, so both surfaces honor one setting.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1126
Problem
registerNodeInstrumentation()calledconfigureHttpDispatcher()with no timeout, so the Web UI always keptDEFAULT_HTTP_IDLE_TIMEOUT_MS(five minutes) and never readhttpIdleTimeoutMs. That value is undici'sbodyTimeouton the global dispatcher, an idle timeout that fires when the response body has had no data for that long, so a provider stream that stayed quiet for five minutes ended with a bareterminatedwhile the same setting applied correctly to CLI sessions.Change
lib/http-dispatcher.ts— addreadHttpIdleTimeoutMs(agentDir), which reads the agent directory'ssettings.jsonthe way the CLI reads it. A missing file, a file that does not parse, an absent key, or a value the CLI would reject returnsundefined, so the existing default stays in place. The read goes throughreadRegularFileText, so a FIFO or a device there throws instead of blocking startup.instrumentation-node.ts— pass the value through.lib/http-dispatcher.test.mjs— cover the reader: missing file, broken JSON, absent key, negative value,null, a non-object file, a configured value,0,"disabled", a byte-order mark, andPI_CODING_AGENT_DIR.Testing
node --experimental-strip-types --test lib/http-dispatcher.test.mjs # tests 2 | pass 2 | fail 0The existing proxy test still passes unchanged.
Notes
.pi/settings.jsoncannot apply here.getAgentDir(). This module runs in Next.js instrumentation, where importing the SDK costs about a second of startup time, whileundici— the only other dependency here — costs about a tenth of one. The resolution mirrorsgetAgentDir():PI_CODING_AGENT_DIR,~expanded, otherwise~/.pi/agent.httpIdleTimeoutMs, behavior is unchanged: the five-minute default.