Skip to content

feat(ai): Gemini 4 Argon, sized as it is — its window, its reasoning, and room to think - #108

Merged
ndemianc merged 1 commit into
developfrom
feat/gemini-4-argon
Oct 15, 2026
Merged

ndemianc merged 1 commit into
developfrom
feat/gemini-4-argon

Conversation

@ndemianc

Copy link
Copy Markdown
Contributor

This is the editor half of the Gemini 4 Argon launch (Step 2 of the launch plan). The catalog row is what puts Argon in front of Pro users: systemu-net/thin.ly#451. That row works without this PR, because the picker reads /account/models live. This PR makes the editor treat Argon as what it is, and it can ship in any release.

What changes

  • Argon is sized exactly. Until now it fell to the gemini heuristic: a 1,000,000 window instead of 1,048,576, and no reasoning flag. providers/catalog.js now has rows for google/gemini-4-argon and the bare gemini-4-argon: 1,048,576 context, tools, vision, reasoning, never fast, so it never becomes the ghost-text model.
  • A reasoning effort is sent. For Argon, chat and the agent send reasoning: { effort: "medium" }, and compaction sends "low". Before, no effort was sent, so Google's default applied, which is unknown.
    • Only the vendor-prefixed id, which is how OpenRouter and the gateway name Argon, carries the effort. Both take that field for this model: OpenRouter lists reasoning for every Argon endpoint, and the gateway passes the body through.
    • A bare id may be some other endpoint, so it sends none.
  • Reasoning models get room to answer. Argon's reasoning comes out of the same max_tokens as its answer, and the agent's 8,192 default can be spent on thinking alone. A model whose caps say it reasons now gets the 32,768 per-turn ceiling, which is also the gateway's PAID_MAX_TOKENS.
    • This applies to o-series and Kimi K3 as well. The existing nudge loop still handles a turn that stops at the limit.
    • It raises the run's worst-case output bound for these models (8 × the per-turn cap) from 65,536 to 262,144 tokens. On Argon that is about $2.60 of output at the intro rate, against $0.66 before.
  • Compaction no longer comes back empty. On a reasoning model it summarizes with 8,192 tokens instead of 1,500, which reasoning alone could use up.

The web build runs the same extensions/levelcode-ai source, so it picks all of this up.

Tests

  • New and extended cases:
    • catalog.test.js: the two Argon rows, and reasoningEffortFor.
    • providers.test.js: the buildChatBody field, and that the effort reaches the request body on the chat, one-shot and agent paths (index.js copies options field by field).
    • agentReasoningBudget.test.js: runs the real agent loop with a stand-in provider and reads what each turn asked for.
    • compactReasoningHost.test.js: runs the real compactAgentMemory, sliced out of extension.js.
    • sessionExpiredHost.test.js: now hands handleSend the real catalog, which it needs, and checks the chat's effort.
  • Seen to fail when they should: each of the 14 changes was undone one at a time with the network refused, and every undo was caught by a test.
  • Gate: scripts/test-extensions.sh passes on macOS with Node 24, 126 files, and again with every setTimeout delayed by 15 ms, as on the Linux runner. tsc --checkJs finds no new undefined names.
  • Live: scripts/kimi-k3-spike.js against google/gemini-4-argon passed with this branch's request builder and effort: medium. Turn 1 called the tool; turn 2 answered without reasoning carried back.

Not run

  • The suites on Linux. Docker was not answering on this Mac.
  • The editor itself. Neither a desktop build nor the browser build has been run with this branch, with Argon or otherwise.
  • A real multi-step agent task on Argon. It is on the launch plan's checklist for after the thin.ly deploy.

For the next release notes

RELEASE-NOTES.md on develop still holds v1.3.0's notes and is replaced each release, so I did not touch it. Suggested entry:

Gemini 4 Argon, sized as it is. Argon is in the model picker for Pro plans (thin.ly side). The editor now knows its real 1,048,576-token window, asks for a medium reasoning effort, and gives reasoning models room to think and still answer: 32,768 tokens a turn in the agent, and a Compact that no longer comes back empty. About 100 turns a month on Pro at the introductory price.

… and room to think

Argon reaches the picker from the gateway roster (systemu-net/thin.ly#451)
and from OpenRouter with an own key. Until now it fell to the `gemini`
heuristic: a 1,000,000 window instead of 1,048,576, and no reasoning flag.

- providers/catalog.js: rows for `google/gemini-4-argon` and the bare id —
  1,048,576 context, tools, vision, reasoning, never `fast`. Only the
  vendor-prefixed id (how OpenRouter and the gateway name it) carries
  `effort: 'medium'`; reasoningEffortFor() answers it, and 'low' for
  compaction.
- openaiCompat.buildChatBody sends `reasoning: { effort }` when asked;
  index.js now forwards reasoningEffort on the chat, one-shot and agent
  paths. Chat and the agent ask for the row's effort.
- agent.js: a model whose caps say it reasons gets the 32,768 per-turn
  ceiling (the gateway's PAID_MAX_TOKENS), because its reasoning comes out
  of the same max_tokens. That also covers o-series and Kimi K3.
- Compact: a reasoning model summarizes with 8,192 tokens instead of
  1,500, which reasoning alone could use up, and asks for a low effort.

Tests: catalog and buildChatBody cases; a provider case that the field
reaches the request body on all three paths; agentReasoningBudget runs the
real agent loop; compactReasoningHost runs the real compaction function;
sessionExpiredHost now hands the chat the real catalog and checks its
effort. All 14 changes were undone one at a time with the network refused,
and each was caught. The gate passes on macOS (126 files, also with
Linux-like slow timers). Live: kimi-k3-spike.js against
google/gemini-4-argon passed with this branch's request builder and
effort=medium.
Copilot AI balanced review requested due to automatic review settings October 15, 2026 00:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Higher billable token ceilings across reasoning models warrant human validation, with desktop, browser, and real multi-step Argon checks still outstanding.

0 open findings

What changed in this PR

Adds editor-side Gemini 4 Argon support to LevelCode’s shared desktop and web AI implementation, complementing the live model roster.

Changes:

  • Defines Argon’s exact context window and capabilities.
  • Forwards reasoning effort through chat, agent, and compaction requests.
  • Raises reasoning-model token budgets and adds regression coverage.
File Description
extensions/​levelcode-ai/​test/​sessionExpiredHost.test.js Checks chat reasoning effort.
extensions/​levelcode-ai/​test/​providers.test.js Tests effort forwarding into request bodies.
extensions/​levelcode-ai/​test/​compactReasoningHost.test.js Tests compaction budgets and effort.
extensions/​levelcode-ai/​test/​catalog.test.js Checks Argon capabilities and effort selection.
extensions/​levelcode-ai/​test/​agentReasoningBudget.test.js Tests agent token budgets.
extensions/​levelcode-ai/​providers/​openaiCompat.js Serializes reasoning effort.
extensions/​levelcode-ai/​providers/​index.js Forwards effort through provider dispatch.
extensions/​levelcode-ai/​providers/​catalog.js Adds Argon metadata and effort helper.
extensions/​levelcode-ai/​extension.js Applies chat effort and compaction settings.
extensions/​levelcode-ai/​agent.js Raises reasoning-model budgets and selects effort.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@ndemianc
ndemianc merged commit 179eb03 into develop Oct 15, 2026
3 checks passed
@ndemianc
ndemianc deleted the feat/gemini-4-argon branch October 15, 2026 01:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants