refactor: agent lifecycle overhaul + session selector #95

Merged
jasoncouture merged 6 commits from undoing-claudes-dumbass-bullshit into main 2026-05-19 20:21:07 -04:00
jasoncouture commented 2026-05-19 20:20:42 -04:00 (Migrated from github.com)

Summary

  • Major refactor of agent lifecycle: split AgentManager into AgentHost, AgentLifecycleService, AgentInstanceRepository, AgentFactory; collapse IEventPublisher into IEventBus; rename ShearsPathsApplicationPathProvider.
  • New lifecycle/config events (AgentStartRequest, AgentShutdownRequest, AgentDeath, ConfigurationChangedNotification); session path/data abstractions (SessionPath, IAgentData, AgentSessionPath).
  • Web: session selector in chat header (ChatHeader.razor, AgentList.razor); disable forced memory index on startup.
  • Tests: new LlamaShears.IntegrationTests.Fixtures project; coverage for AgentInstanceRepository and AgentLifecycleService.

Test plan

  • dotnet build
  • dotnet test
## Summary - Major refactor of agent lifecycle: split `AgentManager` into `AgentHost`, `AgentLifecycleService`, `AgentInstanceRepository`, `AgentFactory`; collapse `IEventPublisher` into `IEventBus`; rename `ShearsPaths` → `ApplicationPathProvider`. - New lifecycle/config events (`AgentStartRequest`, `AgentShutdownRequest`, `AgentDeath`, `ConfigurationChangedNotification`); session path/data abstractions (`SessionPath`, `IAgentData`, `AgentSessionPath`). - Web: session selector in chat header (`ChatHeader.razor`, `AgentList.razor`); disable forced memory index on startup. - Tests: new `LlamaShears.IntegrationTests.Fixtures` project; coverage for `AgentInstanceRepository` and `AgentLifecycleService`. ## Test plan - [ ] `dotnet build` - [ ] `dotnet test`
github-actions[bot] commented 2026-05-19 20:22:23 -04:00 (Migrated from github.com)
Package Line Rate Branch Rate Complexity Health
LlamaShears.Core.Eventing 91% 84% 53
LlamaShears.Core.Abstractions 44% 27% 465
LlamaShears.Api 30% 30% 467
LlamaShears.Provider.Ollama 44% 28% 188
LlamaShears.Core.Eventing.Extensions 100% 100% 1
LlamaShears.Core 44% 42% 1542
LlamaShears.Provider.Onnx.Embeddings 37% 38% 72
LlamaShears.Provider.OpenAI 66% 65% 229
LlamaShears.Api.Web 1% 1% 462
LlamaShears.Hosting 33% 21% 27
LlamaShears.Plugins 0% 100% 1
LlamaShears.Core.Eventing 89% 75% 53
LlamaShears 52% 36% 25
LlamaShears.Plugins.Host 34% 24% 36
LlamaShears.Core.Abstractions 37% 17% 465
LlamaShears.Api 6% 1% 467
LlamaShears.Provider.Ollama 3% 1% 188
LlamaShears.IntegrationTests.Fixtures 73% 56% 59
LlamaShears.Core.Eventing.Extensions 100% 100% 1
StrangeSoft.Plugins.Host 20% 21% 87
LlamaShears.Core 43% 28% 1542
LlamaShears.Provider.Onnx.Embeddings 3% 0% 72
LlamaShears.Provider.OpenAI 2% 0% 229
LlamaShears.Api.Web 20% 9% 462
LlamaShears.Hosting 26% 8% 27
LlamaShears.Plugins 0% 100% 1
LlamaShears.Core.Eventing 89% 75% 53
LlamaShears 52% 36% 25
LlamaShears.Plugins.Host 34% 24% 36
LlamaShears.Core.Abstractions 27% 15% 465
LlamaShears.Api 7% 2% 467
LlamaShears.Provider.Ollama 3% 1% 188
LlamaShears.IntegrationTests.Fixtures 69% 50% 59
LlamaShears.Core.Eventing.Extensions 100% 100% 1
StrangeSoft.Plugins.Host 20% 21% 87
LlamaShears.Core 30% 18% 1542
LlamaShears.Provider.Onnx.Embeddings 3% 0% 72
LlamaShears.Provider.OpenAI 2% 0% 229
LlamaShears.Api.Web 18% 7% 462
LlamaShears.Hosting 26% 8% 27
LlamaShears.Analyzers.CodeFixes 85% 69% 60
LlamaShears.Analyzers 88% 76% 199
Summary 45% (11143 / 34798) 35% (2361 / 10253) 11193
Package | Line Rate | Branch Rate | Complexity | Health -------- | --------- | ----------- | ---------- | ------ LlamaShears.Core.Eventing | 91% | 84% | 53 | ✔ LlamaShears.Core.Abstractions | 44% | 27% | 465 | ❌ LlamaShears.Api | 30% | 30% | 467 | ❌ LlamaShears.Provider.Ollama | 44% | 28% | 188 | ❌ LlamaShears.Core.Eventing.Extensions | 100% | 100% | 1 | ✔ LlamaShears.Core | 44% | 42% | 1542 | ❌ LlamaShears.Provider.Onnx.Embeddings | 37% | 38% | 72 | ❌ LlamaShears.Provider.OpenAI | 66% | 65% | 229 | ➖ LlamaShears.Api.Web | 1% | 1% | 462 | ❌ LlamaShears.Hosting | 33% | 21% | 27 | ❌ LlamaShears.Plugins | 0% | 100% | 1 | ❌ LlamaShears.Core.Eventing | 89% | 75% | 53 | ✔ LlamaShears | 52% | 36% | 25 | ➖ LlamaShears.Plugins.Host | 34% | 24% | 36 | ❌ LlamaShears.Core.Abstractions | 37% | 17% | 465 | ❌ LlamaShears.Api | 6% | 1% | 467 | ❌ LlamaShears.Provider.Ollama | 3% | 1% | 188 | ❌ LlamaShears.IntegrationTests.Fixtures | 73% | 56% | 59 | ➖ LlamaShears.Core.Eventing.Extensions | 100% | 100% | 1 | ✔ StrangeSoft.Plugins.Host | 20% | 21% | 87 | ❌ LlamaShears.Core | 43% | 28% | 1542 | ❌ LlamaShears.Provider.Onnx.Embeddings | 3% | 0% | 72 | ❌ LlamaShears.Provider.OpenAI | 2% | 0% | 229 | ❌ LlamaShears.Api.Web | 20% | 9% | 462 | ❌ LlamaShears.Hosting | 26% | 8% | 27 | ❌ LlamaShears.Plugins | 0% | 100% | 1 | ❌ LlamaShears.Core.Eventing | 89% | 75% | 53 | ✔ LlamaShears | 52% | 36% | 25 | ➖ LlamaShears.Plugins.Host | 34% | 24% | 36 | ❌ LlamaShears.Core.Abstractions | 27% | 15% | 465 | ❌ LlamaShears.Api | 7% | 2% | 467 | ❌ LlamaShears.Provider.Ollama | 3% | 1% | 188 | ❌ LlamaShears.IntegrationTests.Fixtures | 69% | 50% | 59 | ➖ LlamaShears.Core.Eventing.Extensions | 100% | 100% | 1 | ✔ StrangeSoft.Plugins.Host | 20% | 21% | 87 | ❌ LlamaShears.Core | 30% | 18% | 1542 | ❌ LlamaShears.Provider.Onnx.Embeddings | 3% | 0% | 72 | ❌ LlamaShears.Provider.OpenAI | 2% | 0% | 229 | ❌ LlamaShears.Api.Web | 18% | 7% | 462 | ❌ LlamaShears.Hosting | 26% | 8% | 27 | ❌ LlamaShears.Analyzers.CodeFixes | 85% | 69% | 60 | ✔ LlamaShears.Analyzers | 88% | 76% | 199 | ✔ **Summary** | **45%** (11143 / 34798) | **35%** (2361 / 10253) | **11193** | ❌ <!-- Sticky Pull Request Commentcoverage -->
copilot-pull-request-reviewer[bot] (Migrated from github.com) reviewed 2026-05-19 20:25:48 -04:00
copilot-pull-request-reviewer[bot] (Migrated from github.com) left a comment

