system-prompt tweaks, agent slimming, NO_RESPONSE handling, MCP tool-list cache #87

Merged
jasoncouture merged 9 commits from system-prompt-tweaks into main 2026-05-16 23:29:10 -04:00
jasoncouture commented 2026-05-16 23:29:04 -04:00 (Migrated from github.com)

Summary

  • System prompt restructure: XML <message_metadata> user-prefix envelope, Memory Recall section, <server>__tool_name convention, parallel-tool limit bumped to 15.
  • Agent refactor: shrink from ~700 LOC / 17 ctor params to ~370 / 11 by moving AsyncServiceScope ownership into AgentManager and resolving ILanguageModel/IContextCompactor/IInferenceRunner per-turn from a scoped bundle. Tool discovery moved into the per-turn flow so live config edits land on the next turn.
  • AgentState data-context record (ChannelId/EventId/CorrelationId) + IAgentStateTracker.SetState(...). Top-level data-context keys remain objects, never primitives. Per-field extension shortcuts mirror AgentConfigExtensions.
  • InferenceRunner: NO_RESPONSE sentinel handling. Streaming buffer detects prefix-of-sentinel, swallows the text, and reports Suppressed = true so the agent retry loop breaks cleanly instead of treating intentional silence as an empty response.
  • ModelContextProtocolClient: tool-list cache (10 min success / 1 min failure), failures replay via ExceptionDispatchInfo wrapped as the inner exception of a fresh InvalidOperationException to avoid stack-trace accumulation across replays. OperationCanceledException not cached.
  • WorkspaceFile.Path (directory + trailing separator) so Path + Name is absolute; workspace reads cached via IFileParserCache with a static parser.
  • Host: --no-local-config CLI flag and LLAMASHEARS_NO_LOCAL_CONFIG=true env var bypass ~/.llama-shears/appsettings.json so integration tests don't pick up local config. DI now runs with ValidateScopes = true and ValidateOnBuild = true.
  • UI: import hljs through the bundle's module graph in highlight-init.js. esbuild bundles highlight.min.js as CJS so var hljs never reaches window!window.hljs was silently bailing and no <pre><code> was being highlighted.
  • Docs regen for AgentState, WorkspaceFile.Path, IAgent.

Test plan

  • dotnet build clean (no warnings, no errors)
  • dotnet test — 510/510 pass
  • Web UI smoke: fenced code blocks pick up class="hljs language-…" and github-dark theme colors after page load
  • Manual: confirm live config edit lands on next agent turn without restart
  • Manual: confirm MCP tool-list caches surface a sensible error message on transient failure

🤖 Generated with Claude Code

