Skip to content

V11: Cap output tokens in scaffolded agents - #681

Merged
LinuxDevil merged 1 commit into
mainfrom
v11-scaffold-max-tokens
Oct 19, 2026
Merged

LinuxDevil merged 1 commit into
mainfrom
v11-scaffold-max-tokens

Conversation

@LinuxDevil

Copy link
Copy Markdown
Owner

Fixes audit finding DX-3 / PM-10 (Vercel competitor audit, 2026-10-19).

What was wrong

create-lousho-agent --provider openrouter --template tools --yes then npm run dev failed with This request requires more credits, or fewer max_tokens. You requested up to 65536 tokens: the generated agent set no output cap, so OpenRouter reserved the model's full max output.

What changed

  • create-lousho-agent just runs lousho init, so the shared template source is src/cli/init/templates.ts. Generated src/agent.ts (minimal and tools templates, every provider) now has const modelSettings = { maxTokens: 4096 } with a comment on why and how to raise it, passed to both the default config and buildAgent(provider).
  • Generated README gets a Troubleshooting entry for the credit error (non-yaml templates).
  • Snapshots updated (12 agent.ts snapshots).

Tests

  • New test in src/cli/init/templates.test.ts: every provider x non-yaml template has the cap in agent.ts and the README entry.
  • npx tsc --noEmit, typecheck:tests, lint clean; test:coverage 406 files passed; fallow exit 0; packages/create-lousho-agent e2e (real install, typecheck and test of openai + openrouter projects) passed.

Changelog: Scaffolded agents set a default modelSettings: { maxTokens: 4096 } so first runs do not fail on low-credit keys (OpenRouter), and the scaffold README documents the credit error.

🤖 Generated with Claude Code

Scaffolded agent.ts sets modelSettings { maxTokens: 4096 } so first runs do not
fail on low-credit OpenRouter keys; README gets a troubleshooting entry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@LinuxDevil
LinuxDevil force-pushed the v11-scaffold-max-tokens branch from f99189e to 19b6406 Compare October 19, 2026 21:43
@LinuxDevil
LinuxDevil merged commit a900b50 into main Oct 19, 2026
2 checks passed
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.

1 participant