GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: sidecar model settings, stream fixes, autostart fallback by lidge-jun · Pull Request #15 · lidge-jun/opencodex

feat: sidecar model settings, stream fixes, autostart fallback #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
lidge-jun merged 8 commits into main from dev
Jun 22, 2026

Uh oh!

There was an error while loading. Please reload this page.

Merged

feat: sidecar model settings, stream fixes, autostart fallback #15

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit Hold shift + click to select a range
a72608f
docs: devlog/210 — PR #8 autostart ensure fallback code review
lidge-jun Jun 21, 2026
914f70c
feat: Codex autostart ensure fallback + port fallback + uninstall
lidge-jun Jun 21, 2026
1c2ccfe
fix: address PR #8 review — dynamic import, sync logging, toggle error
lidge-jun Jun 21, 2026
2e3ab9b
docs: devlog/210 — PR #8 apply plan
lidge-jun Jun 21, 2026
e93073c
fix passthrough stream idle disconnects (#10)
Ingwannu Jun 21, 2026
bedb268
fix chat tool choice and stream timeouts
Ingwannu Jun 21, 2026
b16feac
feat: add search/vision sidecar model settings to dashboard
lidge-jun Jun 21, 2026
a480569
merge: resolve conflicts between dev and main
lidge-jun Jun 22, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view
Prev Previous commit
Next Next commit
fix chat tool choice and stream timeouts
  • Loading branch information

Uh oh!

There was an error while loading. Please reload this page.

@Ingwannu
Ingwannu committed Jun 21, 2026
commit bedb268c1cfeea5f521600fe6cf110aec4e1b716

There are no files selected for viewing

2 changes: 1 addition & 1 deletion 2 src/adapters/openai-chat.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export function createOpenAIChatAdapter(provider: OcxProviderConfig): ProviderAd
stream: parsed.stream,
};
if (tools) body.tools = tools;
if (toolChoice !== undefined) {
if (tools && toolChoice !== undefined) {
body.tool_choice = modelInList(provider.autoToolChoiceOnlyModels, parsed.modelId)
? (toolChoice === "none" ? "none" : "auto")
: toolChoice;
Expand Down
30 changes: 24 additions & 6 deletions 30 src/server.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,11 @@ async function handleResponses(
const connectMs = config.connectTimeoutMs ?? 30_000;
let upstreamResponse: Response;
try {
upstreamResponse = await fetch(request.url, {
upstreamResponse = await fetchWithHeaderTimeout(request.url, {
method: request.method,
headers: request.headers,
body: request.body,
signal: AbortSignal.any([upstream.signal, AbortSignal.timeout(connectMs)]),
});
}, upstream.signal, connectMs);
} catch (err) {
upstream.abort();
const msg = err instanceof Error && err.name === "TimeoutError"
Expand Down Expand Up @@ -235,10 +234,9 @@ async function handleResponses(
const request = adapter.buildRequest(parsed, { headers: req.headers });
let upstreamResponse: Response;
try {
upstreamResponse = await fetch(request.url, {
upstreamResponse = await fetchWithHeaderTimeout(request.url, {
method: request.method, headers: request.headers, body: request.body,
signal: AbortSignal.any([upstream.signal, AbortSignal.timeout(connectMs)]),
});
}, upstream.signal, connectMs);
} catch (err) {
upstream.abort();
const msg = err instanceof Error && err.name === "TimeoutError"
Expand Down Expand Up @@ -307,6 +305,26 @@ export function linkAbortSignal(upstream: AbortController, signal?: AbortSignal)
signal.addEventListener("abort", () => upstream.abort(signal.reason), { once: true });
}

async function fetchWithHeaderTimeout(
url: string,
init: Omit<RequestInit, "signal">,
abortSignal: AbortSignal,
timeoutMs: number,
): Promise<Response> {
const timeout = new AbortController();
const timer = setTimeout(() => {
if (!timeout.signal.aborted) timeout.abort(new DOMException("Timeout elapsed", "TimeoutError"));
}, timeoutMs);
try {
return await fetch(url, {
...init,
signal: AbortSignal.any([abortSignal, timeout.signal]),
});
} finally {
clearTimeout(timer);
}
}

const requestLog: { timestamp: number; model: string; provider: string; status: number; durationMs: number }[] = [];
const MAX_LOG_SIZE = 200;

Expand Down
34 changes: 34 additions & 0 deletions 34 tests/reasoning-effort.test.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,40 @@ describe("provider-specific reasoning effort mapping", () => {
expect(body).not.toHaveProperty("top_p");
expect(body).not.toHaveProperty("presence_penalty");
expect(body).not.toHaveProperty("frequency_penalty");
expect(body).not.toHaveProperty("tool_choice");
});

test("OpenAI-compatible chat omits tool_choice when there are no tools", () => {
const provider: OcxProviderConfig = {
adapter: "openai-chat",
baseUrl: "https://api.neuralwatt.com/v1",
};

const body = buildBody(provider, "glm-5.2", { toolChoice: "auto" });

expect(body).not.toHaveProperty("tools");
expect(body).not.toHaveProperty("tool_choice");
});

test("OpenAI-compatible chat keeps tool_choice when tools are present", () => {
const provider: OcxProviderConfig = {
adapter: "openai-chat",
baseUrl: "https://api.moonshot.ai/v1",
autoToolChoiceOnlyModels: ["kimi-k2.7-code"],
};

const req = createOpenAIChatAdapter(provider).buildRequest({
modelId: "kimi-k2.7-code",
context: {
messages: [{ role: "user", content: "hello", timestamp: 0 }],
tools: [{ name: "run_tests", description: "Run tests", parameters: { type: "object", properties: {} } }],
},
stream: false,
options: { toolChoice: { name: "run_tests" } },
});
const body = JSON.parse(req.body as string) as Record<string, unknown>;

expect(body).toHaveProperty("tools");
expect(body.tool_choice).toBe("auto");
});

Expand Down
Loading
Oops, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

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.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.