## Summary - System prompt restructure: XML `<message_metadata>` user-prefix envelope, Memory Recall section, `<server>__tool_name` convention, parallel-tool limit bumped to 15. - Agent refactor: shrink from ~700 LOC / 17 ctor params to ~370 / 11 by moving `AsyncServiceScope` ownership into `AgentManager` and resolving `ILanguageModel`/`IContextCompactor`/`IInferenceRunner` per-turn from a scoped bundle. Tool discovery moved into the per-turn flow so live config edits land on the next turn. - `AgentState` data-context record (ChannelId/EventId/CorrelationId) + `IAgentStateTracker.SetState(...)`. Top-level data-context keys remain objects, never primitives. Per-field extension shortcuts mirror `AgentConfigExtensions`. - `InferenceRunner`: `NO_RESPONSE` sentinel handling. Streaming buffer detects prefix-of-sentinel, swallows the text, and reports `Suppressed = true` so the agent retry loop breaks cleanly instead of treating intentional silence as an empty response. - `ModelContextProtocolClient`: tool-list cache (10 min success / 1 min failure), failures replay via `ExceptionDispatchInfo` wrapped as the inner exception of a fresh `InvalidOperationException` to avoid stack-trace accumulation across replays. `OperationCanceledException` not cached. - `WorkspaceFile.Path` (directory + trailing separator) so `Path + Name` is absolute; workspace reads cached via `IFileParserCache` with a static parser. - Host: `--no-local-config` CLI flag and `LLAMASHEARS_NO_LOCAL_CONFIG=true` env var bypass `~/.llama-shears/appsettings.json` so integration tests don't pick up local config. DI now runs with `ValidateScopes = true` and `ValidateOnBuild = true`. - UI: import `hljs` through the bundle's module graph in `highlight-init.js`. esbuild bundles `highlight.min.js` as CJS so `var hljs` never reaches `window` — `!window.hljs` was silently bailing and no `<pre><code>` was being highlighted. - Docs regen for `AgentState`, `WorkspaceFile.Path`, `IAgent`. ## Test plan - [x] `dotnet build` clean (no warnings, no errors) - [x] `dotnet test` — 510/510 pass - [x] Web UI smoke: fenced code blocks pick up `class="hljs language-…"` and github-dark theme colors after page load - [ ] Manual: confirm live config edit lands on next agent turn without restart - [ ] Manual: confirm MCP tool-list caches surface a sensible error message on transient failure 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-05-16 23:30:35 -04:00 (Migrated from github.com)
Package Line Rate Branch Rate Complexity Health
LlamaShears.Core.Eventing 91% 84% 53
LlamaShears.Core.Abstractions 49% 33% 360
LlamaShears.Api 29% 30% 460
LlamaShears.Provider.Ollama 44% 28% 188
LlamaShears.Core.Eventing.Extensions 100% 100% 1
LlamaShears.Core 44% 40% 1390
LlamaShears.Provider.Onnx.Embeddings 37% 38% 72
LlamaShears.Provider.OpenAI 65% 65% 227
LlamaShears.Api.Web 1% 1% 428
LlamaShears.Hosting 33% 21% 27
LlamaShears.Plugins 0% 100% 1
LlamaShears.Core.Eventing 89% 73% 53
LlamaShears 52% 36% 25
LlamaShears.Plugins.Host 34% 24% 36
LlamaShears.Core.Abstractions 31% 13% 360
LlamaShears.Api 7% 1% 460
LlamaShears.Provider.Ollama 3% 1% 188
LlamaShears.Core.Eventing.Extensions 100% 100% 1
StrangeSoft.Plugins.Host 20% 21% 87
LlamaShears.Core 40% 26% 1390
LlamaShears.Provider.Onnx.Embeddings 3% 0% 72
LlamaShears.Provider.OpenAI 2% 0% 227
LlamaShears.Api.Web 21% 10% 428
LlamaShears.Hosting 26% 8% 27
LlamaShears.Plugins 0% 100% 1
LlamaShears.Core.Eventing 89% 73% 53
LlamaShears 52% 36% 25
LlamaShears.Plugins.Host 34% 24% 36
LlamaShears.Core.Abstractions 31% 13% 360
LlamaShears.IntegrationTests 85% 73% 72
LlamaShears.Api 9% 3% 460
LlamaShears.Provider.Ollama 3% 1% 188
LlamaShears.Core.Eventing.Extensions 100% 100% 1
StrangeSoft.Plugins.Host 20% 21% 87
LlamaShears.Core 41% 27% 1390
LlamaShears.Provider.Onnx.Embeddings 3% 0% 72
LlamaShears.Provider.OpenAI 2% 0% 227
LlamaShears.Api.Web 31% 17% 428
LlamaShears.Hosting 26% 8% 27
LlamaShears.Analyzers.CodeFixes 85% 69% 60
LlamaShears.Analyzers 88% 76% 199
Summary 46% (10646 / 31373) 36% (2275 / 9488) 10247
Package | Line Rate | Branch Rate | Complexity | Health -------- | --------- | ----------- | ---------- | ------ LlamaShears.Core.Eventing | 91% | 84% | 53 | ✔ LlamaShears.Core.Abstractions | 49% | 33% | 360 | ❌ LlamaShears.Api | 29% | 30% | 460 | ❌ LlamaShears.Provider.Ollama | 44% | 28% | 188 | ❌ LlamaShears.Core.Eventing.Extensions | 100% | 100% | 1 | ✔ LlamaShears.Core | 44% | 40% | 1390 | ❌ LlamaShears.Provider.Onnx.Embeddings | 37% | 38% | 72 | ❌ LlamaShears.Provider.OpenAI | 65% | 65% | 227 | ➖ LlamaShears.Api.Web | 1% | 1% | 428 | ❌ LlamaShears.Hosting | 33% | 21% | 27 | ❌ LlamaShears.Plugins | 0% | 100% | 1 | ❌ LlamaShears.Core.Eventing | 89% | 73% | 53 | ✔ LlamaShears | 52% | 36% | 25 | ➖ LlamaShears.Plugins.Host | 34% | 24% | 36 | ❌ LlamaShears.Core.Abstractions | 31% | 13% | 360 | ❌ LlamaShears.Api | 7% | 1% | 460 | ❌ LlamaShears.Provider.Ollama | 3% | 1% | 188 | ❌ LlamaShears.Core.Eventing.Extensions | 100% | 100% | 1 | ✔ StrangeSoft.Plugins.Host | 20% | 21% | 87 | ❌ LlamaShears.Core | 40% | 26% | 1390 | ❌ LlamaShears.Provider.Onnx.Embeddings | 3% | 0% | 72 | ❌ LlamaShears.Provider.OpenAI | 2% | 0% | 227 | ❌ LlamaShears.Api.Web | 21% | 10% | 428 | ❌ LlamaShears.Hosting | 26% | 8% | 27 | ❌ LlamaShears.Plugins | 0% | 100% | 1 | ❌ LlamaShears.Core.Eventing | 89% | 73% | 53 | ✔ LlamaShears | 52% | 36% | 25 | ➖ LlamaShears.Plugins.Host | 34% | 24% | 36 | ❌ LlamaShears.Core.Abstractions | 31% | 13% | 360 | ❌ LlamaShears.IntegrationTests | 85% | 73% | 72 | ✔ LlamaShears.Api | 9% | 3% | 460 | ❌ LlamaShears.Provider.Ollama | 3% | 1% | 188 | ❌ LlamaShears.Core.Eventing.Extensions | 100% | 100% | 1 | ✔ StrangeSoft.Plugins.Host | 20% | 21% | 87 | ❌ LlamaShears.Core | 41% | 27% | 1390 | ❌ LlamaShears.Provider.Onnx.Embeddings | 3% | 0% | 72 | ❌ LlamaShears.Provider.OpenAI | 2% | 0% | 227 | ❌ LlamaShears.Api.Web | 31% | 17% | 428 | ❌ LlamaShears.Hosting | 26% | 8% | 27 | ❌ LlamaShears.Analyzers.CodeFixes | 85% | 69% | 60 | ✔ LlamaShears.Analyzers | 88% | 76% | 199 | ✔ **Summary** | **46%** (10646 / 31373) | **36%** (2275 / 9488) | **10247** | ❌ <!-- Sticky Pull Request Commentcoverage -->
copilot-pull-request-reviewer[bot] (Migrated from github.com) reviewed 2026-05-16 23:34:51 -04:00
copilot-pull-request-reviewer[bot] (Migrated from github.com) left a comment

