fix: PlanContextInheritance does not prioritise fragments near child focus #4198

Open
opened 2026-04-07 07:57:55 +00:00 by freemo · 0 comments
Owner

Bug Report

Test: features/depth_breadth_projection.feature:221
Scenario: PlanContextInheritance prioritises fragments near the child focus

Description

The PlanContextInheritance service does not correctly prioritise skeleton fragments that are closest to the child focus node when computing child context with a budget constraint.

The test sets up two parent fragments:

  • project://src/app/main.py (score 0.2) — same path as the focus
  • project://lib/aux.py (score 0.9) — different path

With focus project://src/app/main.py and a tight budget of 60 tokens, the service should prioritise the fragment matching the focus node first (regardless of score), so main.py should appear as the first skeleton fragment.

The test asserts:

  • skeleton_fragments has 2 entries
  • The first child skeleton fragment should contain "main.py"

Acceptance Criteria

  • PlanContextInheritance ranks fragments by proximity to the focus node before applying score ranking
  • When focus is project://src/app/main.py, the fragment for that node appears first in skeleton output
  • Unit test at features/depth_breadth_projection.feature:221 passes without @tdd_expected_fail

Labels

  • Type/Bug
  • Priority/High

TDD Tag

@tdd_issue_ISSUE_NUMBER — update once this issue is created

## Bug Report **Test:** `features/depth_breadth_projection.feature:221` **Scenario:** `PlanContextInheritance prioritises fragments near the child focus` ## Description The `PlanContextInheritance` service does not correctly prioritise skeleton fragments that are closest to the child focus node when computing child context with a budget constraint. The test sets up two parent fragments: - `project://src/app/main.py` (score 0.2) — same path as the focus - `project://lib/aux.py` (score 0.9) — different path With focus `project://src/app/main.py` and a tight budget of 60 tokens, the service should prioritise the fragment matching the focus node first (regardless of score), so `main.py` should appear as the **first** skeleton fragment. The test asserts: - `skeleton_fragments` has 2 entries - The first child skeleton fragment should contain `"main.py"` ## Acceptance Criteria - [ ] `PlanContextInheritance` ranks fragments by proximity to the focus node before applying score ranking - [ ] When focus is `project://src/app/main.py`, the fragment for that node appears first in skeleton output - [ ] Unit test at `features/depth_breadth_projection.feature:221` passes without `@tdd_expected_fail` ## Labels - Type/Bug - Priority/High ## TDD Tag `@tdd_issue_ISSUE_NUMBER` — update once this issue is created
HAL9000 self-assigned this 2026-04-08 12:11:23 +00:00
HAL9000 added this to the v3.4.0 milestone 2026-04-08 12:11:23 +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.

Dependencies

No dependencies set.

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