luigidemasi commented on code in PR #149:
URL: https://github.com/apache/camel-kit/pull/149#discussion_r4512392009


##########
kit/camel-kit-core/src/main/java/org/apache/camel/kit/generator/OpenCodeGenerator.java:
##########
@@ -30,22 +49,284 @@ public void generate(InitContext ctx) throws Exception {
         Map<String, Object> data = new HashMap<>(
                 Map.of(
                         "COMMAND_PREFIX", ctx.commandPrefix()));
-        // AGENTS.md already generated by the shared generator flow.
+
+        McpInventory inventory = readMcpInventory(ctx);

Review Comment:
   [P1] Invalidate the worker before project-config validation can abort
   
   The new guard runs after both `preflight()` and `super.generate()`. For 
project-local config, `OpenCodeConfigMerger.validateExisting()` or `merge()` 
parses the raw text first and can throw before this inventory is read or the 
old worker is removed. OpenCode [substitutes before 
parsing](https://github.com/anomalyco/opencode/blob/v2.2.5/packages/core/src/config/variable.ts),
 so `{"mcp":{env:MCP_SERVERS}}` is valid for the host when `MCP_SERVERS` 
contains an MCP-server object.
   
   I initialized a workspace, then supplied this config before 
reinitialization, separately in `opencode.json` and `.opencode/opencode.json`. 
In both cases the actual CLI exits 1 and leaves 
`.opencode/agents/camel-ship-worker.md` byte-for-byte unchanged without 
`probe_*: deny`. With the same config present, an actual OpenCode 2.2.5 worker 
child calls `probe.mark` through `execute` and writes the harmless canary. 
Matching namespace-denial controls block both cases. The inline and 
explicit-file variants now correctly remove the worker.
   
   Invalidate the installed worker before project-config preflight/merging can 
abort, or ensure both failure paths remove it while preserving config 
validation. Add init/reinit regression coverage for root and nested project 
sources containing substitutions that produce JSON structure.
   
   _AI-generated by Codex on behalf of @luigidemasi._



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to