Pull request overview

This PR refactors agent turn execution and prompt/context plumbing, adds agent-state metadata and intentional NO_RESPONSE handling, introduces MCP tool-list caching, and updates UI/script/docs support around those changes.

Changes:

  • Moves model/compactor/inference resolution into per-turn scoped services and introduces AgentState.
  • Restructures system/user metadata prompts and adds NO_RESPONSE suppression semantics.
  • Adds MCP tool-list caching, workspace-file path metadata, local-config bypass for tests, and highlight.js bundling fixes.

Reviewed changes

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

Show a summary per file
File Description
tests/LlamaShears.UnitTests/SystemPrompt/FilesystemSystemPromptProviderTests.cs Updates workspace file test construction for Path.
tests/LlamaShears.UnitTests/Agent/Core/TestAgentConfigs.cs Adds fake MCP helpers and agent state data setup.
tests/LlamaShears.UnitTests/Agent/Core/FakeDataContextScope.cs Adds test data-context implementation.
tests/LlamaShears.UnitTests/Agent/Core/ContextCompactorTests.cs Updates compactor construction for new scoped dependencies.
tests/LlamaShears.UnitTests/Agent/Core/AgentTurnFlowTests.cs Updates agent test setup for async start/scoped services.
tests/LlamaShears.UnitTests/Agent/Core/AgentLoopTests.cs Updates loop tests for new agent construction.
tests/LlamaShears.UnitTests/Agent/Core/AgentInterruptTests.cs Updates interrupt tests for async agent lifecycle.
tests/LlamaShears.UnitTests/Agent/Core/AgentInterruptGracefulTests.cs Updates graceful interrupt tests for scoped runner dependencies.
tests/LlamaShears.UnitTests/Agent/Core/AgentEventPublishingTests.cs Updates event publishing test harness for new agent services.
tests/LlamaShears.IntegrationTests/Hosting/IntegrationTestEnvironment.cs Disables local config during integration tests.
src/public/LlamaShears.Core.Abstractions/SystemPrompt/WorkspaceFile.cs Adds workspace file directory path to public record.
src/public/LlamaShears.Core.Abstractions/Provider/InferenceOutcome.cs Adds Suppressed result flag.
src/public/LlamaShears.Core.Abstractions/Agent/IAgentStateTracker.cs Adds agent-state tracking abstraction.
src/public/LlamaShears.Core.Abstractions/Agent/IAgent.cs Updates lifecycle interface and removes last-activity surface.
src/public/LlamaShears.Core.Abstractions/Agent/AgentStateExtensions.cs Adds data-context accessors for agent state.
src/public/LlamaShears.Core.Abstractions/Agent/AgentState.cs Adds per-turn agent state record.
src/LlamaShears/Program.cs Adds local-config bypass and DI validation.
src/LlamaShears/content/templates/workspace/system/DEFAULT.md Restructures system prompt guidance and workspace file headings.
src/LlamaShears/content/templates/workspace/system/context/PROMPT.md Converts runtime metadata prompt to XML-style envelope.
src/LlamaShears/content/templates/workspace/system/compaction/PROMPT.md Converts compaction metadata prompt to XML-style envelope.
src/LlamaShears/content/templates/workspace/MEMORY.md Removes seeded memory placeholder.
src/LlamaShears.Core/Tools/ModelContextProtocol/ToolResponseClamp.cs Raises MCP tool response limits.
src/LlamaShears.Core/Tools/ModelContextProtocol/ModelContextProtocolClient.cs Adds success/failure cache for MCP tool lists.
src/LlamaShears.Core/SystemPrompt/WorkspaceContextDataProvider.cs Reads workspace files through parser cache and includes path.
src/LlamaShears.Core/Provider/ModelTextFormatter.cs Wraps user turns in XML-style message metadata.
src/LlamaShears.Core/InferenceRunner.cs Adds NO_RESPONSE detection and suppression.
src/LlamaShears.Core/CoreServiceCollectionExtensions.cs Registers agent services as scoped and adds scoped model factory.
src/LlamaShears.Core/ContextCompactor.cs Uses scoped state/data context and stamps compaction state.
src/LlamaShears.Core/AgentStateTracker.cs Implements data-context agent-state writer.
src/LlamaShears.Core/AgentManager.cs Moves scope ownership and agent construction flow into manager.
src/LlamaShears.Core/Agent.cs Refactors agent loop to resolve per-turn scoped bundle/services.
src/LlamaShears.Api/Tools/ModelContextProtocol/ModelContextProtocolServiceCollectionExtensions.cs Adjusts default workspace file protection rules.
src/LlamaShears.Api.Web/js/scripts/highlight-init.js Imports highlight.js through bundled module graph.
src/LlamaShears.Api.Web/js/entries/site.js Removes global highlight.js pre-import.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/SystemPrompt/WorkspaceFile.md Regenerates WorkspaceFile API docs.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Provider/InferenceOutcome.md Regenerates InferenceOutcome API docs.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/index.md Adds new agent-state API docs entries.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/IAgentStateTracker.md Adds IAgentStateTracker docs.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/IAgent.md Updates IAgent docs.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/AgentStateExtensions.md Adds AgentStateExtensions docs.
docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/AgentState.md Adds AgentState docs.
docs/api/LlamaShears.Core.Abstractions/index.md Adds new public agent-state docs links.
Comments suppressed due to low confidence (2)