Pull request overview

This PR performs a major refactor of the agent runtime lifecycle by replacing the old AgentManager-centric design with a host/repository/lifecycle-service split, while also unifying event publishing into IEventBus and introducing session-path/data-scope abstractions. It also updates the web UI to surface live sessions and adds a shared integration-test fixture project to host deterministic provider stubs.

Changes:

  • Refactors agent lifecycle: introduces AgentHost, AgentLifecycleService, AgentInstanceRepository, AgentHandle (cold-to-hot), new lifecycle/config events, and removes AgentManager/IAgentManager.
  • Consolidates event publish/subscribe surfaces into IEventBus and renames ShearsPathsApplicationPathProvider.
  • Adds session/data-scope primitives (SessionPath, IAgentData) and updates UI/tests to support session selection + new integration test fixtures.

Reviewed changes

Copilot reviewed 120 out of 125 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
tests/LlamaShears.UnitTests/SystemPrompt/FilesystemSystemPromptProviderTests.cs Updates path provider usage to ApplicationPathProvider.
tests/LlamaShears.UnitTests/Provider/Onnx/OnnxEmbeddingProviderFactoryTests.cs Updates paths interface rename in test double.
tests/LlamaShears.UnitTests/Hosting/ApplicationPathProviderTests.cs Renames tests + updates instantiation to ApplicationPathProvider.
tests/LlamaShears.UnitTests/Eventing/EventFilterTests.cs Migrates tests from IEventPublisher to IEventBus.
tests/LlamaShears.UnitTests/Cron/JsonCronStoreTests.cs Updates paths provider usage for cron persistence tests.
tests/LlamaShears.UnitTests/Cron/CronSchedulerTests.cs Adjusts scheduler construction after removing IAgentManager dependency.
tests/LlamaShears.UnitTests/AgentConfigProviderTests.cs Updates paths provider usage.
tests/LlamaShears.UnitTests/Agent/Core/TestAgentConfigs.cs Switches scoped session data from SessionId to SessionPath.
tests/LlamaShears.UnitTests/Agent/Core/Persistence/JsonLineContextStoreTests.cs Updates paths provider type to IApplicationPathProvider.
tests/LlamaShears.UnitTests/Agent/Core/InferenceRunnerToolDispatchTests.cs Migrates event publishing dependency to IEventBus.
tests/LlamaShears.UnitTests/Agent/Core/ContextCompactorTests.cs Migrates event publishing dependency to IEventBus.
tests/LlamaShears.UnitTests/Agent/Core/AgentTurnFlowTests.cs Migrates event publishing dependency to IEventBus and updates dispatcher signatures.
tests/LlamaShears.UnitTests/Agent/Core/AgentLoopTests.cs Migrates event publishing dependency to IEventBus.
tests/LlamaShears.UnitTests/Agent/Core/AgentLifecycleServiceTests.cs Adds unit coverage for new AgentLifecycleService.
tests/LlamaShears.UnitTests/Agent/Core/AgentInterruptTests.cs Migrates event publishing dependency to IEventBus.
tests/LlamaShears.UnitTests/Agent/Core/AgentInterruptGracefulTests.cs Migrates event publishing dependency to IEventBus.
tests/LlamaShears.UnitTests/Agent/Core/AgentInstanceRepositoryTests.cs Adds unit coverage for new AgentInstanceRepository.
tests/LlamaShears.UnitTests/Agent/Core/AgentEventPublishingTests.cs Updates capturing publisher to wrap IEventBus and adds Subscribe passthrough.
tests/LlamaShears.IntegrationTests/LlamaShears.IntegrationTests.csproj Moves web-testing dependency into shared fixtures project.
tests/LlamaShears.IntegrationTests/ContextPersistenceTests.cs Updates event publish + paths provider usage; adjusts startup sequencing.
tests/LlamaShears.IntegrationTests.Web/LlamaShears.IntegrationTests.Web.csproj Uses shared fixtures project instead of referencing integration tests project directly.
tests/LlamaShears.IntegrationTests.Web/ChatSurfaceTests.cs Changes provider-resolution assertion approach to validate test DI setup.
tests/LlamaShears.IntegrationTests.Fixtures/LlamaShears.IntegrationTests.Fixtures.csproj New shared fixture project with Microsoft.AspNetCore.Mvc.Testing.
tests/LlamaShears.IntegrationTests.Fixtures/Hosting/StubProviderFactory.cs Adds in-memory IProviderFactory stub for deterministic test hosting.
tests/LlamaShears.IntegrationTests.Fixtures/Hosting/StubLanguageModel.cs Adds deterministic ILanguageModel stub for integration tests.
tests/LlamaShears.IntegrationTests.Fixtures/Hosting/StubEmbeddingProviderFactory.cs Adds embedding factory stub for tests.
tests/LlamaShears.IntegrationTests.Fixtures/Hosting/StubEmbeddingModel.cs Adds deterministic embedding model stub.
tests/LlamaShears.IntegrationTests.Fixtures/Hosting/IsolatedAppFactory.cs Updates agent-wait logic to new lifecycle events + repository.
tests/LlamaShears.IntegrationTests.Fixtures/Hosting/IntegrationTestEnvironment.cs Adds module initializer to set test-only environment variable.
src/public/LlamaShears.Core.Abstractions/Provider/ModelConfiguration.cs Implements IAgentData to seed model config into the per-turn scope.
src/public/LlamaShears.Core.Abstractions/Paths/PathKind.cs Updates docs to reference IApplicationPathProvider.
src/public/LlamaShears.Core.Abstractions/Paths/IApplicationPathProvider.cs Renames old IShearsPaths interface to IApplicationPathProvider.
src/public/LlamaShears.Core.Abstractions/Events/IEventPublisher.cs Removes IEventPublisher (publish folded into IEventBus).
src/public/LlamaShears.Core.Abstractions/Events/IEventFilter.cs Updates docs to reference IEventBus.PublishAsync.
src/public/LlamaShears.Core.Abstractions/Events/IEventBus.cs Adds PublishAsync onto the bus interface.
src/public/LlamaShears.Core.Abstractions/Events/EventPublisherExtensions.cs Updates extension targets from IEventPublisher to IEventBus.
src/public/LlamaShears.Core.Abstractions/Events/Event.cs Adds lifecycle source + well-known lifecycle/command event types.
src/public/LlamaShears.Core.Abstractions/Events/Agent/ConfigurationChangedNotification.cs Adds config-diff payload type for supervisor-driven lifecycle decisions.
src/public/LlamaShears.Core.Abstractions/Events/Agent/AgentStopRequest.cs Refines stop payload to require non-null SessionId.
src/public/LlamaShears.Core.Abstractions/Events/Agent/AgentStartRequest.cs Adds start request payload carrying a cold AgentHandle.
src/public/LlamaShears.Core.Abstractions/Events/Agent/AgentShutdownRequest.cs Adds shutdown request payload (session-targeted or broadcast).
src/public/LlamaShears.Core.Abstractions/Events/Agent/AgentLifecycleEvent.cs Renames lifecycle payload record to AgentLifecycleEvent.
src/public/LlamaShears.Core.Abstractions/Events/Agent/AgentInterruptRequest.cs Updates imports for sessions/agent types.
src/public/LlamaShears.Core.Abstractions/Events/Agent/AgentDeath.cs Adds AgentDeath singleton lifecycle payload.
src/public/LlamaShears.Core.Abstractions/Agent/Sessions/SessionPath.cs Introduces session ancestry structure and scope seeding via IAgentData.
src/public/LlamaShears.Core.Abstractions/Agent/Sessions/SessionId.cs Removes old data-scope key (replaced by SessionPath).
src/public/LlamaShears.Core.Abstractions/Agent/Sessions/SessionExtensions.cs Adds helpers to read SessionPath/current/parent/root session ids from scope.
src/public/LlamaShears.Core.Abstractions/Agent/Sessions/SessionDataExtensions.cs Adds helper to overlay IAgentData into a dictionary.
src/public/LlamaShears.Core.Abstractions/Agent/Sessions/IAgentData.cs Adds marker interface for data-scope contributors.
src/public/LlamaShears.Core.Abstractions/Agent/IAgentManager.cs Removes old agent-manager read-only interface.
src/public/LlamaShears.Core.Abstractions/Agent/IAgentInstanceRepository.cs Adds repository interface for tracking agent handles + ancestry.
src/public/LlamaShears.Core.Abstractions/Agent/IAgentFactory.cs Adds new factory interface for creating cold handles with SessionPath.
src/public/LlamaShears.Core.Abstractions/Agent/DisposableList.cs Adds composite disposable helper for chaining mixed disposables.
src/public/LlamaShears.Core.Abstractions/Agent/CombinedDisposable.cs Adds .And(...) chaining helpers to build DisposableList.
src/public/LlamaShears.Core.Abstractions/Agent/AgentSessionPath.cs Adds materialized session ancestry (guid segments) helper.
src/public/LlamaShears.Core.Abstractions/Agent/AgentHandle.cs Adds new cold-to-hot handle that owns scope + execution context + agent task.
src/public/LlamaShears.Core.Abstractions/Agent/AgentConfig.cs Implements IAgentData to seed config into per-turn scope.
src/LlamaShears/TemplateSeedingStartupTask.cs Updates DI to use IApplicationPathProvider.
src/LlamaShears/appsettings.json Disables forced indexing on startup by default.
src/LlamaShears.Provider.Onnx.Embeddings/OnnxEmbeddingProviderFactory.cs Updates DI to use IApplicationPathProvider.
src/LlamaShears.Core/Tools/ModelContextProtocol/ModelContextProtocolToolCallDispatcher.cs Migrates event publishing dependency to IEventBus.
src/LlamaShears.Core/SystemTickService.cs Migrates event publishing dependency to IEventBus.
src/LlamaShears.Core/SystemPrompt/TemplateFileLocator.cs Updates DI to use IApplicationPathProvider.
src/LlamaShears.Core/PromptContext/FilesystemPromptContextProvider.cs Updates DI to use IApplicationPathProvider.
src/LlamaShears.Core/Persistence/JsonLineContextStore.cs Updates DI to use IApplicationPathProvider.
src/LlamaShears.Core/Paths/ApplicationPathProvider.cs Renames ShearsPaths implementation to ApplicationPathProvider.
src/LlamaShears.Core/InferenceRunner.cs Migrates event publishing dependency to IEventBus.
src/LlamaShears.Core/IAgentFactory.cs Removes old core IAgentFactory in favor of abstractions surface.
src/LlamaShears.Core/Cron/JsonCronStore.cs Updates DI to use IApplicationPathProvider.
src/LlamaShears.Core/Cron/CronScheduler.cs Removes loaded-agent guard (drops IAgentManager dependency).
src/LlamaShears.Core/CoreServiceCollectionExtensions.cs Rewires hosting to new agent host/lifecycle services + repository.
src/LlamaShears.Core/ContextCompactor.cs Migrates event publishing dependency to IEventBus.
src/LlamaShears.Core/AgentManager.cs Removes old manager implementation.
src/LlamaShears.Core/AgentLifecycleService.cs Adds new lifecycle service responding to birth/death events.
src/LlamaShears.Core/AgentIterationRunner.cs Migrates event publishing dependency to IEventBus.
src/LlamaShears.Core/AgentInstanceRepository.cs Adds concurrent repository for agent handles + descendant traversal.
src/LlamaShears.Core/AgentHost.cs Adds host service that starts/stops sessions and manages shutdown.
src/LlamaShears.Core/AgentHandle.cs Removes old handle type.
src/LlamaShears.Core/AgentFactory.cs Refactors factory to create cold handles, seed scope globals via IAgentData, and capture execution context.
src/LlamaShears.Core/AgentConfigSupervisor.cs Refactors supervisor to publish lifecycle events and watch agent config directory.
src/LlamaShears.Core/AgentConfigProvider.cs Updates DI to use IApplicationPathProvider.
src/LlamaShears.Core/Agent.cs Switches to AgentShutdownRequest + new session-path accessors + IEventBus publish.
src/LlamaShears.Core.Eventing/EventingServiceCollectionExtensions.cs Updates eventing DI after removing IEventPublisher.
src/LlamaShears.Core.Eventing/EventBus.cs Removes IEventPublisher implementation (bus only).
src/LlamaShears.Api/Web/AgentDirectory.cs Lists agents from config provider and publishes commands via IEventBus.
src/LlamaShears.Api.Web/Services/ChatSession.cs Migrates publisher dependency to IEventBus.
src/LlamaShears.Api.Web/Pages/AgentList.razor Displays live sessions per agent using the new repository.
src/LlamaShears.Api.Web/Components/Chat/ChatHeader.razor Adds session selector UI and session discovery from repository.
LlamaShears.slnx Adds fixtures project to solution.
docs/api/LlamaShears.Core.Abstractions/... Regenerates API docs to match refactor (new/renamed/removed types).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

