Skip to content

Move system_prompt_override test infrastructure off AgentSession #1093

Closed

Description

@malibio

Background

system_prompt_override on AgentSession (a public, Tauri-serialized struct) embeds test infrastructure in the production domain model. This was flagged in a code review of PR #1091.

Problem

  • AgentSession is serialized and exposed via Tauri commands to the frontend
  • The field is used only by integration tests (ollama_integration.rs) to inject pre-built prompts without a live database
  • The conventional alternative is to keep test infrastructure out of production domain types

Challenge

A simple #[cfg(test)] on the struct field doesn't work because:

  • Integration tests in tests/ compile against the library in non-test mode
  • #[cfg(test)] on library fields is NOT active when linked from tests/*.rs binaries

Possible Approaches

  1. Separate test-only session type: Create an AgentSessionTestExt or test builder in the agent test module
  2. Inject via constructor: Give the test a way to pass the prompt override at session creation time via a separate test-facing create_session_with_prompt() method that is feature-gated
  3. Test service wrapper: Wrap LocalAgentService in a test-only struct that intercepts send_message to inject the prompt before forwarding
  4. testing feature flag: Add a testing Cargo feature that gates the field and method — properly excluded from production builds

Context

Activity

  1. malibio commented on May 17, 2026

    @malibio
    CollaboratorAuthor

    Frontend baseline: 128 test files passed, 3918 tests passed (Duration 43.24s). Note: integration tests in packages/agent/tests/ollama_integration.rs require live Ollama and are not part of the standard frontend baseline.

  2. self-assigned this
    on May 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions