UAT: builtin/context skill query_history tool missing scope parameter — plan-scoped history filtering not implemented #2464

Open
opened 2026-04-03 18:30:45 +00:00 by freemo · 1 comment
Owner

Metadata

  • Branch: fix/m5-context-query-history-scope-param
  • Commit Message: fix(skills): add scope parameter to query_history tool in builtin/context skill
  • Milestone: v3.4.0
  • Parent Epic: #396

Background

The spec (docs/specification.md, ACMS > CRP > builtin/context Skill section) defines the query_history tool with a scope parameter:

- name: query_history
  description: "Query historical context about past decisions and changes"
  input_schema:
    type: object
    properties:
      query: { type: string }
      scope: { type: string, enum: ["current_plan", "plan_tree", "all_plans"],
               default: "plan_tree" }
    required: [query]

Actual behaviour: SKILL_CONTEXT_QUERY_HISTORY_SPEC in src/cleveragents/skills/builtins/context_ops.py defines query_history with only a query property — the scope parameter is completely absent from both the input schema and the handler implementation _handle_query_history(). The handler always searches across all tiers without any plan-scoped filtering.

Expected behaviour: The query_history tool must accept a scope parameter with values current_plan, plan_tree, or all_plans (default: plan_tree). The handler must filter historical context fragments based on the scope:

  • current_plan: Only fragments from the current plan
  • plan_tree: Fragments from the current plan and all ancestor plans
  • all_plans: All historical fragments regardless of plan

Code location: src/cleveragents/skills/builtins/context_ops.py

  • SKILL_CONTEXT_QUERY_HISTORY_SPEC (line ~379)
  • _handle_query_history() (line ~231)

Severity: Medium — actors cannot scope historical context queries to their plan hierarchy, which is a core CRP feature.

Steps to reproduce:

  1. Call query_history with scope="current_plan" — the parameter is silently ignored
  2. Observe that all historical fragments are returned regardless of plan scope

Subtasks

  • Write a failing BDD scenario in features/ that reproduces the bug (TDD — failing test first)
  • Add scope property to SKILL_CONTEXT_QUERY_HISTORY_SPEC input schema with enum ["current_plan", "plan_tree", "all_plans"] and default "plan_tree"
  • Update _handle_query_history() to accept and validate the scope argument
  • Implement current_plan scope filtering: return only fragments belonging to the current plan
  • Implement plan_tree scope filtering: return fragments from the current plan and all ancestor plans
  • Implement all_plans scope filtering: return all historical fragments (existing behaviour)
  • Ensure scope defaults to "plan_tree" when not provided by the caller
  • Add/update unit tests (Behave scenarios) covering all three scope values and the default
  • Add/update Robot Framework integration test asserting scope filtering works end-to-end
  • Run nox -e typecheck — confirm no Pyright errors
  • Run nox -e lint — confirm no lint errors
  • Run nox -e unit_tests — all scenarios pass
  • Run nox -e coverage_report — coverage remains ≥ 97%

Definition of Done

  • All subtasks above are checked off
  • SKILL_CONTEXT_QUERY_HISTORY_SPEC input schema includes scope with correct enum and default
  • _handle_query_history() correctly filters by current_plan, plan_tree, and all_plans
  • Calling query_history with scope="current_plan" returns only current-plan fragments
  • Calling query_history with no scope defaults to plan_tree behaviour
  • BDD scenarios cover all three scope values and the missing-scope default
  • All nox stages pass
  • Coverage >= 97%
  • Commit fix(skills): add scope parameter to query_history tool in builtin/context skill pushed to branch fix/m5-context-query-history-scope-param
  • PR merged and this issue closed

Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: ca-uat-tester

