feat: ephemeral sessions + agent manager refactor #92

Merged
jasoncouture merged 17 commits from feat/ephemeral-sessions into main 2026-05-18 20:00:14 -04:00
jasoncouture commented 2026-05-18 20:00:05 -04:00 (Migrated from github.com)

Summary

Ephemeral sessions — short-lived child sessions of an agent. Persist under <agentId>/<sessionGuid>/, never auto-loaded, caller-owned. Reply to parent via session_reply MCP tool (publishes channel:message on the bus); fallback path auto-sends the last assistant content if the tool is never called. Pre-requisite for cron firing and sub-agent tooling.

Agent manager splitAgentConfigSupervisor (hosted) watches disk, emits command:agent-load / command:agent-unload. AgentManager (now BackgroundService) subscribes and owns slot lifecycle. Single-purpose classes; communicate via bus only.

Plumbing changes

  • IAgentIterationRunner extracted from Agent.ProcessIterationAsync — shared seam, returns tool-result turns rather than enqueueing.
  • IContextStore gains a nullable sessionId dimension; null = default session (existing path, backward compat). New layout: <agentId>/<sessionGuid:n>/current.json.
  • ChannelMessage.SessionId + ModelTurn.SessionId + AgentState.SessionId (all nullable) — sender / persistence routing metadata.
  • CompactionAgentService is now an IAgentService; discard-resolve in BuildSlotAsync dropped.
  • IAgentManager.Get(string) removed — leaked scoped lifetime and broke AsyncLocal isolation. Contains is the only safe query.
  • CoreServiceCollectionExtensions.AddCore split into per-component private helpers.

Test plan

  • dotnet build clean
  • dotnet test — 526 / 526 passing
  • Ephemeral session loop covered: session_reply path, fallback, no-reply, iteration cap, interrupted
  • Storage dimension: GUID subfolders not surfaced as agents; non-default session persists under sub-path

Out of scope (follow-ups)

  • Cron FireSingleAsync non-stub
  • Compactor migration onto ephemeral primitive
  • Sub-agent spawning MCP tool
  • Event-driven ephemeral session start (currently still uses direct factory call)
  • AgentManager supervising ephemeral sessions (currently caller-owned)
  • Ephemeral session inherits parent data context — needs blank-EC launch like main agents do
  • ILanguageModel discard-resolve in BuildSlotAsync → explicit config validation
## Summary **Ephemeral sessions** — short-lived child sessions of an agent. Persist under `<agentId>/<sessionGuid>/`, never auto-loaded, caller-owned. Reply to parent via `session_reply` MCP tool (publishes `channel:message` on the bus); fallback path auto-sends the last assistant content if the tool is never called. Pre-requisite for cron firing and sub-agent tooling. **Agent manager split** — `AgentConfigSupervisor` (hosted) watches disk, emits `command:agent-load` / `command:agent-unload`. `AgentManager` (now `BackgroundService`) subscribes and owns slot lifecycle. Single-purpose classes; communicate via bus only. **Plumbing changes** - `IAgentIterationRunner` extracted from `Agent.ProcessIterationAsync` — shared seam, returns tool-result turns rather than enqueueing. - `IContextStore` gains a nullable `sessionId` dimension; `null` = default session (existing path, backward compat). New layout: `<agentId>/<sessionGuid:n>/current.json`. - `ChannelMessage.SessionId` + `ModelTurn.SessionId` + `AgentState.SessionId` (all nullable) — sender / persistence routing metadata. - `CompactionAgentService` is now an `IAgentService`; discard-resolve in `BuildSlotAsync` dropped. - `IAgentManager.Get(string)` removed — leaked scoped lifetime and broke AsyncLocal isolation. `Contains` is the only safe query. - `CoreServiceCollectionExtensions.AddCore` split into per-component private helpers. ## Test plan - [x] `dotnet build` clean - [x] `dotnet test` — 526 / 526 passing - [x] Ephemeral session loop covered: session_reply path, fallback, no-reply, iteration cap, interrupted - [x] Storage dimension: GUID subfolders not surfaced as agents; non-default session persists under sub-path ## Out of scope (follow-ups) - Cron `FireSingleAsync` non-stub - Compactor migration onto ephemeral primitive - Sub-agent spawning MCP tool - Event-driven ephemeral session start (currently still uses direct factory call) - `AgentManager` supervising ephemeral sessions (currently caller-owned) - Ephemeral session inherits parent data context — needs blank-EC launch like main agents do - `ILanguageModel` discard-resolve in `BuildSlotAsync` → explicit config validation
github-actions[bot] commented 2026-05-18 20:01:51 -04:00 (Migrated from github.com)
Package Line Rate Branch Rate Complexity Health
LlamaShears.Core.Eventing 91% 84% 53
LlamaShears.Core.Abstractions 49% 34% 371
LlamaShears.Api 29% 29% 487
LlamaShears.Provider.Ollama 44% 28% 188
LlamaShears.Core.Eventing.Extensions 100% 100% 1
LlamaShears.Core 44% 42% 1443
LlamaShears.Provider.Onnx.Embeddings 37% 38% 72
LlamaShears.Provider.OpenAI 66% 65% 229
LlamaShears.Api.Web 1% 1% 428
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 32% 14% 371
LlamaShears.Api 6% 1% 487
LlamaShears.Provider.Ollama 3% 1% 188
LlamaShears.Core.Eventing.Extensions 100% 100% 1
StrangeSoft.Plugins.Host 20% 21% 87
LlamaShears.Core 41% 27% 1443
LlamaShears.Provider.Onnx.Embeddings 3% 0% 72
LlamaShears.Provider.OpenAI 2% 0% 229
LlamaShears.Api.Web 21% 10% 428
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 32% 14% 371
LlamaShears.IntegrationTests 82% 69% 72
LlamaShears.Api 8% 3% 487
LlamaShears.Provider.Ollama 3% 1% 188
LlamaShears.Core.Eventing.Extensions 100% 100% 1
StrangeSoft.Plugins.Host 20% 21% 87
LlamaShears.Core 41% 27% 1443
LlamaShears.Provider.Onnx.Embeddings 3% 0% 72
LlamaShears.Provider.OpenAI 2% 0% 229
LlamaShears.Api.Web 31% 17% 428
LlamaShears.Hosting 26% 8% 27
LlamaShears.Analyzers.CodeFixes 85% 69% 60
LlamaShears.Analyzers 88% 76% 199
Summary 46% (11232 / 33476) 36% (2360 / 9632) 10526
Package | Line Rate | Branch Rate | Complexity | Health -------- | --------- | ----------- | ---------- | ------ LlamaShears.Core.Eventing | 91% | 84% | 53 | ✔ LlamaShears.Core.Abstractions | 49% | 34% | 371 | ❌ LlamaShears.Api | 29% | 29% | 487 | ❌ LlamaShears.Provider.Ollama | 44% | 28% | 188 | ❌ LlamaShears.Core.Eventing.Extensions | 100% | 100% | 1 | ✔ LlamaShears.Core | 44% | 42% | 1443 | ❌ LlamaShears.Provider.Onnx.Embeddings | 37% | 38% | 72 | ❌ LlamaShears.Provider.OpenAI | 66% | 65% | 229 | ➖ LlamaShears.Api.Web | 1% | 1% | 428 | ❌ 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 | 32% | 14% | 371 | ❌ LlamaShears.Api | 6% | 1% | 487 | ❌ LlamaShears.Provider.Ollama | 3% | 1% | 188 | ❌ LlamaShears.Core.Eventing.Extensions | 100% | 100% | 1 | ✔ StrangeSoft.Plugins.Host | 20% | 21% | 87 | ❌ LlamaShears.Core | 41% | 27% | 1443 | ❌ LlamaShears.Provider.Onnx.Embeddings | 3% | 0% | 72 | ❌ LlamaShears.Provider.OpenAI | 2% | 0% | 229 | ❌ LlamaShears.Api.Web | 21% | 10% | 428 | ❌ 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 | 32% | 14% | 371 | ❌ LlamaShears.IntegrationTests | 82% | 69% | 72 | ✔ LlamaShears.Api | 8% | 3% | 487 | ❌ LlamaShears.Provider.Ollama | 3% | 1% | 188 | ❌ LlamaShears.Core.Eventing.Extensions | 100% | 100% | 1 | ✔ StrangeSoft.Plugins.Host | 20% | 21% | 87 | ❌ LlamaShears.Core | 41% | 27% | 1443 | ❌ LlamaShears.Provider.Onnx.Embeddings | 3% | 0% | 72 | ❌ LlamaShears.Provider.OpenAI | 2% | 0% | 229 | ❌ LlamaShears.Api.Web | 31% | 17% | 428 | ❌ LlamaShears.Hosting | 26% | 8% | 27 | ❌ LlamaShears.Analyzers.CodeFixes | 85% | 69% | 60 | ✔ LlamaShears.Analyzers | 88% | 76% | 199 | ✔ **Summary** | **46%** (11232 / 33476) | **36%** (2360 / 9632) | **10526** | ❌ <!-- Sticky Pull Request Commentcoverage -->
copilot-pull-request-reviewer[bot] (Migrated from github.com) reviewed 2026-05-18 20:08:55 -04:00
copilot-pull-request-reviewer[bot] (Migrated from github.com) left a comment