## Pull request overview This PR performs a major refactor of the agent runtime lifecycle by replacing the old `AgentManager`-centric design with a host/repository/lifecycle-service split, while also unifying event publishing into `IEventBus` and introducing session-path/data-scope abstractions. It also updates the web UI to surface live sessions and adds a shared integration-test fixture project to host deterministic provider stubs. **Changes:** - Refactors agent lifecycle: introduces `AgentHost`, `AgentLifecycleService`, `AgentInstanceRepository`, `AgentHandle` (cold-to-hot), new lifecycle/config events, and removes `AgentManager`/`IAgentManager`. - Consolidates event publish/subscribe surfaces into `IEventBus` and renames `ShearsPaths` → `ApplicationPathProvider`. - Adds session/data-scope primitives (`SessionPath`, `IAgentData`) and updates UI/tests to support session selection + new integration test fixtures. ### Reviewed changes Copilot reviewed 120 out of 125 changed files in this pull request and generated 10 comments. <details> <summary>Show a summary per file</summary> | File | Description | | ---- | ----------- | | tests/LlamaShears.UnitTests/SystemPrompt/FilesystemSystemPromptProviderTests.cs | Updates path provider usage to `ApplicationPathProvider`. | | tests/LlamaShears.UnitTests/Provider/Onnx/OnnxEmbeddingProviderFactoryTests.cs | Updates paths interface rename in test double. | | tests/LlamaShears.UnitTests/Hosting/ApplicationPathProviderTests.cs | Renames tests + updates instantiation to `ApplicationPathProvider`. | | tests/LlamaShears.UnitTests/Eventing/EventFilterTests.cs | Migrates tests from `IEventPublisher` to `IEventBus`. | | tests/LlamaShears.UnitTests/Cron/JsonCronStoreTests.cs | Updates paths provider usage for cron persistence tests. | | tests/LlamaShears.UnitTests/Cron/CronSchedulerTests.cs | Adjusts scheduler construction after removing `IAgentManager` dependency. | | tests/LlamaShears.UnitTests/AgentConfigProviderTests.cs | Updates paths provider usage. | | tests/LlamaShears.UnitTests/Agent/Core/TestAgentConfigs.cs | Switches scoped session data from `SessionId` to `SessionPath`. | | tests/LlamaShears.UnitTests/Agent/Core/Persistence/JsonLineContextStoreTests.cs | Updates paths provider type to `IApplicationPathProvider`. | | tests/LlamaShears.UnitTests/Agent/Core/InferenceRunnerToolDispatchTests.cs | Migrates event publishing dependency to `IEventBus`. | | tests/LlamaShears.UnitTests/Agent/Core/ContextCompactorTests.cs | Migrates event publishing dependency to `IEventBus`. | | tests/LlamaShears.UnitTests/Agent/Core/AgentTurnFlowTests.cs | Migrates event publishing dependency to `IEventBus` and updates dispatcher signatures. | | tests/LlamaShears.UnitTests/Agent/Core/AgentLoopTests.cs | Migrates event publishing dependency to `IEventBus`. | | tests/LlamaShears.UnitTests/Agent/Core/AgentLifecycleServiceTests.cs | Adds unit coverage for new `AgentLifecycleService`. | | tests/LlamaShears.UnitTests/Agent/Core/AgentInterruptTests.cs | Migrates event publishing dependency to `IEventBus`. | | tests/LlamaShears.UnitTests/Agent/Core/AgentInterruptGracefulTests.cs | Migrates event publishing dependency to `IEventBus`. | | tests/LlamaShears.UnitTests/Agent/Core/AgentInstanceRepositoryTests.cs | Adds unit coverage for new `AgentInstanceRepository`. | | tests/LlamaShears.UnitTests/Agent/Core/AgentEventPublishingTests.cs | Updates capturing publisher to wrap `IEventBus` and adds Subscribe passthrough. | | tests/LlamaShears.IntegrationTests/LlamaShears.IntegrationTests.csproj | Moves web-testing dependency into shared fixtures project. | | tests/LlamaShears.IntegrationTests/ContextPersistenceTests.cs | Updates event publish + paths provider usage; adjusts startup sequencing. | | tests/LlamaShears.IntegrationTests.Web/LlamaShears.IntegrationTests.Web.csproj | Uses shared fixtures project instead of referencing integration tests project directly. | | tests/LlamaShears.IntegrationTests.Web/ChatSurfaceTests.cs | Changes provider-resolution assertion approach to validate test DI setup. | | tests/LlamaShears.IntegrationTests.Fixtures/LlamaShears.IntegrationTests.Fixtures.csproj | New shared fixture project with `Microsoft.AspNetCore.Mvc.Testing`. | | tests/LlamaShears.IntegrationTests.Fixtures/Hosting/StubProviderFactory.cs | Adds in-memory `IProviderFactory` stub for deterministic test hosting. | | tests/LlamaShears.IntegrationTests.Fixtures/Hosting/StubLanguageModel.cs | Adds deterministic `ILanguageModel` stub for integration tests. | | tests/LlamaShears.IntegrationTests.Fixtures/Hosting/StubEmbeddingProviderFactory.cs | Adds embedding factory stub for tests. | | tests/LlamaShears.IntegrationTests.Fixtures/Hosting/StubEmbeddingModel.cs | Adds deterministic embedding model stub. | | tests/LlamaShears.IntegrationTests.Fixtures/Hosting/IsolatedAppFactory.cs | Updates agent-wait logic to new lifecycle events + repository. | | tests/LlamaShears.IntegrationTests.Fixtures/Hosting/IntegrationTestEnvironment.cs | Adds module initializer to set test-only environment variable. | | src/public/LlamaShears.Core.Abstractions/Provider/ModelConfiguration.cs | Implements `IAgentData` to seed model config into the per-turn scope. | | src/public/LlamaShears.Core.Abstractions/Paths/PathKind.cs | Updates docs to reference `IApplicationPathProvider`. | | src/public/LlamaShears.Core.Abstractions/Paths/IApplicationPathProvider.cs | Renames old `IShearsPaths` interface to `IApplicationPathProvider`. | | src/public/LlamaShears.Core.Abstractions/Events/IEventPublisher.cs | Removes `IEventPublisher` (publish folded into `IEventBus`). | | src/public/LlamaShears.Core.Abstractions/Events/IEventFilter.cs | Updates docs to reference `IEventBus.PublishAsync`. | | src/public/LlamaShears.Core.Abstractions/Events/IEventBus.cs | Adds `PublishAsync` onto the bus interface. | | src/public/LlamaShears.Core.Abstractions/Events/EventPublisherExtensions.cs | Updates extension targets from `IEventPublisher` to `IEventBus`. | | src/public/LlamaShears.Core.Abstractions/Events/Event.cs | Adds lifecycle source + well-known lifecycle/command event types. | | src/public/LlamaShears.Core.Abstractions/Events/Agent/ConfigurationChangedNotification.cs | Adds config-diff payload type for supervisor-driven lifecycle decisions. | | src/public/LlamaShears.Core.Abstractions/Events/Agent/AgentStopRequest.cs | Refines stop payload to require non-null `SessionId`. | | src/public/LlamaShears.Core.Abstractions/Events/Agent/AgentStartRequest.cs | Adds start request payload carrying a cold `AgentHandle`. | | src/public/LlamaShears.Core.Abstractions/Events/Agent/AgentShutdownRequest.cs | Adds shutdown request payload (session-targeted or broadcast). | | src/public/LlamaShears.Core.Abstractions/Events/Agent/AgentLifecycleEvent.cs | Renames lifecycle payload record to `AgentLifecycleEvent`. | | src/public/LlamaShears.Core.Abstractions/Events/Agent/AgentInterruptRequest.cs | Updates imports for sessions/agent types. | | src/public/LlamaShears.Core.Abstractions/Events/Agent/AgentDeath.cs | Adds `AgentDeath` singleton lifecycle payload. | | src/public/LlamaShears.Core.Abstractions/Agent/Sessions/SessionPath.cs | Introduces session ancestry structure and scope seeding via `IAgentData`. | | src/public/LlamaShears.Core.Abstractions/Agent/Sessions/SessionId.cs | Removes old data-scope key (replaced by `SessionPath`). | | src/public/LlamaShears.Core.Abstractions/Agent/Sessions/SessionExtensions.cs | Adds helpers to read `SessionPath`/current/parent/root session ids from scope. | | src/public/LlamaShears.Core.Abstractions/Agent/Sessions/SessionDataExtensions.cs | Adds helper to overlay `IAgentData` into a dictionary. | | src/public/LlamaShears.Core.Abstractions/Agent/Sessions/IAgentData.cs | Adds marker interface for data-scope contributors. | | src/public/LlamaShears.Core.Abstractions/Agent/IAgentManager.cs | Removes old agent-manager read-only interface. | | src/public/LlamaShears.Core.Abstractions/Agent/IAgentInstanceRepository.cs | Adds repository interface for tracking agent handles + ancestry. | | src/public/LlamaShears.Core.Abstractions/Agent/IAgentFactory.cs | Adds new factory interface for creating cold handles with `SessionPath`. | | src/public/LlamaShears.Core.Abstractions/Agent/DisposableList.cs | Adds composite disposable helper for chaining mixed disposables. | | src/public/LlamaShears.Core.Abstractions/Agent/CombinedDisposable.cs | Adds `.And(...)` chaining helpers to build `DisposableList`. | | src/public/LlamaShears.Core.Abstractions/Agent/AgentSessionPath.cs | Adds materialized session ancestry (guid segments) helper. | | src/public/LlamaShears.Core.Abstractions/Agent/AgentHandle.cs | Adds new cold-to-hot handle that owns scope + execution context + agent task. | | src/public/LlamaShears.Core.Abstractions/Agent/AgentConfig.cs | Implements `IAgentData` to seed config into per-turn scope. | | src/LlamaShears/TemplateSeedingStartupTask.cs | Updates DI to use `IApplicationPathProvider`. | | src/LlamaShears/appsettings.json | Disables forced indexing on startup by default. | | src/LlamaShears.Provider.Onnx.Embeddings/OnnxEmbeddingProviderFactory.cs | Updates DI to use `IApplicationPathProvider`. | | src/LlamaShears.Core/Tools/ModelContextProtocol/ModelContextProtocolToolCallDispatcher.cs | Migrates event publishing dependency to `IEventBus`. | | src/LlamaShears.Core/SystemTickService.cs | Migrates event publishing dependency to `IEventBus`. | | src/LlamaShears.Core/SystemPrompt/TemplateFileLocator.cs | Updates DI to use `IApplicationPathProvider`. | | src/LlamaShears.Core/PromptContext/FilesystemPromptContextProvider.cs | Updates DI to use `IApplicationPathProvider`. | | src/LlamaShears.Core/Persistence/JsonLineContextStore.cs | Updates DI to use `IApplicationPathProvider`. | | src/LlamaShears.Core/Paths/ApplicationPathProvider.cs | Renames `ShearsPaths` implementation to `ApplicationPathProvider`. | | src/LlamaShears.Core/InferenceRunner.cs | Migrates event publishing dependency to `IEventBus`. | | src/LlamaShears.Core/IAgentFactory.cs | Removes old core `IAgentFactory` in favor of abstractions surface. | | src/LlamaShears.Core/Cron/JsonCronStore.cs | Updates DI to use `IApplicationPathProvider`. | | src/LlamaShears.Core/Cron/CronScheduler.cs | Removes loaded-agent guard (drops `IAgentManager` dependency). | | src/LlamaShears.Core/CoreServiceCollectionExtensions.cs | Rewires hosting to new agent host/lifecycle services + repository. | | src/LlamaShears.Core/ContextCompactor.cs | Migrates event publishing dependency to `IEventBus`. | | src/LlamaShears.Core/AgentManager.cs | Removes old manager implementation. | | src/LlamaShears.Core/AgentLifecycleService.cs | Adds new lifecycle service responding to birth/death events. | | src/LlamaShears.Core/AgentIterationRunner.cs | Migrates event publishing dependency to `IEventBus`. | | src/LlamaShears.Core/AgentInstanceRepository.cs | Adds concurrent repository for agent handles + descendant traversal. | | src/LlamaShears.Core/AgentHost.cs | Adds host service that starts/stops sessions and manages shutdown. | | src/LlamaShears.Core/AgentHandle.cs | Removes old handle type. | | src/LlamaShears.Core/AgentFactory.cs | Refactors factory to create cold handles, seed scope globals via `IAgentData`, and capture execution context. | | src/LlamaShears.Core/AgentConfigSupervisor.cs | Refactors supervisor to publish lifecycle events and watch agent config directory. | | src/LlamaShears.Core/AgentConfigProvider.cs | Updates DI to use `IApplicationPathProvider`. | | src/LlamaShears.Core/Agent.cs | Switches to `AgentShutdownRequest` + new session-path accessors + `IEventBus` publish. | | src/LlamaShears.Core.Eventing/EventingServiceCollectionExtensions.cs | Updates eventing DI after removing `IEventPublisher`. | | src/LlamaShears.Core.Eventing/EventBus.cs | Removes `IEventPublisher` implementation (bus only). | | src/LlamaShears.Api/Web/AgentDirectory.cs | Lists agents from config provider and publishes commands via `IEventBus`. | | src/LlamaShears.Api.Web/Services/ChatSession.cs | Migrates publisher dependency to `IEventBus`. | | src/LlamaShears.Api.Web/Pages/AgentList.razor | Displays live sessions per agent using the new repository. | | src/LlamaShears.Api.Web/Components/Chat/ChatHeader.razor | Adds session selector UI and session discovery from repository. | | LlamaShears.slnx | Adds fixtures project to solution. | | docs/api/LlamaShears.Core.Abstractions/... | Regenerates API docs to match refactor (new/renamed/removed types). | </details> --- 💡 <a href="/jasoncouture/llama-shears/new/main?filename=.github/instructions/*.instructions.md" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Add Copilot custom instructions</a> for smarter, more guided reviews. <a href="https://docs.github.com/en/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Learn how to get started</a>.
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-05-19 20:25:47 -04:00

