Skip to content
Merged
8 changes: 8 additions & 0 deletions .changeset/patch-fix-safe-inputs-copilot-cli.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .changeset/patch-fix-safe-inputs-copilot.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 11 additions & 6 deletions .github/workflows/copilot-pr-merged-report.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion .github/workflows/daily-performance-summary.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 10 additions & 5 deletions .github/workflows/dev.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 11 additions & 6 deletions .github/workflows/smoke-copilot-no-firewall.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 11 additions & 6 deletions .github/workflows/smoke-copilot-playwright.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 11 additions & 6 deletions .github/workflows/smoke-copilot-safe-inputs.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 11 additions & 6 deletions .github/workflows/smoke-copilot.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion .github/workflows/test-python-safe-input.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions pkg/workflow/js/safe_inputs_mcp_server.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const { bootstrapSafeInputsServer, cleanupConfigFile } = require("./safe_inputs_
* @param {string} configPath - Path to the configuration JSON file
* @param {Object} [options] - Additional options
* @param {string} [options.logDir] - Override log directory from config
* @param {boolean} [options.skipCleanup] - Skip deletion of config file (useful for stdio mode with agent restarts)
*/
function startSafeInputsServer(configPath, options = {}) {
// Create server first to have logger available
Expand All @@ -67,8 +68,10 @@ function startSafeInputsServer(configPath, options = {}) {
registerTool(server, tool);
}

// Cleanup: delete the configuration file after loading
cleanupConfigFile(configPath, server);
// Cleanup: delete the configuration file after loading (unless skipCleanup is true)
if (!options.skipCleanup) {
cleanupConfigFile(configPath, server);
}

// Start the server
start(server);
Expand Down
19 changes: 14 additions & 5 deletions pkg/workflow/safe_inputs.go
Original file line number Diff line number Diff line change
Expand Up @@ -407,12 +407,16 @@ const { startSafeInputsServer } = require("./safe_inputs_mcp_server.cjs");
const configPath = path.join(__dirname, "tools.json");

// Start the stdio server
startSafeInputsServer(configPath, {
logDir: "/tmp/gh-aw/safe-inputs/logs"
}).catch(error => {
// Note: skipCleanup is true for stdio mode to allow agent restarts
try {
startSafeInputsServer(configPath, {
logDir: "/tmp/gh-aw/safe-inputs/logs",
skipCleanup: true
});
} catch (error) {
console.error("Failed to start safe-inputs stdio server:", error);
process.exit(1);
});
}
`)
} else {
// HTTP transport - server started in separate step
Expand Down Expand Up @@ -641,7 +645,12 @@ func renderSafeInputsMCPConfigWithOptions(yaml *strings.Builder, safeInputs *Saf
// Choose transport based on mode
if IsSafeInputsStdioMode(safeInputs) {
// Stdio transport configuration - server started by agent
yaml.WriteString(" \"type\": \"stdio\",\n")
// Use "local" for Copilot CLI, "stdio" for other engines
typeValue := "stdio"
if includeCopilotFields {
typeValue = "local"
}
yaml.WriteString(" \"type\": \"" + typeValue + "\",\n")
yaml.WriteString(" \"command\": \"node\",\n")
yaml.WriteString(" \"args\": [\"/tmp/gh-aw/safe-inputs/mcp-server.cjs\"],\n")

Expand Down
Loading
Loading