0.2.8 - #41
Merged
Merged
Conversation
…evolution improvements
… live DAG patching
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.
[0.2.8] - 2026-07-29
Unified DAG Runner (
internal/workflow/)The legacy
graph.Graph+engine.Workflowdual runtime architecture has been unified into a single IR-based pipeline:internal/workflow/spec.go): Single intermediate representation withNodeSpec,EdgeSpec,ConditionExpr,NodeID,LoopSpec,ScheduleSpec,RetrySpec,RecoverySpec,InterruptSpec. Bothengine.Workflowandgraph.Graphcompile to this IR.internal/workflow/runner.go): SingleRunner.Execute(ctx, spec)— FIFO scheduler, condition evaluation, interrupt handling (HITL), recovery policies, loop support, runtime mutations viaPatchQueue.RunningWorkflow(ctx, spec, functions)convenience entry point.internal/workflow/runner_checkpoint.go):ResumeExecution()with spec hash verification, scheduler state restoration, pending mutation re-queuing, pending interrupt restoration. Schema v3 with durable event sequences.internal/workflow/compiler.go,binding.go):CompileFromEngine()/CompileFromEngineWithBindings()/CompileBound()convert legacyengine.Workflowandgraph.Graphto executableBoundWorkflowwith predicate and router closures.internal/workflow/scheduler.go): Incremental topological scheduler with conditional edge evaluation, branch-skipping, JoinAll/JoinAny/Merge join policies, ready-queue with configurable selectors.internal/workflow/scope.go): Transactional state (pending→committed), per-node status tracking, loop history, pending interrupts, event sequencing,ExecutionScopedcollector.internal/workflow/mutation.go,patch_queue.go): Six typed mutations (add/remove/replace node, add/remove edge, update policy).PatchQueue.Enqueuewith dedup,Acknowledgeprefix commitment,Restorefrom checkpoint. Safe-point atomic application pipeline.internal/workflow/runner_events.go): 12 typed event types (started/resumed/started/completed/failed/skipped/interrupt pending/resolved/checkpoint saved/mutation applied/completed/failed) with ordered sequencing viaRunnerEventSink.CLOSURE_PLAN.md,ORPHAN_MODULES.md,ZERO_FRICTION_PLAN.md,outputs/DAG_UNIFIED_MERGE_*plan documents deleted.engine.NewDAG/NewExecutor/DynamicExecutor/Graph.executeproduction paths fully replaced.Context Compression Archive (
internal/ares_archive/)A new archive module that preserves structured per-round records before compaction discards raw conversation events:
record.go): Per-round structured entry withRound,Action,Summary,Files(P1 file-change list),Verdict(P2 pass/fail),Decisions(P0 architecture decisions),Refs(P3 identifier protection). JSON-serialized asround_N.json.writer.go): Atomic write (temp file + rename), round rotation (configurablemaxRounds), concurrent-safe.NewFileArchiveWriter(dir, maxRounds)creates the directory on demand.reader.go):Read(n),List(),Search(query)(case-insensitive substring across Summary/Decisions/Files/Refs),Recall(query)(human-readable multi-round output). Missing/empty directory handled gracefully.identifiers.go): Compiled regexes for P3-level protection — commit hashes (7+ hex), PR/issue numbers (#\d+), IP:port, owner/repo paths. These identifiers are preserved verbatim during extraction.sink.go): Bridgesares_events.CompactableEventStoreto the archive writer viaArchiveSinkinterface.BuildRoundRecord()extracts RoundRecord from raw events.store.go):NewCompactableStoreWithArchive()creates an archive-enabled event store. When enabled, each round's record is flushed before compaction discards the raw events.SDK Layer (
sdk/)sdk/sdk.go,options.go,config.go, +450 lines net):MustNew/Newruntime builder with functional options (WithAgent,WithLLM,WithMCP,WithMemory,WithRAG,WithWorkflow, etc.). Three execution modes:RunAgent(blocking),RunStream(streaming events),RunTeam(multi-agent orchestration).sdk/rag.go,sdk/memory_wiring_test.go, +350 lines): YAML-driven RAG configuration withenable_rag,rag_top_k,rag_min_score. Wiring tests verify the end-to-end configuration→runtime path.sdk/evolution.go): Strategy configuration for GA evolution within the SDK.Logic Closure Fixes
Comprehensive reliability closure across the runtime and evolution systems:
internal/evolution/patch/patch.go):RuntimePatchgainsID stringfield.Registry.applied map[string]booltracks already-applied patches.Apply()/ApplySet()silently skip duplicate IDs — prevents re-delivery attacks.internal/workflow/runner_checkpoint.go):CheckpointSnapshot.CollectorDatapreserves route/tool/memory/interrupt/error history across crashes.ExecutionCollector.Import()restores data on resume.ResumeExecution()reuses the caller'sExecutionCollector.internal/workflow/runner_execution.go): Child workflow collector data merged back into parent scope viaparent.Collector().Import(child.Collector().Export()).internal/workflow/graph/graph.go):Graph.Node()now returns error on duplicate node IDs (previously silent overwrite).Graph.Edge()deduplicates (from, to, condition) pairs.internal/workflow/validate.go):validateDuplicateEdges()checks for duplicate (From, To, Kind) edge triples.internal/workflow/engine/types.go,mutable_dag.go):strings.TrimSpaceapplied to step IDs inNewDAG()andAddNode().DependsOnarrays deduplicated.internal/ares_runtime/manager_chaos.go): 4 empty chaos stubs (PartitionNetwork,CorruptMemory,DisconnectMCP,InjectLLMFailure) now returnErrNotImplementedinstead of silent nil.internal/ares_runtime/manager_lifecycle.go):Start()now emitsEventAgentStartedfor agents registered beforeStart(), closing the event-sourcing gap.internal/ares_runtime/bus.go,internal/ares_events/memory_store.go):droppedEventsatomic counters added to bothPluginBusandMemoryEventStore. Drops are logged with event type and stream ID.internal/ares_runtime/manager_chaos.go,manager.go): Independentpausedflag added tomanagedAgent.AgentInfo.Pausedexposed to callers.NotifyAgentDeadandhealthCheckskip paused agents.internal/workflow/graph/patcher.go):applyInsertNode,applyRemoveNode,applyReplaceNodeall now holdgraph.muwhile reading/writingnodesmap — closing data race windows.internal/ares_events/pg_store.go): Removed the unusedargIdx++after the last query parameter.internal/ares_runtime/bus.go): Recovered panic values logged withslog.Default().Error(), includingpanic_typeandpanic_valuefields.internal/workflow/runner.go):validateExecutionInput()callsValidate(spec)on everyExecute()— catches duplicate nodes/edges before execution.internal/ares_evolution/genome_wiring_run.go):submitToCoordinator()now queries registered genomes forFitnessGenomescores instead of hardcodingFitness: 0. Falls back to 0.5 baseline.api/bootstrap/bootstrap.go):dashboardMCPAdapteranddashboardLLMAdapterbridge*ares_mcp.MCPManagerand*llm.Clientto the dashboardMCPExecutor/LLMExecutorinterfaces. Previous TODO (expected 2026-09-30) resolved.internal/knowledge/runtime/runtime.go):cfg.LazyLoading=truenow clampsbudget.ForGraphto 2000 tokens before the reduce step, producing a genuinely smaller graph.Context Compression Archive (cont.)
extract.go): 578 lines — extracts round summary, action categorization, file changes, decisions, Refs from raw conversation events. Action inference handles Chinese keywords (修复/审查/设计/实现).internal/ares_archive/,examples/13-archive-akg-chain/): Full pipeline demo reading.workbuddy/memory/→ processing through AKG knowledge pipeline → structured knowledge objects. Example README documents real capabilities and limitations.Public API Layer (
api/)Eight new public API packages, all re-exporting internal types via type aliases so external callers never import
internal/. The public surface is now stable and documented inapi/README.md.api/agent(agent.go):Agentinterface for creating, running, and streaming from agents. Re-exportsAgentType,AgentStatus,EventType,AgentEventfrominternal/agents/base. Built-in agent type constants (Leader, Top, Bottom, Destination, Food, Hotel, Itinerary).api/workflow(workflow.go): Public workflow API re-exportingWorkflow,Step,NodeRouter,RetryPolicy,RecoveryPolicy,LoopConfig,InterruptConfig,ConditionFunc,AgentFactory,WorkflowResult,StepResultfrominternal/workflow/engine.api/evolution(evolution.go): Public strategy evolution API —Strategy,Lineage,Population,DreamCycleorchestrator, GAPopulation, mutation (pubmutation), and promotion subsystems. External modules can evolve strategies without coupling tointernal/ares_evolution.api/knowledge(knowledge.go,service.go): Public Knowledge Fabric API withKnowledgeObject,KnowledgeLink,KnowledgeGraph,Providerinterface, andServicefacade. Storage-agnostic: back it with PostgreSQL, SQLite, memory, or any custom provider.api/graph(graph.go): Public DAG API re-exportingGraph,Node,Edge,State,Result,Condition,NodeRouter, and five scheduler types (Default,Priority,ShortJob,RoundRobin,WeightedFair).api/embedding(service.go):EmbeddingServiceinterface for vector embedding operations. Storage-agnostic — callers may back it with PostgreSQL, SQLite-vec, pgvector, or any vector database.Embed(),EmbedWithPrefix(),BatchEmbed()methods.api/experience(types.go,repository.go): Public experience storage and memory distillation DTOs.ExperienceRepositoryinterface lets external modules implement experience persistence with any vector database. FourMemoryTypeconstants:knowledge,preference,interaction,profile.api/service/workflow(service.go): Workflow service bridge updated to work with the new public workflow API.Self-Healing Evolution System
internal/evolution/coordinator/coordinator.go):Coordinatornow orchestrates self-healing evolution — detecting runtime regressions and automatically proposing corrective patches. +108 lines of coordinator logic.internal/ares_runtime/manager.go): Runtime manager gains +29 lines for DAG runtime registration, enabling evolution patches to target the DAG topology.internal/ares_bootstrap/bootstrap.gowires the new registration (+7 lines).internal/evolution/deployment/deployment.go, +237 lines): Canary deployment strategy with automatic rollback on regression. Pipeline:Coordinator.Apply(patch)→StagingRuntime.Apply(patch)→StagingRuntime.Evaluate()→ if pass:LiveRuntime.Apply(patch); if fail:StagingRuntime.Rollback(). DefaultEnabled=false. Includesdeployment_test.go(+161 lines).internal/ares_evolution/generate_diff_patches_test.go, +235 lines): New test verifying the end-to-end diff patch generation pipeline.YAML-Driven Distillation & Config Options
api/memory/distillation/distillation.go,internal/ares_memory/distillation/distiller.go,distiller_admin.go): New YAML-drivendistillation_thresholdconfig. Semantics:0= ungated (fire every event),N= fire every N conversation rounds. Mirrors the v0.2.4examples/knowledge-base/config.yamlconvention. Theclassifier.golost 16 lines (consolidated into distiller).internal/ares_config/config.go+10 lines,sdk/config.go+165 lines,sdk/options.go+163 lines): New SDK config options formax_history,max_sessions,enable_distillation,distillation_threshold. All default to zero/false, falling back to component defaults.sdk/config_test.go(+275 lines) andinternal/ares_memory/distillation/distiller_test.go(+157 lines) verify the new options.examples/12-yaml-driven-flags/): New example demonstrating all new YAML-driven config flags.ares.yaml(+19 lines) andmain.go(+83 lines).Brand Assets
assets/logo/): Three new SVG logo assets —ares-lockup.svg(+23 lines),ares-logo-board.svg(+49 lines),ares-mark.svg(+19 lines).Documentation
docs/articles/{en,zh}/ga-deep-dive.md(+649/+647 lines): Deep-dive into GA internals.docs/articles/{en,zh}/ga-genealogy.md(+605/+599 lines): GA genealogy and lineage tracking.docs/articles/{en,zh}/ga-promoter.md(+451/+451 lines): GA promoter and promotion logic.docs/articles/{en,zh}/ga-selection-benchmark.md(+352/+350 lines): GA selection strategy benchmarks.docs/articles/{en,zh}/ga-tiered-scorer.md(+407/+405 lines): Tiered scorer architecture.examples/10-ga-full-evolution/main.go: Refactored — 528 lines changed (simplification, -357 net lines after the article rewrite).Examples
examples/21-ai-assistant-integration/main.go(+100 lines): New AI assistant integration example demonstrating the publicapi/agentAPI. Originally +91 lines ined62bae, then +18 lines in2225940for self-healing wiring, then +3 lines in4fa46d7for cancel-on-error.examples/22-evolution-blocks/main.go(+148 lines): New evolution blocks example demonstrating the publicapi/evolutionAPI.examples/README.md(+2 lines): Updated to list the two new examples.examples/01-10/ares.yaml,cmd/monitor-live/config.yaml): All 11 exampleares.yamlfiles and the monitor-live config now include commented-out memory subsystem tuning fields (max_history,max_sessions,enable_distillation,distillation_threshold) pointing toexamples/12-yaml-driven-flagsfor semantics. (+61 lines across 11 files.)Refactor
1d14107): Extractedapi/embedding/service.go(+77 lines) andapi/experience/{types.go,repository.go}(+252 lines) to public packages.internal/storage/postgres/embedding/service.gosimplified (-76 lines net).internal/ares_memory/distillation/memory.gorefactored (-155 lines, +155 lines — moved logic to public API layer).internal/ares_memory/embedding/pipeline.goupdated to use new public embedding API.internal/knowledge/service/adapter.go+126 lines,adapter_test.go+90 lines): New adapter bridging the publicapi/knowledgeAPI to the internal Knowledge Fabric runtime.internal/ares_memory/memory_patcher.go+73 lines,production_manager.go+22 lines,manager_impl.go+22 lines): Memory patcher and production manager enhanced to support the new deployment pipeline.Documentation Completion
Closed the gap between code modules and article coverage. Seven new articles (Chinese + English) cover the previously undocumented modules:
docs/articles/{en,zh}/00-sdk-layer.md): Thesdk/package —MustNew/New, functional options, Agent/Team/Stream, config-driven setup. The user-facing main entry point, now documented.docs/articles/{en,zh}/00-knowledge-graph-build.md): The AKF Knowledge Fabric construction side —Plan → Load → Link → Reduce → Graphpipeline, four Linkers (Decision, Architecture, Similarity, Timeline), three Stores, lazy subgraphs. Article X only covered retrieval; this covers construction.docs/articles/{en,zh}/00-storage-layer.md):internal/storage/postgres/— Pool, CircuitBreaker, WriteBuffer, Timeout. 14,112 lines of foundational infrastructure, now documented as a coherent layer.docs/articles/{en,zh}/00-llm-client-layer.md):internal/llm/andinternal/llmservice/— FailoverClient with rate-limit-aware cooldown, DeepSeek ReasoningContent support, multi-provider output adapters.docs/articles/{en,zh}/00-evaluation-framework.md):internal/ares_eval/— LLMJudgeEvaluator (1-10/1-5/pass-fail scales), DimensionJudgeEvaluator, Runner/Comparison/ConcurrentRunner. The fitness function for the GA engine.docs/articles/{en,zh}/00-config-system.md):internal/ares_config/config.goandsdk/config.go— one YAML driving twelve modules, typed validation, path traversal protection, zero-value philosophy, v0.2.8 distillation threshold.docs/articles/{en,zh}/00-quant-trading.md):internal/ares_quant/— the honest assessment of the 9,768-line experiment. Market data sources, market making engine, portfolio metrics, research agents. Labeled as experiment; extraction to separate repo deferred.Documentation Fixes
flight-recorder-deep-divewas renumbered from (XIII) to (XVI) to resolve the conflict withbootstrap-api-deep-dive. Both English and Chinese versions updated.docs/articles/{en,zh}/architecture-overview-deep-dive.md): Series list extended from XII to include XIII (Bootstrap), XIV (Plugin), XV (MCP), XVI (Flight Recorder), plus the seven new00-*articles.README.md,README_CN.md): Added the seven new articles to the Articles section.