src/LlamaShears/content/templates/workspace/system/context/PROMPT.md:10

  • The channel id is rendered as raw XML text. Because channel ids come from event ids, a publisher/plugin can include XML-sensitive characters and break or spoof the <runtime_metadata> envelope; escape the value before inserting it into <channel>.
{{- if agent_state.channel_id }}
  <channel>{{ agent_state.channel_id }}</channel>

src/LlamaShears/content/templates/workspace/system/compaction/PROMPT.md:10

  • The channel id is rendered as raw XML text. If the active channel id contains XML-sensitive characters, the compaction metadata envelope can become malformed or include spoofed metadata; escape the value before inserting it into <channel>.
{{- if agent_state.channel_id }}
  <channel>{{ agent_state.channel_id }}</channel>

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

## Pull request overview This PR refactors agent turn execution and prompt/context plumbing, adds agent-state metadata and intentional `NO_RESPONSE` handling, introduces MCP tool-list caching, and updates UI/script/docs support around those changes. **Changes:** - Moves model/compactor/inference resolution into per-turn scoped services and introduces `AgentState`. - Restructures system/user metadata prompts and adds `NO_RESPONSE` suppression semantics. - Adds MCP tool-list caching, workspace-file path metadata, local-config bypass for tests, and highlight.js bundling fixes. ### Reviewed changes Copilot reviewed 42 out of 42 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 workspace file test construction for `Path`. | | tests/LlamaShears.UnitTests/Agent/Core/TestAgentConfigs.cs | Adds fake MCP helpers and agent state data setup. | | tests/LlamaShears.UnitTests/Agent/Core/FakeDataContextScope.cs | Adds test data-context implementation. | | tests/LlamaShears.UnitTests/Agent/Core/ContextCompactorTests.cs | Updates compactor construction for new scoped dependencies. | | tests/LlamaShears.UnitTests/Agent/Core/AgentTurnFlowTests.cs | Updates agent test setup for async start/scoped services. | | tests/LlamaShears.UnitTests/Agent/Core/AgentLoopTests.cs | Updates loop tests for new agent construction. | | tests/LlamaShears.UnitTests/Agent/Core/AgentInterruptTests.cs | Updates interrupt tests for async agent lifecycle. | | tests/LlamaShears.UnitTests/Agent/Core/AgentInterruptGracefulTests.cs | Updates graceful interrupt tests for scoped runner dependencies. | | tests/LlamaShears.UnitTests/Agent/Core/AgentEventPublishingTests.cs | Updates event publishing test harness for new agent services. | | tests/LlamaShears.IntegrationTests/Hosting/IntegrationTestEnvironment.cs | Disables local config during integration tests. | | src/public/LlamaShears.Core.Abstractions/SystemPrompt/WorkspaceFile.cs | Adds workspace file directory path to public record. | | src/public/LlamaShears.Core.Abstractions/Provider/InferenceOutcome.cs | Adds `Suppressed` result flag. | | src/public/LlamaShears.Core.Abstractions/Agent/IAgentStateTracker.cs | Adds agent-state tracking abstraction. | | src/public/LlamaShears.Core.Abstractions/Agent/IAgent.cs | Updates lifecycle interface and removes last-activity surface. | | src/public/LlamaShears.Core.Abstractions/Agent/AgentStateExtensions.cs | Adds data-context accessors for agent state. | | src/public/LlamaShears.Core.Abstractions/Agent/AgentState.cs | Adds per-turn agent state record. | | src/LlamaShears/Program.cs | Adds local-config bypass and DI validation. | | src/LlamaShears/content/templates/workspace/system/DEFAULT.md | Restructures system prompt guidance and workspace file headings. | | src/LlamaShears/content/templates/workspace/system/context/PROMPT.md | Converts runtime metadata prompt to XML-style envelope. | | src/LlamaShears/content/templates/workspace/system/compaction/PROMPT.md | Converts compaction metadata prompt to XML-style envelope. | | src/LlamaShears/content/templates/workspace/MEMORY.md | Removes seeded memory placeholder. | | src/LlamaShears.Core/Tools/ModelContextProtocol/ToolResponseClamp.cs | Raises MCP tool response limits. | | src/LlamaShears.Core/Tools/ModelContextProtocol/ModelContextProtocolClient.cs | Adds success/failure cache for MCP tool lists. | | src/LlamaShears.Core/SystemPrompt/WorkspaceContextDataProvider.cs | Reads workspace files through parser cache and includes path. | | src/LlamaShears.Core/Provider/ModelTextFormatter.cs | Wraps user turns in XML-style message metadata. | | src/LlamaShears.Core/InferenceRunner.cs | Adds `NO_RESPONSE` detection and suppression. | | src/LlamaShears.Core/CoreServiceCollectionExtensions.cs | Registers agent services as scoped and adds scoped model factory. | | src/LlamaShears.Core/ContextCompactor.cs | Uses scoped state/data context and stamps compaction state. | | src/LlamaShears.Core/AgentStateTracker.cs | Implements data-context agent-state writer. | | src/LlamaShears.Core/AgentManager.cs | Moves scope ownership and agent construction flow into manager. | | src/LlamaShears.Core/Agent.cs | Refactors agent loop to resolve per-turn scoped bundle/services. | | src/LlamaShears.Api/Tools/ModelContextProtocol/ModelContextProtocolServiceCollectionExtensions.cs | Adjusts default workspace file protection rules. | | src/LlamaShears.Api.Web/js/scripts/highlight-init.js | Imports highlight.js through bundled module graph. | | src/LlamaShears.Api.Web/js/entries/site.js | Removes global highlight.js pre-import. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/SystemPrompt/WorkspaceFile.md | Regenerates WorkspaceFile API docs. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Provider/InferenceOutcome.md | Regenerates InferenceOutcome API docs. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/index.md | Adds new agent-state API docs entries. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/IAgentStateTracker.md | Adds IAgentStateTracker docs. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/IAgent.md | Updates IAgent docs. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/AgentStateExtensions.md | Adds AgentStateExtensions docs. | | docs/api/LlamaShears.Core.Abstractions/LlamaShears/Core/Abstractions/Agent/AgentState.md | Adds AgentState docs. | | docs/api/LlamaShears.Core.Abstractions/index.md | Adds new public agent-state docs links. | </details> <details> <summary>Comments suppressed due to low confidence (2)</summary> **src/LlamaShears/content/templates/workspace/system/context/PROMPT.md:10** * The channel id is rendered as raw XML text. Because channel ids come from event ids, a publisher/plugin can include XML-sensitive characters and break or spoof the `<runtime_metadata>` envelope; escape the value before inserting it into `<channel>`. ``` {{- if agent_state.channel_id }} <channel>{{ agent_state.channel_id }}</channel> ``` **src/LlamaShears/content/templates/workspace/system/compaction/PROMPT.md:10** * The channel id is rendered as raw XML text. If the active channel id contains XML-sensitive characters, the compaction metadata envelope can become malformed or include spoofed metadata; escape the value before inserting it into `<channel>`. ``` {{- if agent_state.channel_id }} <channel>{{ agent_state.channel_id }}</channel> ``` </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>.
@ -33,1 +34,4 @@
options.Rules.Add(new ProtectedFile("USER.md", ProtectionMode.Delete, FileType.File, "agent root markdown"));
options.Rules.Add(new ProtectedFile("SOUL.md", ProtectionMode.Delete, FileType.File, "agent root markdown"));
options.Rules.Add(new ProtectedFile("TOOLS.md", ProtectionMode.Delete, FileType.File, "agent root markdown"));
options.Rules.Add(new ProtectedFile(".gitignore", ProtectionMode.Delete | ProtectionMode.Write, FileType.File, "workspace .gitignore"));
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-05-16 23:34:49 -04:00