Pull request overview

This PR adds a first-class “ephemeral session” primitive (caller-owned, per-session persistence under <agentId>/<sessionGuid>/, reply via the new session_reply MCP tool + fallback) and refactors agent hosting by splitting config reconciliation (AgentConfigSupervisor) from slot lifecycle (AgentManager), with coordination purely via bus commands. It also extracts IAgentIterationRunner as a shared seam and extends persistence/event metadata to carry an optional SessionId for correct routing.

Changes:

  • Introduces ephemeral sessions: new abstractions + core implementation + session_reply MCP tool + unit tests.
  • Refactors agent hosting: new AgentConfigSupervisor publishes command:agent-load/unload; AgentManager becomes a BackgroundService that subscribes and manages slots.
  • Adds session-aware persistence/routing: IContextStore gains Guid? sessionId, model/event types gain nullable SessionId, and JsonLineContextStore writes non-default sessions under GUID subfolders.

Reviewed changes

Copilot reviewed 138 out of 138 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tooling/LlamaShears.DocsBuild/AccessibilityFilter.cs Minor qualification cleanup for comparers.
tests/LlamaShears.UnitTests/Sessions/EphemeralSessionTests.cs New coverage for ephemeral session loop, tool reply path, fallback, caps, interruption.
tests/LlamaShears.UnitTests/Serialization/CompositeIdentityJsonConverterTests.cs Import cleanup.
tests/LlamaShears.UnitTests/Serialization/AgentConfigSerializationTests.cs Import cleanup.
tests/LlamaShears.UnitTests/Provider/OpenAI/OpenAILanguageModelTests.cs Updates formatter type usage/imports.
tests/LlamaShears.UnitTests/Provider/Onnx/OnnxEmbeddingProviderFactoryTests.cs Import reorder/cleanup.
tests/LlamaShears.UnitTests/Provider/Ollama/OllamaLanguageModelToolFlatteningTests.cs Updates formatter type usage/imports.
tests/LlamaShears.UnitTests/Provider/Ollama/OllamaLanguageModelThoughtFoldingTests.cs Updates formatter type usage/imports.
tests/LlamaShears.UnitTests/Provider/CompositeIdentityTests.cs Import cleanup.
tests/LlamaShears.UnitTests/OllamaProviderTests.cs Import reorder/cleanup.
tests/LlamaShears.UnitTests/Memory/MemoryTestHarness.cs Import cleanup + SqliteConnection qualification simplification.
tests/LlamaShears.UnitTests/Cron/JsonCronStoreTests.cs Import reorder.
tests/LlamaShears.UnitTests/Context/AgentContextProviderTests.cs Updates stub IContextStore to session-aware signatures.
tests/LlamaShears.UnitTests/Api/Authentication/RejectInvalidAgentBearerMiddlewareTests.cs Adjusts SampleAgent helper usage + imports.
tests/LlamaShears.UnitTests/Api/Authentication/DefaultAgentClaimsProjectorTests.cs Adjusts SampleAgent helper usage + imports.
tests/LlamaShears.UnitTests/Api/Authentication/AgentBearerAuthenticationTests.cs Adjusts SampleAgent helper usage + imports.
tests/LlamaShears.UnitTests/AgentConfigProviderTests.cs Encoding import cleanup.
tests/LlamaShears.UnitTests/Agent/Core/Persistence/JsonLineContextStoreTests.cs Adds tests for session GUID subfolders + updates ArchiveId/session behavior.
tests/LlamaShears.UnitTests/Agent/Core/InferenceRunnerToolDispatchTests.cs Updates data-context factory helper usage.
tests/LlamaShears.UnitTests/Agent/Core/FakeContextStore.cs Makes fake store session-aware (agentId, sessionId) keying.
tests/LlamaShears.UnitTests/Agent/Core/ContextCompactorTests.cs Removes redundant casts; import cleanup.
tests/LlamaShears.UnitTests/Agent/Core/AgentTurnFlowTests.cs Updates agent construction to use AgentIterationRunner seam.
tests/LlamaShears.UnitTests/Agent/Core/AgentTokenStoreTests.cs Adjusts SampleAgent helper usage + imports.
tests/LlamaShears.UnitTests/Agent/Core/AgentLoopTests.cs Updates agent construction to use AgentIterationRunner seam.
tests/LlamaShears.UnitTests/Agent/Core/AgentLockManagerTests.cs Removes unused using.
tests/LlamaShears.UnitTests/Agent/Core/AgentInterruptTests.cs Updates agent construction to use AgentIterationRunner seam.
tests/LlamaShears.UnitTests/Agent/Core/AgentInterruptGracefulTests.cs Updates agent construction to use AgentIterationRunner seam.
tests/LlamaShears.UnitTests/Agent/Core/AgentEventPublishingTests.cs Updates agent construction to use AgentIterationRunner seam.
src/public/LlamaShears.Core.Abstractions/Provider/ModelTurn.cs Adds nullable SessionId routing metadata.
src/public/LlamaShears.Core.Abstractions/Provider/ModelInfo.cs Formatting/import cleanup.
src/public/LlamaShears.Core.Abstractions/Provider/ModelConfigurationJsonConverter.cs Formatting/import cleanup.
src/public/LlamaShears.Core.Abstractions/Provider/ModelConfigurationExtensions.cs Refactors extension helpers into extension(...) blocks.
src/public/LlamaShears.Core.Abstractions/Provider/ModelConfiguration.cs Formatting/import cleanup.
src/public/LlamaShears.Core.Abstractions/Provider/IProviderFactory.cs Formatting/import cleanup.
src/public/LlamaShears.Core.Abstractions/Provider/IEmbeddingProviderFactory.cs Formatting/import cleanup.
src/public/LlamaShears.Core.Abstractions/Provider/EmbeddingModelConfigurationExtensions.cs Refactors extension helpers into extension(...) blocks.
src/public/LlamaShears.Core.Abstractions/Events/EventPublisherExtensions.cs Refactors extension helpers into extension(...) blocks.
src/public/LlamaShears.Core.Abstractions/Events/Event.cs Adds new well-known command event types for agent load/unload.
src/public/LlamaShears.Core.Abstractions/Events/Channel/ChannelMessage.cs Adds nullable SessionId for audit/routing metadata.
src/public/LlamaShears.Core.Abstractions/Events/Agent/AgentUnloadRequest.cs New payload marker for unload command.
src/public/LlamaShears.Core.Abstractions/Events/Agent/AgentLoadRequest.cs New payload for load command carrying resolved config.
src/public/LlamaShears.Core.Abstractions/Common/DataContextServiceCollectionExtensions.cs Refactors extension helpers into extension(...) blocks.
src/public/LlamaShears.Core.Abstractions/Agent/Todo/TodoCommandResult.cs Minor string formatting cleanup.
src/public/LlamaShears.Core.Abstractions/Agent/Sessions/IEphemeralSessionFactory.cs New ephemeral session factory abstraction.
src/public/LlamaShears.Core.Abstractions/Agent/Sessions/IEphemeralSession.cs New ephemeral session handle abstraction.
src/public/LlamaShears.Core.Abstractions/Agent/Sessions/EphemeralSessionRequest.cs New request record for ephemeral sessions.
src/public/LlamaShears.Core.Abstractions/Agent/Sessions/EphemeralSessionReference.cs New (agentId, sessionId) reference type.
src/public/LlamaShears.Core.Abstractions/Agent/Sessions/EphemeralSessionContext.cs New per-session data-scope state for session_reply/fallback.
src/public/LlamaShears.Core.Abstractions/Agent/Sessions/EphemeralRunResult.cs New run outcome record.
src/public/LlamaShears.Core.Abstractions/Agent/Persistence/IContextStore.cs Adds nullable session dimension + default overloads.
src/public/LlamaShears.Core.Abstractions/Agent/Persistence/IAgentContext.cs Adds nullable SessionId to context surface (default = null).
src/public/LlamaShears.Core.Abstractions/Agent/Persistence/ArchiveId.cs Adds nullable SessionId to archive identity.
src/public/LlamaShears.Core.Abstractions/Agent/IterationOutcome.cs New iteration outcome record (interrupted + tool-result turns).
src/public/LlamaShears.Core.Abstractions/Agent/IAgentStateTracker.cs Adds nullable sessionId tag to state tracking.
src/public/LlamaShears.Core.Abstractions/Agent/IAgentManager.cs Removes Get(string); leaves Contains.
src/public/LlamaShears.Core.Abstractions/Agent/IAgentIterationRunner.cs New seam to run a single iteration.
src/public/LlamaShears.Core.Abstractions/Agent/AgentToolConfig.cs Converts empty positional record to non-positional record declaration.
src/public/LlamaShears.Core.Abstractions/Agent/AgentStateExtensions.cs Refactors extension helpers into extension(...) blocks.
src/public/LlamaShears.Core.Abstractions/Agent/AgentState.cs Adds nullable SessionId metadata to agent state.
src/public/LlamaShears.Core.Abstractions/Agent/AgentInfo.cs Formatting/import cleanup.
src/public/LlamaShears.Core.Abstractions/Agent/AgentConfigExtensions.cs Refactors extension helpers into extension(...) blocks.
src/public/LlamaShears.Core.Abstractions/Agent/AgentConfig.cs Formatting/import cleanup.
src/LlamaShears/PluginLoaders/PathPluginLoader.cs Simplifies PluginInformation construction (relies on default params).
src/LlamaShears.Provider.OpenAI/OpenAIProviderFactory.cs Removes partial modifier.
src/LlamaShears.Provider.OpenAI/OpenAILanguageModel.cs Import simplification for JsonIgnoreCondition.
src/LlamaShears.Core/Tools/ModelContextProtocol/ToolResponseClamp.cs Removes unused using.
src/LlamaShears.Core/Tools/ModelContextProtocol/ModelContextProtocolClient.cs Aligns object creation style for cache entry options.
src/LlamaShears.Core/Todo/TodoStorage.cs Removes unused using; minor string builder append simplification.
src/LlamaShears.Core/Sessions/EphemeralSessionFactory.cs New core implementation of IEphemeralSessionFactory.
src/LlamaShears.Core/Sessions/EphemeralSession.cs New ephemeral session loop + fallback publish behavior.
src/LlamaShears.Core/Persistence/JsonLineContextStore.cs Adds per-session subfolder layout + session-aware APIs.
src/LlamaShears.Core/Persistence/AgentTurnContextPersister.cs Routes persistence to session-aware store dimension.
src/LlamaShears.Core/Persistence/AgentContext.cs Carries nullable SessionId on the concrete context.
src/LlamaShears.Core/Memory/MemoryServiceOptions.cs Formatting/import cleanup.
src/LlamaShears.Core/InferenceRunner.cs Small LINQ cleanup.
src/LlamaShears.Core/ExecutionState.cs Removes unused usings; minor field init cleanup.
src/LlamaShears.Core/DataContext/DataContextScope.cs Removes unused using.
src/LlamaShears.Core/DataContext/DataContextFactory.cs Removes unused using.
src/LlamaShears.Core/Cron/CronExecutor.cs Removes redundant return in canceled catch block.
src/LlamaShears.Core/CoreServiceCollectionExtensions.cs Splits AddCore into component helpers; adds AddAgentManager; registers new services (sessions, iteration runner).
src/LlamaShears.Core/CompactionAgentService.cs Implements IAgentService to participate in slot lifecycle.
src/LlamaShears.Core/AgentStateTracker.cs Adds sessionId support when setting state.
src/LlamaShears.Core/AgentManager.cs Converts to bus-driven BackgroundService; handles agent-load/unload commands with mutex.
src/LlamaShears.Core/AgentIterationRunner.cs New implementation of IAgentIterationRunner.
src/LlamaShears.Core/AgentConfigSupervisor.cs New hosted supervisor that watches configs and publishes load/unload commands.
src/LlamaShears.Core/Agent.cs Uses IAgentIterationRunner and enqueues returned tool turns; removes embedded iteration logic.
src/LlamaShears.Api/WebApplicationBuilderExtensions.cs Reorders provider usings.
src/LlamaShears.Api/Web/AgentDirectory.cs Switches from Get() to Contains() for loaded-agent checks.
src/LlamaShears.Api/Tools/ModelContextProtocol/Session/SessionReplyTool.cs New MCP tool session_reply to publish child replies.
src/LlamaShears.Api/Tools/ModelContextProtocol/Session/SessionReplyResult.cs New tool response record.
src/LlamaShears.Api/Tools/ModelContextProtocol/ModelContextProtocolServiceCollectionExtensions.cs Registers SessionReplyTool.
src/LlamaShears.Api.Web/Services/IAgentDirectory.cs Removes unused using.
src/LlamaShears.Api.Web/Services/ChatSession.cs Using reorder only.
src/LlamaShears.Api.Web/Pages/AgentEditor.razor Moves @implements below @using.
src/LlamaShears.Api.Web/Components/Chat/ChatBubbleView.razor Uses CultureInfo import instead of fully-qualified reference.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Provider/ModelTurn.md Documents new SessionId property.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Provider/ModelConfigurationExtensions/index.md New generated docs namespace index for extension-block output.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Provider/ModelConfigurationExtensions/$1E5D4A79A014BD10CBE0F98F7F208BE1/index.md New generated docs for mangled extension container.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Provider/ModelConfigurationExtensions/$1E5D4A79A014BD10CBE0F98F7F208BE1/$4CE8FFD1231E591D45179C9C504A5A71.md New generated docs for method param info.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Provider/ModelConfigurationExtensions/$1E5D4A79A014BD10CBE0F98F7F208BE1.md New generated docs for mangled extension container.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Provider/ModelConfigurationExtensions.md Updates generated docs output for extension changes.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Provider/index.md Adds namespaces section for extension namespaces.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Provider/EmbeddingModelConfigurationExtensions/index.md New generated docs namespace index.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Provider/EmbeddingModelConfigurationExtensions/$DE5C531DB009878C78653085F6B97138.md New generated docs for mangled extension container.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Provider/EmbeddingModelConfigurationExtensions.md Updates generated docs output for extension changes.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Events/Event/WellKnown/Command.md Documents new AgentLoad/AgentUnload command types.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Events/Channel/ChannelMessage.md Documents new SessionId property.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Events/Agent/index.md Adds AgentLoadRequest/AgentUnloadRequest entries.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Events/Agent/AgentUnloadRequest.md New generated docs for unload request payload.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Events/Agent/AgentLoadRequest.md New generated docs for load request payload.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/Sessions/index.md Adds ephemeral session types to docs index.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/Sessions/IEphemeralSessionFactory.md New generated docs for factory abstraction.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/Sessions/IEphemeralSession.md New generated docs for session abstraction.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/Sessions/EphemeralSessionRequest.md New generated docs for request record.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/Sessions/EphemeralSessionReference.md New generated docs for reference record.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/Sessions/EphemeralSessionContext.md New generated docs for data-scope context type.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/Sessions/EphemeralRunResult.md New generated docs for run result.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/Persistence/index.md Updates docs for session-aware persistence types.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/Persistence/IContextStore.md Documents session-aware methods + overloads.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/Persistence/IAgentContext.md Documents new SessionId property and updated summary.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/Persistence/ArchiveId.md Documents new ArchiveId shape including SessionId.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/IterationOutcome.md New generated docs for IterationOutcome.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/index.md Adds new namespaces/types to docs index.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/IAgentStateTracker.md Documents updated SetState signature.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/IAgentManager.md Removes Get() docs content.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/IAgentIterationRunner.md New generated docs for iteration seam.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/AgentToolConfig.md Updates docs due to record declaration change.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/AgentStateExtensions/index.md New generated docs index for extension-block output.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/AgentStateExtensions/$1E5D4A79A014BD10CBE0F98F7F208BE1.md New generated docs for mangled extension container.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/AgentStateExtensions.md Updates generated docs output for extension changes.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/AgentState.md Documents new SessionId property.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/AgentConfigExtensions/index.md New generated docs index for extension-block output.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/AgentConfigExtensions/$1E5D4A79A014BD10CBE0F98F7F208BE1/index.md New generated docs for mangled extension container.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/AgentConfigExtensions/$1E5D4A79A014BD10CBE0F98F7F208BE1/$4CE8FFD1231E591D45179C9C504A5A71.md New generated docs for method param info.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/AgentConfigExtensions/$1E5D4A79A014BD10CBE0F98F7F208BE1.md New generated docs for mangled extension container.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/AgentConfigExtensions.md Updates generated docs output for extension changes.
docs/api/LlamaShears.Core.Abstractions/index.md Updates root API index to include new types/namespaces.
analyzers/LlamaShears.Analyzers/SuppressCs1591.cs Minor comparer qualification cleanup.

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