The session selector uses a value attribute but no @bind/@onchange handler. In HTML/Blazor, value on doesn’t control the selected option by itself, and user changes won't be observed. Use @bind (or @onchange + selected option logic) and wire selection into the chat session state.

The session selector <select> uses a `value` attribute but no @bind/@onchange handler. In HTML/Blazor, `value` on <select> doesn’t control the selected option by itself, and user changes won't be observed. Use `@bind` (or `@onchange` + selected option logic) and wire selection into the chat session state.
@ -11,7 +11,7 @@ public static class EventingServiceCollectionExtensions
{
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-05-19 20:25:45 -04:00

AddEventingFramework registers ForwardService<IEventBus, EventBus>() twice, which is redundant and may hide an intended forwarding for a different interface. Remove the duplicate registration (or forward the missing service if that was the intent).

AddEventingFramework registers ForwardService<IEventBus, EventBus>() twice, which is redundant and may hide an intended forwarding for a different interface. Remove the duplicate registration (or forward the missing service if that was the intent).
@ -0,0 +36,4 @@
var taskCompletionSource = new TaskCompletionSource();
await using var cancellationTokenRegistration =
stoppingToken.Register(s => ((TaskCompletionSource)s!).TrySetResult(), taskCompletionSource);
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-05-19 20:25:47 -04:00

stoppingToken.Register(...) returns a CancellationTokenRegistration (sync-disposable). Using await using here will not compile unless the type provides a DisposeAsync pattern. Use a regular using var (or dispose it via your DisposableList) instead.

`stoppingToken.Register(...)` returns a CancellationTokenRegistration (sync-disposable). Using `await using` here will not compile unless the type provides a DisposeAsync pattern. Use a regular `using var` (or dispose it via your DisposableList) instead.
@ -0,0 +153,4 @@
handle.SessionPath.Root);
var sessionShutdownTimeoutCancellationTokenSource = new CancellationTokenSource();
var sessionShutdownTimeoutToken = sessionShutdownTimeoutCancellationTokenSource.Token;
sessionShutdownTimeoutCancellationTokenSource.CancelAfter(TimeSpan.FromSeconds(15));
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-05-19 20:25:46 -04:00