Replacing the root-level *.md delete rule with this allowlist drops delete protection for MEMORY.md, even though the seeded AGENTS.md still treats MEMORY.md as long-term workspace memory. That lets an MCP file-delete call remove the curated memory file; add it to the protected list or keep the broader root-markdown delete rule if the memory file should remain durable.

Replacing the root-level `*.md` delete rule with this allowlist drops delete protection for `MEMORY.md`, even though the seeded AGENTS.md still treats `MEMORY.md` as long-term workspace memory. That lets an MCP file-delete call remove the curated memory file; add it to the protected list or keep the broader root-markdown delete rule if the memory file should remain durable.
@ -333,15 +280,11 @@ public sealed partial class AgentManager : IAgentManager, IHostStartupTask, IEve
var dataProviders = scope.ServiceProvider.GetScopedDataProviders();
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-05-16 23:34:50 -04:00

If any step after CreateContext(config.Id) fails (for example resolving the scoped ILanguageModel when the provider name is invalid), the catch disposes the DI scope but leaves the data context registered in DataContextFactory. Because the factory keeps a weak reference until GC, the next reconcile can fail with “A data context with key ... is already active” instead of retrying cleanly. Delete the context in the failure path once it has been created.

If any step after `CreateContext(config.Id)` fails (for example resolving the scoped `ILanguageModel` when the provider name is invalid), the catch disposes the DI scope but leaves the data context registered in `DataContextFactory`. Because the factory keeps a weak reference until GC, the next reconcile can fail with “A data context with key ... is already active” instead of retrying cleanly. Delete the context in the failure path once it has been created.
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-05-16 23:34:50 -04:00