## Pull request overview This PR adds a first-class “ephemeral session” primitive (caller-owned, per-session persistence under `<agentId>/<sessionGuid>/`, reply via the new `session_reply` MCP tool + fallback) and refactors agent hosting by splitting config reconciliation (`AgentConfigSupervisor`) from slot lifecycle (`AgentManager`), with coordination purely via bus commands. It also extracts `IAgentIterationRunner` as a shared seam and extends persistence/event metadata to carry an optional `SessionId` for correct routing. **Changes:** - Introduces ephemeral sessions: new abstractions + core implementation + `session_reply` MCP tool + unit tests. - Refactors agent hosting: new `AgentConfigSupervisor` publishes `command:agent-load/unload`; `AgentManager` becomes a `BackgroundService` that subscribes and manages slots. - Adds session-aware persistence/routing: `IContextStore` gains `Guid? sessionId`, model/event types gain nullable `SessionId`, and `JsonLineContextStore` writes non-default sessions under GUID subfolders. ### Reviewed changes Copilot reviewed 138 out of 138 changed files in this pull request and generated 4 comments. <details> <summary>Show a summary per file</summary> | File | Description | | ---- | ----------- | | tooling/LlamaShears.DocsBuild/AccessibilityFilter.cs | Minor qualification cleanup for comparers. | | tests/LlamaShears.UnitTests/Sessions/EphemeralSessionTests.cs | New coverage for ephemeral session loop, tool reply path, fallback, caps, interruption. | | tests/LlamaShears.UnitTests/Serialization/CompositeIdentityJsonConverterTests.cs | Import cleanup. | | tests/LlamaShears.UnitTests/Serialization/AgentConfigSerializationTests.cs | Import cleanup. | | tests/LlamaShears.UnitTests/Provider/OpenAI/OpenAILanguageModelTests.cs | Updates formatter type usage/imports. | | tests/LlamaShears.UnitTests/Provider/Onnx/OnnxEmbeddingProviderFactoryTests.cs | Import reorder/cleanup. | | tests/LlamaShears.UnitTests/Provider/Ollama/OllamaLanguageModelToolFlatteningTests.cs | Updates formatter type usage/imports. | | tests/LlamaShears.UnitTests/Provider/Ollama/OllamaLanguageModelThoughtFoldingTests.cs | Updates formatter type usage/imports. | | tests/LlamaShears.UnitTests/Provider/CompositeIdentityTests.cs | Import cleanup. | | tests/LlamaShears.UnitTests/OllamaProviderTests.cs | Import reorder/cleanup. | | tests/LlamaShears.UnitTests/Memory/MemoryTestHarness.cs | Import cleanup + SqliteConnection qualification simplification. | | tests/LlamaShears.UnitTests/Cron/JsonCronStoreTests.cs | Import reorder. | | tests/LlamaShears.UnitTests/Context/AgentContextProviderTests.cs | Updates stub `IContextStore` to session-aware signatures. | | tests/LlamaShears.UnitTests/Api/Authentication/RejectInvalidAgentBearerMiddlewareTests.cs | Adjusts SampleAgent helper usage + imports. | | tests/LlamaShears.UnitTests/Api/Authentication/DefaultAgentClaimsProjectorTests.cs | Adjusts SampleAgent helper usage + imports. | | tests/LlamaShears.UnitTests/Api/Authentication/AgentBearerAuthenticationTests.cs | Adjusts SampleAgent helper usage + imports. | | tests/LlamaShears.UnitTests/AgentConfigProviderTests.cs | Encoding import cleanup. | | tests/LlamaShears.UnitTests/Agent/Core/Persistence/JsonLineContextStoreTests.cs | Adds tests for session GUID subfolders + updates ArchiveId/session behavior. | | tests/LlamaShears.UnitTests/Agent/Core/InferenceRunnerToolDispatchTests.cs | Updates data-context factory helper usage. | | tests/LlamaShears.UnitTests/Agent/Core/FakeContextStore.cs | Makes fake store session-aware (agentId, sessionId) keying. | | tests/LlamaShears.UnitTests/Agent/Core/ContextCompactorTests.cs | Removes redundant casts; import cleanup. | | tests/LlamaShears.UnitTests/Agent/Core/AgentTurnFlowTests.cs | Updates agent construction to use `AgentIterationRunner` seam. | | tests/LlamaShears.UnitTests/Agent/Core/AgentTokenStoreTests.cs | Adjusts SampleAgent helper usage + imports. | | tests/LlamaShears.UnitTests/Agent/Core/AgentLoopTests.cs | Updates agent construction to use `AgentIterationRunner` seam. | | tests/LlamaShears.UnitTests/Agent/Core/AgentLockManagerTests.cs | Removes unused using. | | tests/LlamaShears.UnitTests/Agent/Core/AgentInterruptTests.cs | Updates agent construction to use `AgentIterationRunner` seam. | | tests/LlamaShears.UnitTests/Agent/Core/AgentInterruptGracefulTests.cs | Updates agent construction to use `AgentIterationRunner` seam. | | tests/LlamaShears.UnitTests/Agent/Core/AgentEventPublishingTests.cs | Updates agent construction to use `AgentIterationRunner` seam. | | src/public/LlamaShears.Core.Abstractions/Provider/ModelTurn.cs | Adds nullable `SessionId` routing metadata. | | src/public/LlamaShears.Core.Abstractions/Provider/ModelInfo.cs | Formatting/import cleanup. | | src/public/LlamaShears.Core.Abstractions/Provider/ModelConfigurationJsonConverter.cs | Formatting/import cleanup. | | src/public/LlamaShears.Core.Abstractions/Provider/ModelConfigurationExtensions.cs | Refactors extension helpers into `extension(...)` blocks. | | src/public/LlamaShears.Core.Abstractions/Provider/ModelConfiguration.cs | Formatting/import cleanup. | | src/public/LlamaShears.Core.Abstractions/Provider/IProviderFactory.cs | Formatting/import cleanup. | | src/public/LlamaShears.Core.Abstractions/Provider/IEmbeddingProviderFactory.cs | Formatting/import cleanup. | | src/public/LlamaShears.Core.Abstractions/Provider/EmbeddingModelConfigurationExtensions.cs | Refactors extension helpers into `extension(...)` blocks. | | src/public/LlamaShears.Core.Abstractions/Events/EventPublisherExtensions.cs | Refactors extension helpers into `extension(...)` blocks. | | src/public/LlamaShears.Core.Abstractions/Events/Event.cs | Adds new well-known command event types for agent load/unload. | | src/public/LlamaShears.Core.Abstractions/Events/Channel/ChannelMessage.cs | Adds nullable `SessionId` for audit/routing metadata. | | src/public/LlamaShears.Core.Abstractions/Events/Agent/AgentUnloadRequest.cs | New payload marker for unload command. | | src/public/LlamaShears.Core.Abstractions/Events/Agent/AgentLoadRequest.cs | New payload for load command carrying resolved config. | | src/public/LlamaShears.Core.Abstractions/Common/DataContextServiceCollectionExtensions.cs | Refactors extension helpers into `extension(...)` blocks. | | src/public/LlamaShears.Core.Abstractions/Agent/Todo/TodoCommandResult.cs | Minor string formatting cleanup. | | src/public/LlamaShears.Core.Abstractions/Agent/Sessions/IEphemeralSessionFactory.cs | New ephemeral session factory abstraction. | | src/public/LlamaShears.Core.Abstractions/Agent/Sessions/IEphemeralSession.cs | New ephemeral session handle abstraction. | | src/public/LlamaShears.Core.Abstractions/Agent/Sessions/EphemeralSessionRequest.cs | New request record for ephemeral sessions. | | src/public/LlamaShears.Core.Abstractions/Agent/Sessions/EphemeralSessionReference.cs | New (agentId, sessionId) reference type. | | src/public/LlamaShears.Core.Abstractions/Agent/Sessions/EphemeralSessionContext.cs | New per-session data-scope state for session_reply/fallback. | | src/public/LlamaShears.Core.Abstractions/Agent/Sessions/EphemeralRunResult.cs | New run outcome record. | | src/public/LlamaShears.Core.Abstractions/Agent/Persistence/IContextStore.cs | Adds nullable session dimension + default overloads. | | src/public/LlamaShears.Core.Abstractions/Agent/Persistence/IAgentContext.cs | Adds nullable `SessionId` to context surface (default = null). | | src/public/LlamaShears.Core.Abstractions/Agent/Persistence/ArchiveId.cs | Adds nullable `SessionId` to archive identity. | | src/public/LlamaShears.Core.Abstractions/Agent/IterationOutcome.cs | New iteration outcome record (interrupted + tool-result turns). | | src/public/LlamaShears.Core.Abstractions/Agent/IAgentStateTracker.cs | Adds nullable sessionId tag to state tracking. | | src/public/LlamaShears.Core.Abstractions/Agent/IAgentManager.cs | Removes `Get(string)`; leaves `Contains`. | | src/public/LlamaShears.Core.Abstractions/Agent/IAgentIterationRunner.cs | New seam to run a single iteration. | | src/public/LlamaShears.Core.Abstractions/Agent/AgentToolConfig.cs | Converts empty positional record to non-positional record declaration. | | src/public/LlamaShears.Core.Abstractions/Agent/AgentStateExtensions.cs | Refactors extension helpers into `extension(...)` blocks. | | src/public/LlamaShears.Core.Abstractions/Agent/AgentState.cs | Adds nullable `SessionId` metadata to agent state. | | src/public/LlamaShears.Core.Abstractions/Agent/AgentInfo.cs | Formatting/import cleanup. | | src/public/LlamaShears.Core.Abstractions/Agent/AgentConfigExtensions.cs | Refactors extension helpers into `extension(...)` blocks. | | src/public/LlamaShears.Core.Abstractions/Agent/AgentConfig.cs | Formatting/import cleanup. | | src/LlamaShears/PluginLoaders/PathPluginLoader.cs | Simplifies PluginInformation construction (relies on default params). | | src/LlamaShears.Provider.OpenAI/OpenAIProviderFactory.cs | Removes `partial` modifier. | | src/LlamaShears.Provider.OpenAI/OpenAILanguageModel.cs | Import simplification for JsonIgnoreCondition. | | src/LlamaShears.Core/Tools/ModelContextProtocol/ToolResponseClamp.cs | Removes unused using. | | src/LlamaShears.Core/Tools/ModelContextProtocol/ModelContextProtocolClient.cs | Aligns object creation style for cache entry options. | | src/LlamaShears.Core/Todo/TodoStorage.cs | Removes unused using; minor string builder append simplification. | | src/LlamaShears.Core/Sessions/EphemeralSessionFactory.cs | New core implementation of `IEphemeralSessionFactory`. | | src/LlamaShears.Core/Sessions/EphemeralSession.cs | New ephemeral session loop + fallback publish behavior. | | src/LlamaShears.Core/Persistence/JsonLineContextStore.cs | Adds per-session subfolder layout + session-aware APIs. | | src/LlamaShears.Core/Persistence/AgentTurnContextPersister.cs | Routes persistence to session-aware store dimension. | | src/LlamaShears.Core/Persistence/AgentContext.cs | Carries nullable `SessionId` on the concrete context. | | src/LlamaShears.Core/Memory/MemoryServiceOptions.cs | Formatting/import cleanup. | | src/LlamaShears.Core/InferenceRunner.cs | Small LINQ cleanup. | | src/LlamaShears.Core/ExecutionState.cs | Removes unused usings; minor field init cleanup. | | src/LlamaShears.Core/DataContext/DataContextScope.cs | Removes unused using. | | src/LlamaShears.Core/DataContext/DataContextFactory.cs | Removes unused using. | | src/LlamaShears.Core/Cron/CronExecutor.cs | Removes redundant `return` in canceled catch block. | | src/LlamaShears.Core/CoreServiceCollectionExtensions.cs | Splits AddCore into component helpers; adds AddAgentManager; registers new services (sessions, iteration runner). | | src/LlamaShears.Core/CompactionAgentService.cs | Implements `IAgentService` to participate in slot lifecycle. | | src/LlamaShears.Core/AgentStateTracker.cs | Adds sessionId support when setting state. | | src/LlamaShears.Core/AgentManager.cs | Converts to bus-driven BackgroundService; handles agent-load/unload commands with mutex. | | src/LlamaShears.Core/AgentIterationRunner.cs | New implementation of `IAgentIterationRunner`. | | src/LlamaShears.Core/AgentConfigSupervisor.cs | New hosted supervisor that watches configs and publishes load/unload commands. | | src/LlamaShears.Core/Agent.cs | Uses `IAgentIterationRunner` and enqueues returned tool turns; removes embedded iteration logic. | | src/LlamaShears.Api/WebApplicationBuilderExtensions.cs | Reorders provider usings. | | src/LlamaShears.Api/Web/AgentDirectory.cs | Switches from `Get()` to `Contains()` for loaded-agent checks. | | src/LlamaShears.Api/Tools/ModelContextProtocol/Session/SessionReplyTool.cs | New MCP tool `session_reply` to publish child replies. | | src/LlamaShears.Api/Tools/ModelContextProtocol/Session/SessionReplyResult.cs | New tool response record. | | src/LlamaShears.Api/Tools/ModelContextProtocol/ModelContextProtocolServiceCollectionExtensions.cs | Registers `SessionReplyTool`. | | src/LlamaShears.Api.Web/Services/IAgentDirectory.cs | Removes unused using. | | src/LlamaShears.Api.Web/Services/ChatSession.cs | Using reorder only. | | src/LlamaShears.Api.Web/Pages/AgentEditor.razor | Moves `@implements` below `@using`. | | src/LlamaShears.Api.Web/Components/Chat/ChatBubbleView.razor | Uses `CultureInfo` import instead of fully-qualified reference. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Provider/ModelTurn.md | Documents new `SessionId` property. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Provider/ModelConfigurationExtensions/index.md | New generated docs namespace index for extension-block output. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Provider/ModelConfigurationExtensions/<G>$1E5D4A79A014BD10CBE0F98F7F208BE1/index.md | New generated docs for mangled extension container. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Provider/ModelConfigurationExtensions/<G>$1E5D4A79A014BD10CBE0F98F7F208BE1/<M>$4CE8FFD1231E591D45179C9C504A5A71.md | New generated docs for method param info. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Provider/ModelConfigurationExtensions/<G>$1E5D4A79A014BD10CBE0F98F7F208BE1.md | New generated docs for mangled extension container. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Provider/ModelConfigurationExtensions.md | Updates generated docs output for extension changes. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Provider/index.md | Adds namespaces section for extension namespaces. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Provider/EmbeddingModelConfigurationExtensions/index.md | New generated docs namespace index. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Provider/EmbeddingModelConfigurationExtensions/<G>$DE5C531DB009878C78653085F6B97138.md | New generated docs for mangled extension container. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Provider/EmbeddingModelConfigurationExtensions.md | Updates generated docs output for extension changes. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Events/Event/WellKnown/Command.md | Documents new AgentLoad/AgentUnload command types. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Events/Channel/ChannelMessage.md | Documents new `SessionId` property. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Events/Agent/index.md | Adds AgentLoadRequest/AgentUnloadRequest entries. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Events/Agent/AgentUnloadRequest.md | New generated docs for unload request payload. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Events/Agent/AgentLoadRequest.md | New generated docs for load request payload. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/Sessions/index.md | Adds ephemeral session types to docs index. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/Sessions/IEphemeralSessionFactory.md | New generated docs for factory abstraction. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/Sessions/IEphemeralSession.md | New generated docs for session abstraction. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/Sessions/EphemeralSessionRequest.md | New generated docs for request record. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/Sessions/EphemeralSessionReference.md | New generated docs for reference record. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/Sessions/EphemeralSessionContext.md | New generated docs for data-scope context type. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/Sessions/EphemeralRunResult.md | New generated docs for run result. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/Persistence/index.md | Updates docs for session-aware persistence types. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/Persistence/IContextStore.md | Documents session-aware methods + overloads. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/Persistence/IAgentContext.md | Documents new SessionId property and updated summary. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/Persistence/ArchiveId.md | Documents new ArchiveId shape including SessionId. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/IterationOutcome.md | New generated docs for IterationOutcome. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/index.md | Adds new namespaces/types to docs index. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/IAgentStateTracker.md | Documents updated SetState signature. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/IAgentManager.md | Removes Get() docs content. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/IAgentIterationRunner.md | New generated docs for iteration seam. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/AgentToolConfig.md | Updates docs due to record declaration change. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/AgentStateExtensions/index.md | New generated docs index for extension-block output. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/AgentStateExtensions/<G>$1E5D4A79A014BD10CBE0F98F7F208BE1.md | New generated docs for mangled extension container. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/AgentStateExtensions.md | Updates generated docs output for extension changes. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/AgentState.md | Documents new SessionId property. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/AgentConfigExtensions/index.md | New generated docs index for extension-block output. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/AgentConfigExtensions/<G>$1E5D4A79A014BD10CBE0F98F7F208BE1/index.md | New generated docs for mangled extension container. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/AgentConfigExtensions/<G>$1E5D4A79A014BD10CBE0F98F7F208BE1/<M>$4CE8FFD1231E591D45179C9C504A5A71.md | New generated docs for method param info. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/AgentConfigExtensions/<G>$1E5D4A79A014BD10CBE0F98F7F208BE1.md | New generated docs for mangled extension container. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/AgentConfigExtensions.md | Updates generated docs output for extension changes. | | docs/api/LlamaShears.Core.Abstractions/index.md | Updates root API index to include new types/namespaces. | | analyzers/LlamaShears.Analyzers/SuppressCs1591.cs | Minor comparer qualification cleanup. | </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>.
@ -0,0 +152,4 @@
IsError = outcome.ToolResults[i].IsError,
SessionId = sessionId,
});
}
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-05-18 20:08:54 -04:00

