session: use agent config backend/model as defaults; fix stubCore for ToolCallCount

This commit is contained in:
Levi Neely 2026-05-17 00:15:40 +02:00
parent c075964a1f
commit 5ec6ac6fe8
2 changed files with 12 additions and 5 deletions

View File

@ -365,6 +365,17 @@ func (s *SessionStore) createSession(args []string) error {
return err
}
} else {
cfg := LoadAgentConfig(s.cfg.AgentsDir, agentName, nil)
if cfg != nil {
allowTools = cfg.AllowTools
if backendOverride == "" && cfg.Backend != "" {
backendOverride = cfg.Backend
}
if modelOverride == "" && cfg.Model != "" {
modelOverride = cfg.Model
}
}
be, err := backend.NewWithName(backendOverride)
if err != nil {
return fmt.Errorf("backend: %w", err)
@ -381,11 +392,6 @@ func (s *SessionStore) createSession(args []string) error {
return fmt.Errorf("sessions dir: %w", err)
}
cfg := LoadAgentConfig(s.cfg.AgentsDir, agentName, nil)
if cfg != nil {
allowTools = cfg.AllowTools
}
var execOpts []execute.Option
if s.cfg.Strict {
execOpts = append(execOpts, execute.WithStrict())

View File

@ -95,6 +95,7 @@ func (c *stubCore) WaitChange(ctx context.Context, _, _ string) (string, bool) {
return "", false
}
func (c *stubCore) Close() { c.closed = true }
func (c *stubCore) ToolCallCount() int64 { return 0 }
// publishCore wraps stubCore and emits a realistic event sequence on Submit.
type publishCore struct {