Skip to content

fix: default unknown models to the full prompt, single-source product identity and version - #286

Merged
konard merged 3 commits into
mainfrom
issue-285-531ca23a5284
Jul 30, 2026
Merged

fix: default unknown models to the full prompt, single-source product identity and version#286
konard merged 3 commits into
mainfrom
issue-285-531ca23a5284

Conversation

@konard

@konard konard commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #285 — three defects that made a session's behaviour unattributable, all fixed with the generalizations requested in the issue rather than another if.

1 — Unknown models no longer fall back to the without-todo prompt

js/src/session/system.ts now resolves the prompt through a rule table with an explicit default:

  • default is anthropic.txt (12 mentions of todo) instead of qwen.txt (0);
  • the resolution is logged on every run — system prompt: anthropic (default for unknown model formalai/formal-ai) (service system-prompt), so a run's prompt is attributable from its log;
  • models that genuinely break on todo tools opt out explicitly via AGENT_SYSTEM_PROMPT=anthropic-without-todo (also usable to pin any other prompt: anthropic, beast, codex, gemini, grok-code, polaris). An unknown value is ignored with a warning. This also removes the "no workaround from the caller side" gap.

2 — The agent no longer says it is opencode

New js/src/branding.ts holds the product identity (name, repo, issues URL, docs URL) in one place and substitutes it at render time, so the prompt files stay byte-identical to their upstream originals and a rename is one edit instead of eight. Applied to every provider prompt, the summarize/title prompts, and the bash tool description (which also mentioned opencode).

Bug reports the model is told to file now go to https://github.com/link-assistant/agent/issues.

3 — Session records report the real version

New js/src/version.ts reads the package manifest and is the single source for --version, the process log and Session.createNext (js/src/session/index.ts previously hard-coded agent-cli-1.0.0).

How to reproduce the original behaviour

agent --model formalai/formal-ai --print-logs --verbose "say hi"

Before: the system message begins You are opencode, an interactive CLI tool…, contains no todo instructions, points users at sst/opencode/issues, and the stored session record says "version": "agent-cli-1.0.0".
After: the system message is the full anthropic prompt with todo discipline, all product references point at this repo, and the session record carries the real version (0.25.3).

Tests

js/tests/system-prompt.ts (new):

  • unknown model ids resolve to the default prompt and that prompt contains todo instructions — this is the check that makes the class of regression impossible;
  • known model ids keep their dedicated prompt;
  • AGENT_SYSTEM_PROMPT opt-out works and invalid values are ignored;
  • no rendered prompt matches /opencode/i, sst/opencode or opencode.ai — branding cannot regress when a prompt is re-synced from upstream;
  • SystemPrompt.header still returns the anthropic OAuth spoof (api-surface guard).

js/tests/version.ts (new):

  • VERSION === package.json version, is semver-shaped, and session records use the shared constant.
npm test
 623 pass  4 todo  0 fail  1274 expect() calls
 Ran 627 tests across 52 files.

npm run check (eslint + prettier + file size) passes.

Adding .gitkeep for PR creation (default mode).
This file will be removed when the task is complete.

Issue: #285
@konard konard self-assigned this Jul 30, 2026
…g and version

- Resolve the system prompt from a table with an explicit, logged default
  (anthropic, which includes todo/task-tracking) instead of silently falling
  back to the without-todo qwen prompt for every unrecognised model id.
  AGENT_SYSTEM_PROMPT provides an explicit opt-out.
- Add src/branding.ts as the single source of the product identity and apply
  it at render time to system prompts and tool descriptions, so the agent no
  longer identifies as opencode or routes bug reports to sst/opencode.
- Add src/version.ts reading the package manifest; use it for --version, the
  process log and session records (was hard-coded 'agent-cli-1.0.0').
- Add regression tests for all three.

Fixes #285
@konard konard changed the title [WIP] Unknown models fall back to the without-todo prompt, which also tells the model it is opencode; session records report a hard-coded version fix: default unknown models to the full prompt, single-source product identity and version Jul 30, 2026
@konard
konard marked this pull request as ready for review July 30, 2026 18:42
…actor

The refactor accidentally removed the anthropic OAuth spoof header helper,
breaking every session (TypeError: SystemPrompt.header is not a function).
Restore it and add a test covering the exported api surface.
@konard

konard commented Jul 30, 2026

Copy link
Copy Markdown
Contributor Author

Working session summary

Done. PR: #286 (ready for review, all CI green — run 30571970748).

What changed — all three defects from issue #285:

  1. Unknown models no longer get the without-todo prompt. js/src/session/system.ts now resolves the prompt from a rule table with an explicit default of anthropic.txt (12 todo mentions) instead of qwen.txt (0), logs the resolution on every run (system prompt: anthropic (default for unknown model formalai/formal-ai), service system-prompt), and supports an explicit opt-out / pin via AGENT_SYSTEM_PROMPT — which also fills the "no caller-side workaround" gap.

  2. The agent no longer identifies as opencode. New js/src/branding.ts holds name/repo/issues/docs in one place and substitutes them at render time, so the eight prompt files stay byte-identical to their upstream originals and a rename is one edit. Also applied to the bash tool description, which mentioned opencode too. Bug reports now route to link-assistant/agent/issues.

  3. Session records carry the real version. New js/src/version.ts reads the package manifest and is the single source for --version, the process log, and Session.createNext (was hard-coded agent-cli-1.0.0).

Tests (js/tests/system-prompt.ts, js/tests/version.ts): unknown model ids must get a prompt containing todo instructions; no rendered prompt may match /opencode/i, sst/opencode or opencode.ai; VERSION === package.json version.

One thing worth flagging: my first push broke every session — the refactor edit accidentally dropped SystemPrompt.header (the anthropic OAuth spoof), which the CI integration job caught. It's restored in 072d9d6 with an api-surface test guarding it.


This summary was automatically extracted from the AI working session output.

@konard

konard commented Jul 30, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost: $3.586678

📊 Context and tokens usage:

  • 81.8K / 1M (8%) input tokens, 24.0K / 128K (19%) output tokens

Total: (148 new + 68.0K cache writes + 4.6M cache reads) input tokens, 24.0K output tokens, $3.586678 cost

🤖 Models used:

  • Tool: Anthropic Claude Code
  • Requested: opus (claude-opus-5)
  • Thinking level: off (disabled)
  • Model: Claude Opus 5 (claude-opus-5)

📎 Log file uploaded as Gist (1832KB)


Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
konard merged commit cff4148 into main Jul 30, 2026
10 checks passed
@konard

konard commented Jul 30, 2026

Copy link
Copy Markdown
Contributor Author

🎉 Auto-merged

This pull request has been automatically merged by hive-mind.

  • All CI checks have passed

Auto-merged by hive-mind with --auto-merge flag

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.

Unknown models fall back to the without-todo prompt, which also tells the model it is opencode; session records report a hard-coded version

1 participant