InferenceRunner already publishes tool-result ModelTurns via PublishCompletedToolCallAsync (Event.WellKnown.Agent.Turn), and AgentTurnContextPersister persists those turns. Returning another set of tool turns here (which will then be published again on the next iteration as part of the inbound batch) risks duplicating tool results in the persisted transcript/prompt. Consider returning references to the already-emitted turns, or suppressing/persist-filtering the InferenceRunner tool-turn publish, or otherwise ensuring tool results are only persisted/prompted once (and that the fed-back tool turns preserve the correct ChannelId).

`InferenceRunner` already publishes tool-result `ModelTurn`s via `PublishCompletedToolCallAsync` (Event.WellKnown.Agent.Turn), and `AgentTurnContextPersister` persists those turns. Returning *another* set of tool turns here (which will then be published again on the next iteration as part of the inbound batch) risks duplicating tool results in the persisted transcript/prompt. Consider returning references to the already-emitted turns, or suppressing/persist-filtering the `InferenceRunner` tool-turn publish, or otherwise ensuring tool results are only persisted/prompted once (and that the fed-back tool turns preserve the correct `ChannelId`).
@ -78,16 +79,17 @@ public sealed class JsonLineContextStore : IContextStore
.Select(Path.GetFileName)
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-05-18 20:08:54 -04:00