This resolves and constructs an ILanguageModel during agent startup but then discards it; per-turn processing resolves another model from each turn scope. If a provider model owns resources or performs initialization, the startup instance is kept alive in the agent scope for the agent lifetime without ever being used. Validate the provider configuration without creating the model, or dispose/use this instance intentionally.

This resolves and constructs an `ILanguageModel` during agent startup but then discards it; per-turn processing resolves another model from each turn scope. If a provider model owns resources or performs initialization, the startup instance is kept alive in the agent scope for the agent lifetime without ever being used. Validate the provider configuration without creating the model, or dispose/use this instance intentionally.
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-05-16 23:34:50 -04:00

The new NO_RESPONSE suppression path is not covered by the existing InferenceRunner tests. Please add tests for at least the exact sentinel and split streaming fragments so regressions do not accidentally persist or publish the sentinel as assistant text, and so Suppressed reliably stops the empty-response retry loop.

The new `NO_RESPONSE` suppression path is not covered by the existing InferenceRunner tests. Please add tests for at least the exact sentinel and split streaming fragments so regressions do not accidentally persist or publish the sentinel as assistant text, and so `Suppressed` reliably stops the empty-response retry loop.
@ -24,3 +25,4 @@
}
sb.Append("</message_metadata>\n");
sb.Append(turn.Content);
return sb.ToString();
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-05-16 23:34:49 -04:00