_logger.BeginScope(...) returns an IDisposable that should be disposed to avoid leaking the logging scope. Capture the returned scope in a using/await using block around the shutdown work.

_logger.BeginScope(...) returns an IDisposable that should be disposed to avoid leaking the logging scope. Capture the returned scope in a using/await using block around the shutdown work.
@ -0,0 +160,4 @@
var eventType = Event.WellKnown.Command.AgentShutdown with { Id = handle.SessionPath.Current };
var eventParameter = new AgentStopRequest(handle.SessionPath.Current);
await _eventPublisher.PublishAsync(eventType, eventParameter, cancellationToken);
LogShutdownRequestSentDisposingSessionId(handle.SessionPath.Current);
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-05-19 20:25:46 -04:00

ShutdownAgentAsync publishes an AgentShutdown event but sends an AgentStopRequest payload. Agents subscribe to AgentShutdownRequest, so this mismatch prevents agents from receiving the shutdown signal. Publish AgentShutdownRequest (and ensure the generic type matches) for Event.WellKnown.Command.AgentShutdown.

ShutdownAgentAsync publishes an AgentShutdown event but sends an AgentStopRequest payload. Agents subscribe to AgentShutdownRequest, so this mismatch prevents agents from receiving the shutdown signal. Publish AgentShutdownRequest (and ensure the generic type matches) for Event.WellKnown.Command.AgentShutdown.
@ -0,0 +91,4 @@
{
Remove(descendent.SessionPath.Id);
}
}
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-05-19 20:25:47 -04:00

