Feat/framework enhance - #49
Merged
Merged
Conversation
[MILESTONE] P0 PCD Cache-Aware: all acceptance criteria met (DeepSeek real regression) - token-weighted cache hit rate: 84.9% (target >=70%) - session resume first-turn cache hit: confirmed - compression provider isolation: verified Subsystem 1 — Cache Boundary & Disclosure: - CacheBoundary enum (NONE/SOFT/COMMITTED) in context_disclosure.py - PromptAssemblyPlan cache_boundary + stable_tool_names fields - DisclosurePlanner cache-aware path (commitment_status/committed_level) Subsystem 2 — PrefixCommitment Enforcement: - CommitmentEnforcement frozen snapshot + enforce/break/force_commit - Four break-commitment integration points (posture/tool_error/slash/transform) - Two-phase cache optimization (skew fix): evaluate before marker application - SOFT boundary activation (projected_savings > 0) - min_prefix_tokens threshold: 1024 -> 768 for earlier commitment Subsystem 3 — Prompt Cache Strategy: - PrefixCacheOptimizer boundary-aware: COMMITTED passthrough (byte-stable) - AnthropicCacheStrategy static/dynamic system prompt split + tool marker - Provider-aware CacheStrategy selection via plugin capability (cache_type) - Removed unused cache_ttl parameter Subsystem 4 — Compression Provider Isolation: - Independent compression provider (compression_* settings) - summarize_fn routing to dedicated provider - Graceful degradation on construction failure Subsystem 5 — Session Resume Prefix Protection: - DuckDB schema v7: session snapshot columns - SessionSnapshot read/write API (conversation_store) - force_commit on resume with cache_priority/tool_freshness policy [MILESTONE] Anthropic Native Provider: - AnthropicChat provider (AsyncAnthropic, cache_control passthrough) - AnthropicPlugin (cache_type=explicit_breakpoint) - Optional anthropic SDK dependency with graceful degradation [MILESTONE] Prefix Stability Optimization: - Volatile context (memory/knowledge/focus) separated from stable system prefix - Independent system message with _volatile_context marker - PrefixCacheOptimizer excludes volatile from stable prefix - Result: R1 cold-start hit rate 40.4% -> 96.5% (+56pp) [MILESTONE] Measurement Caliber Alignment: - SessionCacheStats: token-weighted + steady-state + per-turn average - format_log_line and to_learning_signal dual-caliber output - Configurable steady_state_skip_turns (default=3) Engineering Quality: - Internal marker sanitization (_sanitize_messages in OpenAI provider) - Anthropic volatile marker skip (no wasted cache breakpoints) - Streaming text path usage telemetry fix - Anthropic usage denominator correction (cache_read + cache_creation) - 34 files, +6233/-124 lines, 150+ new test cases, 0 regressions Signed-off-by: 班扬 <xingjun.wxj@alibaba-inc.com>
Two bugs fixed: 1. MessageHealer._close_interrupted_tool_sequence injected a synthetic assistant message without reasoning_content during normal tool loops. DeepSeek thinking mode requires all assistant messages to carry reasoning_content; the synthetic message violated this constraint causing a 400 invalid_request_error. Fix: detect valid parent assistant(tool_calls) and skip injection when tool sequence is intact. 2. thinking_disable recovery strategy did not actually set planned_enable_thinking=False, causing the retry to repeat the same 400 error. Fix: both non-streaming and streaming loops now properly disable thinking on TRANSFORM_AND_RETRY with thinking_disable. Verified with real DeepSeek API (deepseek-flash): thinking + tool_calls + second-round LLM call all succeed after fix. Signed-off-by: 班扬 <xingjun.wxj@alibaba-inc.com>
…ckages and delegate components Phase 0: Delete dead stubs (resilience.py, terminal_io.py) Phase 1: Reorganize 28 files into 5 sub-packages (recovery/, context/, task_planning/, tools/, session/) Phase 2: Extract 43 free functions into _message_helpers, _tool_helpers, _stream_helpers Phase 3: Extract 5 delegate components (PromptAssembler, CalibrationManager, SkillDispatcher, SessionPersistence, LearningBridge) Phase 4: Unify streaming/non-streaming paths via OutputSink abstraction Phase 5: Extract ToolDispatchEngine (22 tool execution methods) Phase 6-7: Fix Critical/High issues, add engine module architecture rules to AGENTS.md engine.py: 7482 -> 2539 lines (-66%), 228 -> 86 methods (-62%) Tests: 4239 passed, 0 non-journey failures, 90/90 architecture contracts pass Signed-off-by: 班扬 <xingjun.wxj@alibaba-inc.com>
Split the monolithic agent execution tests into focused modules, add 166 direct unit tests for engine delegate components, harden incident ledger checks, and introduce an opt-in live LLM CI lane with strict token, call, and deadline budgets. Signed-off-by: 班扬 <xingjun.wxj@alibaba-inc.com>
Add focused tests for configuration, security actions, daemon coordinators, learning, signal fusion, and live token budgets. Fix nearest-event fusion matching, add coverage reporting, refresh the impact map, and provide safe cassette diagnostics. Signed-off-by: 班扬 <xingjun.wxj@alibaba-inc.com>
Rich Markdown silently strips <string>, <module>, <stdin> etc. from tracebacks, making error diagnostics unreadable. Escape them as inline code before rendering. Add AGENTS.md rule for tool output integrity. Signed-off-by: 班扬 <xingjun.wxj@alibaba-inc.com>
Codify prompt cache hit rate protection: system prompt anchor contracts, prefix commitment lifecycle, compression frozen-segment invariant, provider cache metric propagation, and session resume cache policy end-to-end rule. Signed-off-by: 班扬 <xingjun.wxj@alibaba-inc.com>
Facade plugin aggregating registry, daemon, engine, and build_info into faceted self_describe and lightweight runtime_snapshot tools. Registry version gate and TTL caching keep data current without hot-path cost. CORE-tier PCD whitelist ensures the agent can always introspect. Signed-off-by: 班扬 <xingjun.wxj@alibaba-inc.com>
…curator, scheduler - feat(engine): add /btw side-question fiber with cache-parity isolation - feat(cli): unified leap doctor with 5-domain diagnostic checks - feat(engine): BM25 tool search with budget-driven progressive disclosure - feat(skills): skill curator MVP with active/stale/archived lifecycle - feat(scheduler): productize execution mode unification and UX - fix(scheduler): ok=False with max_retries=0 now correctly marks FAILED - fix(engine): /btw explicitly disables tools and thinking - fix(scheduler): /schedule cancel routes through coordinator for cloud tasks
…asks /btw was entering the command queue and showing '#2 queued' instead of executing concurrently. Add a side-command bypass in submit_text() that creates an asyncio.Task for SideQuestionFiber, allowing immediate execution while the main task continues. Signed-off-by: 班扬 <xingjun.wxj@alibaba-inc.com>
…on-ops, compression-timeout, memory-nudge - feat(security): Guardian LLM intelligent approval with DenialBreaker circuit breaker - feat(engine): StreamingThinkScrubber for reasoning content filtering - feat(storage): session archive/pin/hide operations with /session CLI commands - feat(recovery): compression timeout ladder strategy (60s/300s/900s cooldown tiers) - feat(memory): periodic memory nudge policy with EventBus integration - fix(security): Guardian as optional enhancement, static rules remain first defense - fix(engine): ScrubberSink adapts to real OutputSink Protocol interface
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Feature
/btwside-question fiber — lightweight inline question handler that forks a cache-parity isolated fiber, explicitly disabling tools and extended thinking to keep answers fast and cheap.leap doctor— unified diagnostic command with 5 domain checks (config, connectivity, platform, state, tools). Protocol-based and extensible.skill_curation_storein DuckDB.SelfAwarenessPlugin— unified agent self-cognition tool giving the LLM structured access to its own identity, capabilities, and runtime state.Refactor
AgentEnginebroken into 6 delegate components (PromptAssembler,CalibrationManager,SkillDispatcher,SessionPersistence,LearningBridge,ToolDispatchEngine) and 5 sub-packages (recovery/,context/,task_planning/,tools/,session/).context_compressor,context_control,context_disclosure,context_focus, andreference_resolverrelocated underengine/context/._message_helpers.py,_stream_helpers.py,_tool_helpers.pysplit out of the monolithic engine to enforce single-responsibility.Enhance
/schedule cancelnow routes throughcoordinatorfor cloud tasks; execution mode displayed in status output; structured logs queryable per task.Fix
ok=Falsewithmax_retries=0now correctly marks taskFAILEDinstead of silently swallowing./btw— explicitly disables tools and thinking to prevent accidental tool invocation in side-questions./schedule cancel— routes through coordinator so cloud-scheduled tasks are properly cancelled.Docs
docs/plugins/.