UAT: Persona scoped_projects and scoped_plans fields stored but never applied to context assembly #3991

Open
opened 2026-04-06 08:21:01 +00:00 by freemo · 0 comments
Owner

Metadata

  • Branch: fix/backlog-persona-scope-not-applied-to-context
  • Commit Message: fix(tui): apply persona scoped_projects and scoped_plans to context assembly
  • Milestone: None (Backlog)
  • Parent Epic: #868

Summary

The Persona model defines scoped_projects and scoped_plans fields (in src/cleveragents/tui/persona/schema.py) that are supposed to automatically include project/plan references in every prompt's context. However, these fields are only used to display a count in the PersonaBar widget — they are never passed to the context assembly system (ACMS) or included in agent invocations.

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

Current Behavior

  1. Persona.scoped_projects and Persona.scoped_plans are defined in src/cleveragents/tui/persona/schema.py (lines 29-30)
  2. These fields are only referenced in one place in the entire codebase: src/cleveragents/tui/app.py (line 158):
    scope_count = len(persona.scoped_projects) + len(persona.scoped_plans)
    scope_text = f"{scope_count} scope refs"
    
    This is purely for display in the PersonaBar.
  3. When a user submits a prompt in the TUI, the on_input_submitted handler does NOT retrieve the persona's scoped_projects/scoped_plans and does NOT pass them to the context assembly pipeline
  4. A persona with scoped_projects: ["local/api-service", "local/frontend"] will show "2 scope refs" in the PersonaBar but those projects will NOT be included in the context for any prompt

Expected Behavior (from ADR-045 §Scope Behavior)

Per docs/adr/ADR-045-tui-persona-system.md §Scope Behavior:

When a persona has scoped projects or plans:

  1. Every prompt submitted in a session using that persona implicitly includes those project/plan references in the context. This is equivalent to the user typing @project:<name> for each scoped project in every prompt.
  2. The @ reference system can add additional projects/plans for a single prompt — these are additive to the persona's scope.
  3. Context assembly (ACMS) receives the combined scope (persona scope + prompt @ references) and prioritizes those resources in the CRP for the resulting plan.

Per docs/specification.md §Persona Cycling (line ~29140):

When cycling, the PersonaBar updates immediately. The actor binding for the session is updated — subsequent prompts use the new persona's actor and scope.

Steps to Reproduce

  1. Create a persona with scoped_projects: ["local/my-project"]
  2. Launch the TUI and set the persona as active
  3. Observe the PersonaBar shows "1 scope refs"
  4. Submit a prompt
  5. Observe: The prompt is processed WITHOUT local/my-project in the context scope — the persona's scoped project is silently ignored

Code Location

  • Field definitions: src/cleveragents/tui/persona/schema.py, lines 29-30
  • Only usage (display only): src/cleveragents/tui/app.py, line 158
  • Where scope should be applied: src/cleveragents/tui/app.py, on_input_submitted() handler — when building the context for the agent invocation
  • Context assembly entry point: src/cleveragents/application/services/ — the ACMS pipeline that assembles context for agent calls

Subtasks

  • Identify the context assembly integration point in the TUI prompt submission flow
  • Retrieve persona.scoped_projects and persona.scoped_plans from the active persona when a prompt is submitted
  • Pass the scoped references to the context assembly pipeline (ACMS) as implicit @project: and @plan: references
  • Ensure persona scope is additive with explicit @ references in the prompt
  • Add Behave BDD tests verifying that persona scope is included in context assembly
  • Verify coverage >= 97% via nox -s coverage_report

Definition of Done

  • Persona scoped_projects are automatically included in context for every prompt in the TUI
  • Persona scoped_plans are automatically included in context for every prompt in the TUI
  • Explicit @ references in the prompt are additive to persona scope (not replacing it)
  • BDD tests verify the scope application behavior
  • All nox stages pass
  • Coverage >= 97%

Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: ca-new-issue-creator