AgentInstanceRepository.RemoveDescendents ignores the includeParent parameter and never removes the parent, despite the interface/docs stating it can optionally include the parent. Either implement includeParent behavior (and/or rename) and consider using the Remove(id, out handle) path to preserve the child-safety contract.

AgentInstanceRepository.RemoveDescendents ignores the includeParent parameter and never removes the parent, despite the interface/docs stating it can optionally include the parent. Either implement includeParent behavior (and/or rename) and consider using the Remove(id, out handle) path to preserve the child-safety contract.
@ -0,0 +59,4 @@
await using var disposable = birthSubscription
.And(deathSubscription)
.And(stopRegistration as IAsyncDisposable);
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-05-19 20:25:46 -04:00

AgentLifecycleService chains the CancellationTokenRegistration via stopRegistration as IAsyncDisposable, which is always null (CancellationTokenRegistration only implements IDisposable). This means the registration isn't disposed. Chain it as IDisposable instead so it’s cleaned up when the service exits.

AgentLifecycleService chains the CancellationTokenRegistration via `stopRegistration as IAsyncDisposable`, which is always null (CancellationTokenRegistration only implements IDisposable). This means the registration isn't disposed. Chain it as IDisposable instead so it’s cleaned up when the service exits.
@ -0,0 +20,4 @@
/// <summary><see langword="true"/> when this notification represents an actual change (birth, tombstone, or hash-distinct update).</summary>
public bool HasChanges => IsValid && (IsBirth || IsTombstone ||
string.Equals(CurrentConfig!.Hash, UpdatedConfig!.Hash,
StringComparison.OrdinalIgnoreCase));
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-05-19 20:25:45 -04:00