## Metadata - **Branch**: `fix/m5-context-query-history-scope-param` - **Commit Message**: `fix(skills): add scope parameter to query_history tool in builtin/context skill` - **Milestone**: v3.4.0 - **Parent Epic**: #396 ## Background The spec (`docs/specification.md`, ACMS > CRP > `builtin/context` Skill section) defines the `query_history` tool with a `scope` parameter: ```yaml - name: query_history description: "Query historical context about past decisions and changes" input_schema: type: object properties: query: { type: string } scope: { type: string, enum: ["current_plan", "plan_tree", "all_plans"], default: "plan_tree" } required: [query] ``` **Actual behaviour**: `SKILL_CONTEXT_QUERY_HISTORY_SPEC` in `src/cleveragents/skills/builtins/context_ops.py` defines `query_history` with only a `query` property — the `scope` parameter is completely absent from both the input schema and the handler implementation `_handle_query_history()`. The handler always searches across all tiers without any plan-scoped filtering. **Expected behaviour**: The `query_history` tool must accept a `scope` parameter with values `current_plan`, `plan_tree`, or `all_plans` (default: `plan_tree`). The handler must filter historical context fragments based on the scope: - `current_plan`: Only fragments from the current plan - `plan_tree`: Fragments from the current plan and all ancestor plans - `all_plans`: All historical fragments regardless of plan **Code location**: `src/cleveragents/skills/builtins/context_ops.py` - `SKILL_CONTEXT_QUERY_HISTORY_SPEC` (line ~379) - `_handle_query_history()` (line ~231) **Severity**: Medium — actors cannot scope historical context queries to their plan hierarchy, which is a core CRP feature. **Steps to reproduce**: 1. Call `query_history` with `scope="current_plan"` — the parameter is silently ignored 2. Observe that all historical fragments are returned regardless of plan scope ## Subtasks - [ ] Write a failing BDD scenario in `features/` that reproduces the bug (TDD — failing test first) - [ ] Add `scope` property to `SKILL_CONTEXT_QUERY_HISTORY_SPEC` input schema with enum `["current_plan", "plan_tree", "all_plans"]` and default `"plan_tree"` - [ ] Update `_handle_query_history()` to accept and validate the `scope` argument - [ ] Implement `current_plan` scope filtering: return only fragments belonging to the current plan - [ ] Implement `plan_tree` scope filtering: return fragments from the current plan and all ancestor plans - [ ] Implement `all_plans` scope filtering: return all historical fragments (existing behaviour) - [ ] Ensure `scope` defaults to `"plan_tree"` when not provided by the caller - [ ] Add/update unit tests (Behave scenarios) covering all three scope values and the default - [ ] Add/update Robot Framework integration test asserting scope filtering works end-to-end - [ ] Run `nox -e typecheck` — confirm no Pyright errors - [ ] Run `nox -e lint` — confirm no lint errors - [ ] Run `nox -e unit_tests` — all scenarios pass - [ ] Run `nox -e coverage_report` — coverage remains ≥ 97% ## Definition of Done - [ ] All subtasks above are checked off - [ ] `SKILL_CONTEXT_QUERY_HISTORY_SPEC` input schema includes `scope` with correct enum and default - [ ] `_handle_query_history()` correctly filters by `current_plan`, `plan_tree`, and `all_plans` - [ ] Calling `query_history` with `scope="current_plan"` returns only current-plan fragments - [ ] Calling `query_history` with no `scope` defaults to `plan_tree` behaviour - [ ] BDD scenarios cover all three scope values and the missing-scope default - [ ] All nox stages pass - [ ] Coverage >= 97% - [ ] Commit `fix(skills): add scope parameter to query_history tool in builtin/context skill` pushed to branch `fix/m5-context-query-history-scope-param` - [ ] PR merged and this issue closed --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-uat-tester
freemo added this to the v3.4.0 milestone 2026-04-03 18:30:50 +00:00
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • MoSCoW: Should Have — Important spec requirement or quality improvement. Should be included in the milestone if possible.

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

Issue triaged by project owner: - **State**: Verified - **MoSCoW**: Should Have — Important spec requirement or quality improvement. Should be included in the milestone if possible. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: ca-project-owner
freemo removed this from the v3.4.0 milestone 2026-04-06 21:01:29 +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
#396 Epic: ACMS Context Pipeline
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core#2464
No description provided.