## Metadata - **Branch**: `fix/backlog-persona-scope-not-applied-to-context` - **Commit Message**: `fix(tui): apply persona scoped_projects and scoped_plans to context assembly` - **Milestone**: None (Backlog) - **Parent Epic**: #868 ## Summary The `Persona` model defines `scoped_projects` and `scoped_plans` fields (in `src/cleveragents/tui/persona/schema.py`) that are supposed to automatically include project/plan references in every prompt's context. However, these fields are only used to display a count in the PersonaBar widget — they are never passed to the context assembly system (ACMS) or included in agent invocations. > **Backlog note:** This issue was discovered during autonomous operation on milestone v3.7.0. It does not block milestone completion and has been placed in the backlog for human review and future milestone assignment. ## Current Behavior 1. `Persona.scoped_projects` and `Persona.scoped_plans` are defined in `src/cleveragents/tui/persona/schema.py` (lines 29-30) 2. These fields are only referenced in one place in the entire codebase: `src/cleveragents/tui/app.py` (line 158): ```python scope_count = len(persona.scoped_projects) + len(persona.scoped_plans) scope_text = f"{scope_count} scope refs" ``` This is purely for display in the PersonaBar. 3. When a user submits a prompt in the TUI, the `on_input_submitted` handler does NOT retrieve the persona's `scoped_projects`/`scoped_plans` and does NOT pass them to the context assembly pipeline 4. A persona with `scoped_projects: ["local/api-service", "local/frontend"]` will show "2 scope refs" in the PersonaBar but those projects will NOT be included in the context for any prompt ## Expected Behavior (from ADR-045 §Scope Behavior) Per `docs/adr/ADR-045-tui-persona-system.md` §Scope Behavior: > When a persona has scoped projects or plans: > 1. **Every prompt** submitted in a session using that persona implicitly includes those project/plan references in the context. This is equivalent to the user typing `@project:<name>` for each scoped project in every prompt. > 2. **The `@` reference system** can add additional projects/plans for a single prompt — these are additive to the persona's scope. > 3. **Context assembly** (ACMS) receives the combined scope (persona scope + prompt @ references) and prioritizes those resources in the CRP for the resulting plan. Per `docs/specification.md` §Persona Cycling (line ~29140): > When cycling, the PersonaBar updates immediately. The actor binding for the session is updated — **subsequent prompts use the new persona's actor and scope.** ## Steps to Reproduce 1. Create a persona with `scoped_projects: ["local/my-project"]` 2. Launch the TUI and set the persona as active 3. Observe the PersonaBar shows "1 scope refs" 4. Submit a prompt 5. Observe: The prompt is processed WITHOUT `local/my-project` in the context scope — the persona's scoped project is silently ignored ## Code Location - **Field definitions**: `src/cleveragents/tui/persona/schema.py`, lines 29-30 - **Only usage (display only)**: `src/cleveragents/tui/app.py`, line 158 - **Where scope should be applied**: `src/cleveragents/tui/app.py`, `on_input_submitted()` handler — when building the context for the agent invocation - **Context assembly entry point**: `src/cleveragents/application/services/` — the ACMS pipeline that assembles context for agent calls ## Subtasks - [ ] Identify the context assembly integration point in the TUI prompt submission flow - [ ] Retrieve `persona.scoped_projects` and `persona.scoped_plans` from the active persona when a prompt is submitted - [ ] Pass the scoped references to the context assembly pipeline (ACMS) as implicit `@project:` and `@plan:` references - [ ] Ensure persona scope is additive with explicit `@` references in the prompt - [ ] Add Behave BDD tests verifying that persona scope is included in context assembly - [ ] Verify coverage >= 97% via `nox -s coverage_report` ## Definition of Done - [ ] Persona `scoped_projects` are automatically included in context for every prompt in the TUI - [ ] Persona `scoped_plans` are automatically included in context for every prompt in the TUI - [ ] Explicit `@` references in the prompt are additive to persona scope (not replacing it) - [ ] BDD tests verify the scope application behavior - [ ] All nox stages pass - [ ] Coverage >= 97% --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
HAL9000 added this to the v3.5.0 milestone 2026-04-09 03:12:14 +00:00
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.

Blocks
Reference
cleveragents/cleveragents-core#3991
No description provided.