ConfigurationChangedNotification.HasChanges is currently true for updates when the old and new hashes are equal, and false when they differ. For update events, this should be the opposite (hash-distinct updates should be considered changes).

ConfigurationChangedNotification.HasChanges is currently true for updates when the old and new hashes are equal, and false when they differ. For update events, this should be the opposite (hash-distinct updates should be considered changes).
@ -13,0 +25,4 @@
{
throw new NotImplementedException();
}
}
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-05-19 20:25:46 -04:00

EventBusCapture is checked into the integration test file but is incomplete (empty ctor) and throws NotImplementedException for both IEventBus members, which will break compilation or runtime if referenced. Either remove this class from the test file or fully implement it and add assertions that use it.

EventBusCapture is checked into the integration test file but is incomplete (empty ctor) and throws NotImplementedException for both IEventBus members, which will break compilation or runtime if referenced. Either remove this class from the test file or fully implement it and add assertions that use it.
@ -187,3 +186,4 @@
private sealed class ThrowingPaths : IApplicationPathProvider
{
public string GetPath(PathKind kind, string? subpath = null, bool ensureExists = false)
=> throw new InvalidOperationException("IShearsPaths.GetPath should not be reached when ModelsRoot is explicitly set.");
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-05-19 20:25:47 -04:00

The exception message in ThrowingPaths still references IShearsPaths even though the type was renamed to IApplicationPathProvider. Update the message so failures point to the correct API surface.

The exception message in ThrowingPaths still references IShearsPaths even though the type was renamed to IApplicationPathProvider. Update the message so failures point to the correct API surface.
Sign in to join this conversation.
No description provided.