ChannelId is written into the new XML envelope without XML escaping. If a channel id supplied by another publisher/plugin contains characters like <, &, or a closing tag, it can make the metadata malformed or inject additional metadata-looking content that the system prompt treats as authoritative. Escape this value before appending it to the envelope.

`ChannelId` is written into the new XML envelope without XML escaping. If a channel id supplied by another publisher/plugin contains characters like `<`, `&`, or a closing tag, it can make the metadata malformed or inject additional metadata-looking content that the system prompt treats as authoritative. Escape this value before appending it to the envelope.
@ -8,3 +6,1 @@
- Current day of week: {{ day_of_week }}
{{- if channel_id }}
- Channel: {{ channel_id }}
<current_datetime>{{ now | format_datetimeoffset 'yyyy-MM-ddTHH:mm:sszzz' }}</current_datetime>
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-05-16 23:34:49 -04:00

important_message is inserted into the XML metadata as raw text. If it contains XML-sensitive characters or closing tags, the generated envelope becomes malformed or can inject metadata-looking content; escape it before rendering into <important>.

This issue also appears on line 9 of the same file.

`important_message` is inserted into the XML metadata as raw text. If it contains XML-sensitive characters or closing tags, the generated envelope becomes malformed or can inject metadata-looking content; escape it before rendering into `<important>`. This issue also appears on line 9 of the same file.
@ -8,3 +6,1 @@
- Current day of week: {{ day_of_week }}
{{- if channel_id }}
- Channel: {{ channel_id }}
<current_datetime>{{ now | format_datetimeoffset 'yyyy-MM-ddTHH:mm:sszzz' }}</current_datetime>
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-05-16 23:34:50 -04:00

