Skip to content

feat: default the AI session to Claude Opus 5.5 and refresh the model list - #213

Open
apgiorgi wants to merge 2 commits into
mainfrom
apgiorgi/opus-5.5
Open

apgiorgi wants to merge 2 commits into
mainfrom
apgiorgi/opus-5.5

Conversation

@apgiorgi

Copy link
Copy Markdown
Collaborator

Summary

  • Default AI model: claude-opus-5 → claude-opus-5-5 (applies to everyone, including doers on DoiT-provided access).
  • /model list replaced with the current generation: claude-opus-5-5, claude-fable-5-2, claude-sonnet-5-5, claude-haiku-5-5.
  • Older ids saved in ai_settings.json or DCI_AI_MODEL still work (unknown claude-* ids are accepted with a warning).

Compatibility

Requests don't send thinking or a forced tool_choice, which the 5.5 models reject; the medium effort default already matches Opus 5.5's API default.

Test plan

  • go vet .
  • go test .

… list

/model now offers the current generation: claude-opus-5-5 (default),
claude-fable-5-2, claude-sonnet-5-5 and claude-haiku-5-5. Previously
saved or DCI_AI_MODEL ids keep working (accepted with a warning).

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code review found no issues

No high-confidence issues detected in this change.

@taltultc taltultc left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🔴 Customer switching

After set_customer_context, the CLI changes the system prompt and resends the previous signed thinking block. Fable 5.2 rejects the next request with HTTP 400, and Opus 5.5 can too. Please keep the prompt stable, return the new customer in the tool result, and add a regression test. Anthropic’s prefix-check rules

@apgiorgi

Copy link
Copy Markdown
Collaborator Author

@taltultc Fixing. Will be in the next commit

Opus 5.5 and the Fable models bind each thinking block to the top-level
system prompt. The session re-rendered the prompt's context tail on every
request, so after set_customer_context the next request replayed a thinking
block under a changed prompt and failed with HTTP 400.

The tail is now frozen at the conversation's first request. The agent's
switch is reported in the set_customer_context result, and context changes
from /customer or a re-login are appended to the next user message.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

2 optional suggestions (nits or notes on pre-existing code) were found and not posted.

Comment thread ai_session.go
Comment on lines +491 to +494
s.freezeSystemTailLocked()
history := append([]anthropic.MessageParam{}, s.history...)
model := s.model
tail := s.systemTail

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 If a user runs /customer while a turn is running, the agent keeps working for the rest of that turn as if the old tenant were active. Its commands already run against the new one. The context-change check now runs only in composeUserMessageLocked, which fires once per question. params() resends the frozen tail on every tool round. Fix: run the same check before each round in runTurn. On a change, add the "Session context update" text block to the user message that carries the tool results (ai_session.go:576), so the change is announced within the turn.

Why this was flagged

The TUI does not block verbs during a turn. submit() sends to runVerb, and the "customer" case (ai_tui.go:1672-1690) writes the saved context and calls ClearCustomerOverride while the turn is in flight. Every later run_dci_command child in that turn runs against the new tenant, because EffectiveCustomer reads the file (ai_tools.go:216). The tool_result sent to the model holds only outcome.Data with no tenant tag (ai_session.go:746). The tenant is attached only to the TUI event. runTurn calls s.params() on each of up to aiMaxToolRounds=16 rounds (ai_session.go:530). Before this change, each call re-rendered aiVolatileSystem with the current customer, so the model saw the switch on its next round. Now params() resends the frozen systemTail. The update is added only on the user's next question (ai_session.go:431). For the rest of the turn the model reports the new tenant's data as the old tenant's. A re-login mid-turn (refreshAuthState, ai_tui.go:722) behaves the same way.

Verification: On the base commit, params() re-rendered the volatile tail on every request, so each tool round showed the model the current tenant. Now params() sends tail := s.systemTail, which is rendered once and never re-rendered. The context check runs only in composeUserMessageLocked, and the tool-result user message in runTurn (ai_session.go:576) gets no such check.

Finding ID: f-185a92f4

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