Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"scripts": {
"build": "tsc -p tsconfig.json",
"check": "tsc -p tsconfig.json --noEmit",
"test": "node --test --test-concurrency=4 dist/test/*.test.js",
"test": "T2C_USE_SUBLLM=false node --test --test-concurrency=4 dist/test/*.test.js",
"verify:no-llm": "node scripts/verify-no-llm-imports.mjs",
"verify:modules": "node scripts/verify-module-boundaries.mjs",
"verify:env": "node scripts/verify-env-contract.mjs",
Expand Down
2 changes: 2 additions & 0 deletions project/TICKETS.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions project/ticket-089/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file.
31 changes: 31 additions & 0 deletions project/ticket-089/ai-codex.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions project/ticket-089/changelog.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions project/ticket-089/intent.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions project/ticket-089/preprompt.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions project/ticket-090/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file.
29 changes: 29 additions & 0 deletions project/ticket-090/ai-antigravity.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions project/ticket-090/changelog.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions project/ticket-090/intent.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions project/ticket-090/preprompt.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/llm/subllm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export function lastResolvedSubllmRoute(): SubllmPublicRoute | null {

export function shouldUseSubllm(
environment: NodeJS.ProcessEnv = process.env,
cwd = process.cwd(),
_cwd = process.cwd(),
): boolean {
const explicit = environment.T2C_USE_SUBLLM?.trim().toLowerCase();
if (explicit && FALSE_VALUES.has(explicit)) return false;
Expand All @@ -49,7 +49,7 @@ export function shouldUseSubllm(
if (environment.SUBLLM_ENV_FILE || environment.SUBLLM_POLICY_FILE || environment.SUBLLM_PYTHONPATH) {
return true;
}
return Boolean(localSubllmPythonPath(cwd));
return true;
}

export async function resolveSubllmRoute(
Expand Down
7 changes: 6 additions & 1 deletion test/cli-summary.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ test('CLI summarize exposes deterministic, prefer-llm and require-llm modes', as
const diagnostics = diagnoseGraph(graph, '2026-07-30T00:00:00.000Z');
await fs.writeFile(path.join(root, 'graph.json'), `${JSON.stringify(graph)}\n`, 'utf8');
await fs.writeFile(path.join(root, 'diagnostics.json'), `${JSON.stringify(diagnostics)}\n`, 'utf8');
const environment = { ...process.env, OPENROUTER_API_KEY: '', T2C_ENV_FILE: 'missing.env' };
const environment = {
...process.env,
OPENROUTER_API_KEY: '',
T2C_ENV_FILE: 'missing.env',
T2C_USE_SUBLLM: 'false',
};
const base = ['summarize', 'graph.json', '--diagnostics', 'diagnostics.json'];

const deterministic = await exec(process.execPath, [cli, ...base, '--mode', 'deterministic'], {
Expand Down
30 changes: 18 additions & 12 deletions test/subllm.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ if args[:3] == ["resolve", "todo2code", "semantic"]:
print(json.dumps({
"application": "todo2code",
"application_name": "todo2code",
"application_url": "https://github.com/semcod/todo2code",
"application_url": "https://github.com/autogrammar/todo2code",
"function": "semantic",
"provider": "zai",
"model": "glm-5.2",
"priority": 10,
"model": "glm-5.3",
"priority": 0,
"api_base": "https://api.z.ai/api/coding/paas/v4",
"api_key_env": "ZAI_API_KEY",
"litellm_model": "zai/glm-5.2",
"wire_model": "glm-5.2",
"litellm_model": "zai/glm-5.3",
"wire_model": "glm-5.3",
"extra_headers": {},
}))
elif args == ["env", "path"]:
Expand Down Expand Up @@ -92,7 +92,7 @@ test('SubLLM bridge resolves the selected central route without command-shell in
assert.equal(shouldUseSubllm(), true);
const resolved = await resolveSubllmRoute();
assert.equal(resolved.route.provider, 'zai');
assert.equal(resolved.route.wire_model, 'glm-5.2');
assert.equal(resolved.route.wire_model, 'glm-5.3');
assert.equal(resolved.route.application, 'todo2code');
assert.equal(resolved.credential, FIXTURE_CREDENTIAL);
assert.equal(JSON.stringify(resolved.route).includes('fixture-value'), false);
Expand All @@ -116,7 +116,7 @@ test('todo2code sends structured semantic requests through direct Z.AI resolved
return new Response(JSON.stringify({
id: 'zai-fixture-response',
request_id: body.request_id,
model: 'glm-5.2',
model: 'glm-5.3',
usage: { prompt_tokens: 12, completion_tokens: 4, total_tokens: 16 },
choices: [{ message: { content: responseContent } }],
}), { status: 200, headers: { 'Content-Type': 'application/json' } });
Expand All @@ -131,13 +131,13 @@ test('todo2code sends structured semantic requests through direct Z.AI resolved
);

assert.deepEqual(result.value, { ok: true });
assert.equal(result.metadata.model, 'glm-5.2');
assert.equal(result.metadata.model, 'glm-5.3');
assert.equal(result.metadata.provider, 'zai');
assert.equal(url, 'https://api.z.ai/api/coding/paas/v4/chat/completions');
assert.equal(headers.Authorization, `Bearer ${FIXTURE_CREDENTIAL}`);
assert.equal(headers['X-OpenRouter-Title'], undefined);
assert.equal(headers['HTTP-Referer'], undefined);
assert.equal(body.model, 'glm-5.2');
assert.equal(body.model, 'glm-5.3');
assert.equal(body.user_id, 'todo2code');
assert.match(String(body.request_id), /^todo2code-semantic-[0-9a-f]{32}$/u);
assert.deepEqual(body.response_format, { type: 'json_object' });
Expand All @@ -154,9 +154,9 @@ test('todo2code sends structured semantic requests through direct Z.AI resolved
application: 'todo2code',
function: 'semantic',
provider: 'zai',
model: 'glm-5.2',
wireModel: 'glm-5.2',
priority: 10,
model: 'glm-5.3',
wireModel: 'glm-5.3',
priority: 0,
apiBase: 'https://api.z.ai/api/coding/paas/v4',
});
assert.equal(JSON.stringify(audit).includes('fixture-value'), false);
Expand All @@ -174,6 +174,12 @@ test('todo2code sends structured semantic requests through direct Z.AI resolved
}
});

test('SubLLM is the default semantic route and legacy OpenRouter requires an explicit opt-out', () => {
assert.equal(shouldUseSubllm({}), true);
assert.equal(shouldUseSubllm({ T2C_USE_SUBLLM: 'true' }), true);
assert.equal(shouldUseSubllm({ T2C_USE_SUBLLM: 'false' }), false);
});

test('explicitly requested SubLLM fails closed when its package is unavailable', async () => {
const previousUse = process.env.T2C_USE_SUBLLM;
const previousPath = process.env.SUBLLM_PYTHONPATH;
Expand Down
Loading