You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Feature: Round‑2 Gap Closure — Interrupts, Large Tool‑Result Storage, Parallel‑Tool Path Overlap, Error Classifier, Shared Subagent Budget, Title Auto‑Gen, Dialectic User Model, Credential Pool, Reasoning‑Block Handling, Safe Skill Installs
Overview
Follow‑up to #1471 (merged as #1472). After shipping skill mutation, nudges, and the improvements extraction fix, a second end‑to‑end walk — from first‑run onboarding → agent runtime → multi‑agent orchestration → self‑improvement persistence — surfaced 11 additional gaps against a best‑in‑class self‑improving agent. All are additive, safe‑by‑default, and behind feature flags.
NOTE: This issue has been audited and corrected based on findings in #1490. Several gaps identified below already exist in the codebase.
Implementable by another agent from this issue alone. Each phase is independently mergeable.
Background — Why a round 2
PR #1472 closed 3 of the 8 acceptance criteria in #1471 (skill CRUD protocol + tool, nudge mechanism, LearnConfig.improvements auto‑extraction). A full re‑walk of the agent lifecycle confirmed the remaining architectural gaps are outside the scope of that PR and warrant their own tracked ticket so they can be phased in without bloating one PR.
Evidence — confirmed gaps as of commit d25e852c on main (Corrected per #1490)
All greps executed against praisonaiagents + praisonai packages (excluding venv/ and tests/).
praisonai/cli/commands/setup.py — existing 173-line setup wizard → sufficient for G1
praisonaiagents/memory/learn/stores.py:208 — PersonaStore with categorization → sufficient for G10
Architecture Analysis
Current agent turn (simplified)
Agent.start(prompt)
└─► execution_mixin._run_loop()
└─► for i in range(max_iterations):
├─► llm.get_response(messages, tools)
├─► call_executor.execute(tool_calls) ◄── no overlap check
├─► append tool results to messages ◄── full result inline
└─► if no more tool_calls: break
└─► _trigger_after_agent_hook()
├─► _process_auto_memory
├─► _process_auto_learning
└─► _maybe_emit_nudge (merged in #1472)
Target agent turn (this issue)
Agent.start(prompt)
├─► if not session.title: schedule title_gen [G8]
│
└─► execution_mixin._run_loop()
└─► while not max_iterations_reached:
├─► if interrupt_requested: break [G2]
├─► llm.get_response(...)
│ └─► on_error → check context_overflow [G5]
│ → trigger compressor → retry
├─► call_executor.execute(
│ tool_calls,
│ overlap_guard=True [G4]
│ )
├─► for r in tool_results:
│ if len(r) > threshold:
│ ref = tool_result_store.put(r) [G3]
│ replace inline content with ref
│ strip <think>...</think> [G9]
└─► if no more tool_calls: break
└─► post‑turn:
├─► _process_auto_learning
├─► _maybe_emit_nudge
└─► trajectory.record_turn
Feature: Round‑2 Gap Closure — Interrupts, Large Tool‑Result Storage, Parallel‑Tool Path Overlap, Error Classifier, Shared Subagent Budget, Title Auto‑Gen, Dialectic User Model, Credential Pool, Reasoning‑Block Handling, Safe Skill Installs
Overview
Follow‑up to #1471 (merged as #1472). After shipping skill mutation, nudges, and the improvements extraction fix, a second end‑to‑end walk — from first‑run onboarding → agent runtime → multi‑agent orchestration → self‑improvement persistence — surfaced 11 additional gaps against a best‑in‑class self‑improving agent. All are additive, safe‑by‑default, and behind feature flags.
NOTE: This issue has been audited and corrected based on findings in #1490. Several gaps identified below already exist in the codebase.
Implementable by another agent from this issue alone. Each phase is independently mergeable.
Background — Why a round 2
PR #1472 closed 3 of the 8 acceptance criteria in #1471 (skill CRUD protocol + tool, nudge mechanism,
LearnConfig.improvementsauto‑extraction). A full re‑walk of the agent lifecycle confirmed the remaining architectural gaps are outside the scope of that PR and warrant their own tracked ticket so they can be phased in without bloating one PR.Evidence — confirmed gaps as of commit
d25e852conmain(Corrected per #1490)All greps executed against
praisonaiagents+praisonaipackages (excludingvenv/andtests/).praisonai init)ls praisonai/cli/commands/*.pysetup.py(173 L) provides wizard functionalitygrep "set_interrupt|is_interrupted|interrupt_requested" praisonaiagents praisonaigrep "maybe_persist_tool_result|tool_result_storage" praisonaiagents praisonaigrep "_paths_overlap|overlap_detect" praisonaiagents praisonaicall_executor.pyruns tools concurrently with no write‑conflict guardllm/llm.py:628 _is_rate_limit_errorexistscontext_limit/auth/transient/permanentcategoriesgrep "sanitize_surrogate|surrogatepass|_strip_non_ascii"grep -r "IterationBudget|iteration_budget" praisonaiagents;autonomy.py:131 max_iterations: int = 20is per‑agentgrep "generate_title|auto_title"session/hierarchy.pyhas atitlefield but no generator<think>…</think>/ provider thinking blocks) handlinggrep "scratchpad|thinking_blocks|<think>"LearnConfig.persona=Truestores flat strings inPersonaStorePersonaStorealready supports structured categorization withadd_preference(),add_profile()methodsgrep "credential_pool|CredentialPool|key_rotation|OPENAI_API_KEY_POOL"llm/failover.pygrep "osv.dev|OSV"SkillMutatorProtocolwrites files but no OSV check on installed scripts/referencesAudit Results (From #1490)
The following gaps have been reassessed and corrected:
❌ Won't Fix Items (Already Exist or Low Value)
praisonai setupcommand already provides 173-line wizard with provider selection, API key management, non-interactive modelitellmwhich handles unicode properlyPersonaStorealready supports structured categorization viaadd_preference(category)andadd_profile(aspect)methodslitellmalready provides provider-level failover; niche feature that doubles key management complexity✅ Keep Items (With Reduced Scope)
Revised LOC Estimate
What PraisonAI already has (DRY — reuse, don't duplicate)
praisonaiagents/llm/failover.py—LLMFailover+_is_rate_limit_error→ extend with context-overflow classifierpraisonaiagents/llm/protocols.py—LLMRateLimiterProtocol→ reuse for rate trackingpraisonaiagents/tools/call_executor.py—create_tool_call_executor(parallel=True)→ extend with overlap detectionpraisonaiagents/agent/protocols.py:406—interrupt()protocol stub exists → implementpraisonaiagents/session/hierarchy.py— sessiontitlefield present → add generatorpraisonaiagents/context/{store,aggregator,instrumentation}.py— existing truncation infrastructure → extendpraisonai/cli/commands/setup.py— existing 173-line setup wizard → sufficient for G1praisonaiagents/memory/learn/stores.py:208—PersonaStorewith categorization → sufficient for G10Architecture Analysis
Current agent turn (simplified)
Target agent turn (this issue)
Revised Implementation Plan
G2 — Interrupt (50 LOC)
Wire existing
agent/protocols.py:406interrupt stub:Agent.interrupt()→ sets Event flag_run_loopG3 — Large Tool Result Storage (150 LOC, wrapper only)
Extend existing truncation:
load_truncated(ref)toolcontext/store.pyandcontext/aggregator.pyG4 — Path Overlap Guard (100 LOC)
Add to
call_executor.py:G5 — Error Classifier (30 LOC)
Context-overflow detection only:
is_context_overflow(err) -> boolhelpercontext/compressor.py→ retryG8 — Session Title Auto-gen (100 LOC)
Add to existing session infrastructure:
generate_title()from first user+assistant exchangeG9 — Thinking Block Handling (15 LOC)
Render-path stripping only:
<think>...</think>in output formatterG12 — OSV Scan (150 LOC, gated)
Only after Skills Hub Phase 6:
Acceptance Criteria (Revised)
G2 — interrupt
agent.interrupt()stops mid‑run within ≤1 iterationasyncioand threadingG3 — tool result storage
load_truncated(ref)for full contentcontext/aggregator.pytruncationG4 — path overlap guard
G5 — context overflow classifier
G8 — session title
session.titleis emptyG9 — thinking blocks
<think>...</think>content stripped from user-visible outputG12 — OSV scan
Technical Considerations
Dependencies
httpx,tiktoken)Performance
Event.is_set()per iteration (nanoseconds)Backward Compatibility
PersonaStoreandsetupcommand preserved as-isFiles to Create / Modify (Revised)
New files (minimal)
praisonaiagents/agent/interrupt.pypraisonai/tools/result_escape.pypraisonaiagents/session/title.pytests/unit/agent/test_interrupt.pytests/unit/session/test_title.pyModified files
praisonaiagents/agent/agent.pypraisonaiagents/tools/call_executor.pypraisonaiagents/llm/llm.pypraisonaiagents/session/hierarchy.pyTotal: ~345 LOC (vs original 2200 LOC estimate)
References
praisonaiagents/agent/protocols.py:406— existinginterrupt()protocol stubpraisonai/cli/commands/setup.py— existing 173‑line setup wizardpraisonaiagents/memory/learn/stores.py:208— existingPersonaStorepraisonaiagents/context/{store,aggregator,instrumentation}.py— existing truncation infrastructure