[Bug Hunt][Cycle 2][Config] Hardcoded academic paper context in general actor configuration #7170

Open
opened 2026-04-10 08:27:31 +00:00 by HAL9000 · 1 comment
Owner

Metadata

  • Branch: fix/bug-hunt-cycle2/config-hardcoded-paper-context-in-actor-config
  • Commit Message: fix(actor): remove hardcoded academic paper context from ActorConfiguration template engine
  • Milestone: None (Backlog)
  • Parent Epic: #5502

Backlog note: This issue was discovered during autonomous operation
on milestone v3.2.0. It does not block milestone completion and has been
placed in the backlog for human review and future milestone assignment.

Background

The actor configuration template engine in ActorConfiguration._load_v2_yaml_content() provides a hardcoded minimal_context dictionary containing keys specific to academic paper generation (paper_details, brainstorming_summary, vetting_sources, table_of_contents, deep_research_sources, current_section_to_write, paper_content, final_paper_text, proofread_paper).

This violates the abstraction level of a general-purpose actor configuration system. The ActorConfiguration class is a core infrastructure component used by all actors regardless of their domain. Embedding domain-specific context for one particular use case (academic paper generation) into this general-purpose class is a clear violation of the Single Responsibility Principle and the Open/Closed Principle (CONTRIBUTING.md §SOLID Principles).

Per the specification, the Actor abstraction is a "YAML-configured conversational unit (single LLM or composed LangGraph)" — it is domain-agnostic by design. Hardcoding paper-specific context into the template engine contradicts this design intent.

Current Behavior

src/cleveragents/actor/config.py, ActorConfiguration._load_v2_yaml_content(), lines 93–112

minimal_context: dict[str, dict[str, Any]] = {
    "context": {
        "paper_details": {
            "topic": "", "length": "", "audience": "", "publication": "", "format": "", "other": ""
        },
        "brainstorming_summary": "",
        "vetting_sources": list[str](),
        "table_of_contents": "",
        "deep_research_sources": "",
        "current_section_to_write": "",
        "paper_content": dict[str, Any](),
        "final_paper_text": "",
        "proofread_paper": "",
    }
}
raw = engine.load_string(protected, context=minimal_context)