important_message is now emitted inside an XML element without escaping. A value containing <, &, or a closing tag can corrupt the runtime metadata envelope or inject metadata-looking text that the prompt treats as authoritative; escape it before rendering.

This issue also appears on line 9 of the same file.

`important_message` is now emitted inside an XML element without escaping. A value containing `<`, `&`, or a closing tag can corrupt the runtime metadata envelope or inject metadata-looking text that the prompt treats as authoritative; escape it before rendering. This issue also appears on line 9 of the same file.
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-05-16 23:34:49 -04:00

These values are now embedded as XML attributes/text but are rendered without XML escaping. Memory paths/summaries can come from user-authored files, so characters like &, <, quotes, or closing tags can break the metadata envelope or inject metadata-looking directives. Escape XML-sensitive values before rendering them into <runtime_metadata>.

These values are now embedded as XML attributes/text but are rendered without XML escaping. Memory paths/summaries can come from user-authored files, so characters like `&`, `<`, quotes, or closing tags can break the metadata envelope or inject metadata-looking directives. Escape XML-sensitive values before rendering them into `<runtime_metadata>`.
@ -9,3 +9,3 @@
/// </summary>
public interface IAgent : IDisposable
public interface IAgent : IAsyncDisposable, IDisposable
{
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-05-16 23:34:48 -04:00

Removing LastActivity from the public IAgent interface is a breaking change for any package consumer implementing or calling this abstraction. If the property is no longer used internally, keep a compatible member (possibly obsolete) or coordinate this with an explicit breaking-version release.

Removing LastActivity from the public IAgent interface is a breaking change for any package consumer implementing or calling this abstraction. If the property is no longer used internally, keep a compatible member (possibly obsolete) or coordinate this with an explicit breaking-version release.
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-05-16 23:34:48 -04:00

This changes the public WorkspaceFile positional record constructor from (Name, Content) to (Name, Path, Content), which will break source and binary compatibility for consumers of the packable Core.Abstractions package. Consider preserving the old constructor/property shape (for example with an overload or additive property) or gating this with an explicit breaking-version change.

This changes the public WorkspaceFile positional record constructor from (Name, Content) to (Name, Path, Content), which will break source and binary compatibility for consumers of the packable Core.Abstractions package. Consider preserving the old constructor/property shape (for example with an overload or additive property) or gating this with an explicit breaking-version change.
Sign in to join this conversation.
No description provided.