Skip to content

feat: FocusOnVitalFewLevers — try full first, fall back to batched+compressed - #149

Merged
neoneye merged 1 commit into
PlanExeOrg:mainfrom
VoynichLabs:fix/focus-levers-fallback
Mar 6, 2026
Merged

feat: FocusOnVitalFewLevers — try full first, fall back to batched+compressed#149
neoneye merged 1 commit into
PlanExeOrg:mainfrom
VoynichLabs:fix/focus-levers-fallback

Conversation

@82deutschmark

Copy link
Copy Markdown
Collaborator

Problem

Local LLMs with small context windows (8K) can't handle the full enriched lever payload (~40KB for 13 levers). The previous approach (PR #134, now closed) always compressed levers, stripping review, consequences, and options fields — losing context the LLM needs for quality assessment.

Solution

Two-stage approach per Simon's feedback:

  1. First attempt: Send all enriched levers with ALL fields in a single LLM call
  2. On failure: Fall back to batched processing (groups of 4) with compressed levers (keeping only lever_id, name, description, synergy_text, conflict_text)

This means:

  • Cloud models and large-context local models get the full picture → better assessment quality
  • Small-context local models still work via the fallback path
  • No data loss for capable models

Changes

  • 1 file modified: focus_on_vital_few_levers.py
  • Refactored execute() into two stages
  • Added 3 helper methods: _assess_levers_full(), _compress_lever(), _assess_levers_batched()
  • No changes to data models or other files

Replaces

PR #134 (closed) which always compressed levers

@82deutschmark
82deutschmarkforce-pushed the fix/focus-levers-fallback branch 4 times, most recently from d926ff6 to 9bb3f3dCompareMarch 6, 2026 22:45
FocusOnVitalFewLeversTask now attempts a single LLM call with all
enriched lever fields (review, consequences, options, etc.) first.
Only if that fails (context overflow, HTTP 400, parse error) does
it fall back to batched processing with compressed levers.
This preserves full context for cloud models and large-context local
models while maintaining compatibility with smaller context windows.
Replaces the always-compress approach from PR PlanExeOrg#134 (closed).
@82deutschmark
82deutschmarkforce-pushed the fix/focus-levers-fallback branch from 9bb3f3d to 41d462aCompareMarch 6, 2026 22:47
@neoneye
neoneye merged commit 79663d0 into PlanExeOrg:mainMar 6, 2026
3 checks passed
@neoneye
neoneye deleted the fix/focus-levers-fallback branch March 6, 2026 22:50
huangyingting pushed a commit to repomesh/PlanExe that referenced this pull request Jun 26, 2026
Resolves Dependabot security alerts in worker_plan/pyproject.toml by bumping to the first stable patched release of each package:
- aiohttp 3.13.5 -> 3.14.1 (alerts PlanExeOrg#152,PlanExeOrg#153,PlanExeOrg#156-PlanExeOrg#164)
- tornado 6.5.4 -> 6.5.7 (alerts PlanExeOrg#113,PlanExeOrg#114,PlanExeOrg#136,PlanExeOrg#155,PlanExeOrg#165,PlanExeOrg#166,PlanExeOrg#171)
- python-multipart 0.0.22 -> 0.0.32 (alerts PlanExeOrg#142,PlanExeOrg#149,PlanExeOrg#167-PlanExeOrg#170)
- urllib3 2.6.3 -> 2.7.0 (alerts PlanExeOrg#150,PlanExeOrg#151)
- marshmallow 3.24.2 -> 3.26.2 (alert PlanExeOrg#81), staying on 3.x to avoid the breaking 4.x major
transformers alert PlanExeOrg#137 is excluded: its only fix is the 5.x major line and the vulnerable Trainer class is never imported by PlanExe (handled separately).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@82deutschmark@neoneye