ListAgentsAsync filters out any top-level directory whose name parses as a 32-char GUID ("N" format). Since agent IDs are not otherwise constrained, this can accidentally hide legitimate agents whose ID happens to match that pattern (e.g., an agent named with a GUID). Consider either enforcing/disallowing GUID-N agent IDs at config/creation time, or tightening the heuristic (e.g., only skip GUID folders that are not valid agent folders), or removing the filter and addressing the original rogue-folder scenario differently.

`ListAgentsAsync` filters out any top-level directory whose name parses as a 32-char GUID ("N" format). Since agent IDs are not otherwise constrained, this can accidentally hide legitimate agents whose ID happens to match that pattern (e.g., an agent named with a GUID). Consider either enforcing/disallowing GUID-N agent IDs at config/creation time, or tightening the heuristic (e.g., only skip GUID folders that are not valid agent folders), or removing the filter and addressing the original rogue-folder scenario differently.
@ -95,0 +83,4 @@
}
if (element.ValueKind == JsonValueKind.Null)
{
return default(T) is null;
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-05-18 20:08:55 -04:00

Switching these public extension helpers to the new extension(...) { ... } block syntax appears to cause the generated API docs in this PR to surface synthetic mangled types/namespaces (e.g. <G>$...) rather than clean extension-method entries. If the docs under docs/api/ are intended for public consumption, consider reverting to classic public static extension methods with this parameters (or updating the doc generator) to keep the published API surface readable and stable.

Switching these public extension helpers to the new `extension(...) { ... }` block syntax appears to cause the generated API docs in this PR to surface synthetic mangled types/namespaces (e.g. `<G>$...`) rather than clean extension-method entries. If the docs under `docs/api/` are intended for public consumption, consider reverting to classic `public static` extension methods with `this` parameters (or updating the doc generator) to keep the published API surface readable and stable.
@ -10,3 +9,3 @@
new ConcurrentDictionary<string, IAgentContext>(StringComparer.Ordinal);
private readonly ConcurrentDictionary<(string AgentId, Guid? SessionId), IAgentContext> _contexts = new();
public FakeContextStore With(string agentId, IAgentContext context)
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-05-18 20:08:54 -04:00

This introduces target-typed new() for _contexts. Repo style disables IDE0090 and explicitly prefers new ConcurrentDictionary<...>(...) for readability (see .editorconfig IDE0090 section). Consider switching back to an explicit constructor call here for consistency with the configured style.

This introduces target-typed `new()` for `_contexts`. Repo style disables IDE0090 and explicitly prefers `new ConcurrentDictionary<...>(...)` for readability (see `.editorconfig` IDE0090 section). Consider switching back to an explicit constructor call here for consistency with the configured style.
Sign in to join this conversation.
No description provided.