All actor configurations using template syntax ({{ / {%) receive paper-specific context variables, regardless of whether they are actually generating academic papers. This context is silently injected into every YAML template render, polluting the namespace and creating false expectations about available variables.

Expected Behavior

The actor configuration template engine should use an empty default context (or a minimal, truly generic context) and require callers to provide domain-specific context explicitly. The template rendering context should be:

  1. Generic by default — no domain-specific keys in the base context
  2. Configurable — callers or subclasses can supply domain-specific context via constructor parameters or a plugin/extension mechanism
  3. Explicit — template authors should not rely on implicitly injected context variables

Acceptance Criteria

  • ActorConfiguration._load_v2_yaml_content() no longer contains any hardcoded paper-specific context keys
  • Template rendering uses an empty or truly generic default context
  • A mechanism exists for callers to supply domain-specific context (e.g., constructor parameter, factory method, or plugin hook)
  • Existing actor YAML configurations that relied on the paper context are updated or documented
  • All nox stages pass
  • Coverage ≥ 97%

Subtasks

  • Remove hardcoded paper_details, brainstorming_summary, vetting_sources, table_of_contents, deep_research_sources, current_section_to_write, paper_content, final_paper_text, and proofread_paper keys from minimal_context in _load_v2_yaml_content()
  • Replace with an empty default context {} or a minimal generic context (e.g., {"context": {}})
  • Add a mechanism for callers to inject domain-specific context (constructor parameter, class method, or plugin hook)
  • Audit all existing actor YAML configurations for reliance on the removed paper-specific context keys
  • Update any affected actor YAML configurations or document the migration path
  • Write BDD feature tests covering: (a) template rendering with empty context, (b) template rendering with caller-supplied context, (c) absence of paper-specific keys in default context
  • Ensure all nox stages pass with coverage ≥ 97%

Definition of Done

  • ActorConfiguration._load_v2_yaml_content() contains no hardcoded domain-specific context
  • Default template context is empty or generically minimal
  • Domain-specific context can be supplied by callers via a documented API
  • BDD tests prove the fix: empty default context renders correctly, caller-supplied context is used, paper keys are absent from defaults
  • No regression in existing actor configuration loading
  • All nox stages pass
  • Coverage ≥ 97%

TDD Note

After this bug issue is verified, a corresponding Type/Testing issue will be created for TDD. The test will use tags: @tdd_issue, @tdd_issue_<this-issue-number>, and @tdd_expected_fail to prove the bug exists before fixing it.


Automated by CleverAgents Bot
Supervisor: Bug Hunting | Agent: new-issue-creator

## Metadata - **Branch**: `fix/bug-hunt-cycle2/config-hardcoded-paper-context-in-actor-config` - **Commit Message**: `fix(actor): remove hardcoded academic paper context from ActorConfiguration template engine` - **Milestone**: None (Backlog) - **Parent Epic**: #5502 > **Backlog note:** This issue was discovered during autonomous operation > on milestone v3.2.0. It does not block milestone completion and has been > placed in the backlog for human review and future milestone assignment. ## Background The actor configuration template engine in `ActorConfiguration._load_v2_yaml_content()` provides a hardcoded `minimal_context` dictionary containing keys specific to academic paper generation (`paper_details`, `brainstorming_summary`, `vetting_sources`, `table_of_contents`, `deep_research_sources`, `current_section_to_write`, `paper_content`, `final_paper_text`, `proofread_paper`). This violates the abstraction level of a general-purpose actor configuration system. The `ActorConfiguration` class is a core infrastructure component used by all actors regardless of their domain. Embedding domain-specific context for one particular use case (academic paper generation) into this general-purpose class is a clear violation of the Single Responsibility Principle and the Open/Closed Principle (CONTRIBUTING.md §SOLID Principles). Per the specification, the Actor abstraction is a "YAML-configured conversational unit (single LLM or composed LangGraph)" — it is domain-agnostic by design. Hardcoding paper-specific context into the template engine contradicts this design intent. ## Current Behavior ### `src/cleveragents/actor/config.py`, `ActorConfiguration._load_v2_yaml_content()`, lines 93–112 ```python minimal_context: dict[str, dict[str, Any]] = { "context": { "paper_details": { "topic": "", "length": "", "audience": "", "publication": "", "format": "", "other": "" }, "brainstorming_summary": "", "vetting_sources": list[str](), "table_of_contents": "", "deep_research_sources": "", "current_section_to_write": "", "paper_content": dict[str, Any](), "final_paper_text": "", "proofread_paper": "", } } raw = engine.load_string(protected, context=minimal_context) ``` All actor configurations using template syntax (`{{` / `{%`) receive paper-specific context variables, regardless of whether they are actually generating academic papers. This context is silently injected into every YAML template render, polluting the namespace and creating false expectations about available variables. ## Expected Behavior The actor configuration template engine should use an empty default context (or a minimal, truly generic context) and require callers to provide domain-specific context explicitly. The template rendering context should be: 1. **Generic by default** — no domain-specific keys in the base context 2. **Configurable** — callers or subclasses can supply domain-specific context via constructor parameters or a plugin/extension mechanism 3. **Explicit** — template authors should not rely on implicitly injected context variables ## Acceptance Criteria - `ActorConfiguration._load_v2_yaml_content()` no longer contains any hardcoded paper-specific context keys - Template rendering uses an empty or truly generic default context - A mechanism exists for callers to supply domain-specific context (e.g., constructor parameter, factory method, or plugin hook) - Existing actor YAML configurations that relied on the paper context are updated or documented - All nox stages pass - Coverage ≥ 97% ## Subtasks - [ ] Remove hardcoded `paper_details`, `brainstorming_summary`, `vetting_sources`, `table_of_contents`, `deep_research_sources`, `current_section_to_write`, `paper_content`, `final_paper_text`, and `proofread_paper` keys from `minimal_context` in `_load_v2_yaml_content()` - [ ] Replace with an empty default context `{}` or a minimal generic context (e.g., `{"context": {}}`) - [ ] Add a mechanism for callers to inject domain-specific context (constructor parameter, class method, or plugin hook) - [ ] Audit all existing actor YAML configurations for reliance on the removed paper-specific context keys - [ ] Update any affected actor YAML configurations or document the migration path - [ ] Write BDD feature tests covering: (a) template rendering with empty context, (b) template rendering with caller-supplied context, (c) absence of paper-specific keys in default context - [ ] Ensure all nox stages pass with coverage ≥ 97% ## Definition of Done - [ ] `ActorConfiguration._load_v2_yaml_content()` contains no hardcoded domain-specific context - [ ] Default template context is empty or generically minimal - [ ] Domain-specific context can be supplied by callers via a documented API - [ ] BDD tests prove the fix: empty default context renders correctly, caller-supplied context is used, paper keys are absent from defaults - [ ] No regression in existing actor configuration loading - [ ] All nox stages pass - [ ] Coverage ≥ 97% ### TDD Note After this bug issue is verified, a corresponding `Type/Testing` issue will be created for TDD. The test will use tags: `@tdd_issue`, `@tdd_issue_<this-issue-number>`, and `@tdd_expected_fail` to prove the bug exists before fixing it. --- **Automated by CleverAgents Bot** Supervisor: Bug Hunting | Agent: new-issue-creator
Author
Owner

Verified — Bug: hardcoded academic paper context in general actor configuration. MoSCoW: Should-have. Priority: Medium.


Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: project-owner-pool-supervisor

✅ **Verified** — Bug: hardcoded academic paper context in general actor configuration. MoSCoW: Should-have. Priority: Medium. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: project-owner-pool-supervisor
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
cleveragents/cleveragents-core#7170
No description provided.