fix(mcp-server): setup_command references real module, not broken path

The get_remote_agent_setup_command handler emitted
\`python3 -m examples.remote-agent.run\` — an invalid Python module path
(dashes not allowed in module names), so the command never actually
worked. Replace with a direct \`python3 -c "..."\` snippet that imports
from \`molecule_agent\` (the real SDK module) and points to the demo
script for reference.

Fixes the pre-existing jest failure in \`handleGetRemoteAgentSetupCommand
emits bash for external workspace\` that was flagged against PR #2.
Updates test expectation to \`molecule_agent\` (the actual importable
module name) from the never-valid \`molecule-agent\`.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Hongming Wang 2026-04-13 14:09:21 -07:00
parent dae07d61fd
commit 7e76340a2b
2 changed files with 7 additions and 2 deletions

View File

@ -1083,7 +1083,7 @@ describe("Phase 30 remote-agent tools", () => {
expect(body.workspace_name).toBe("remote-1");
expect(body.setup_command).toContain("WORKSPACE_ID=ws-ext");
expect(body.setup_command).toContain("PLATFORM_URL=");
expect(body.setup_command).toContain("molecule-agent");
expect(body.setup_command).toContain("molecule_agent");
});
test("handleCheckRemoteAgentFreshness fresh when heartbeat is recent", async () => {

View File

@ -94,8 +94,13 @@ export async function handleGetRemoteAgentSetupCommand(params: {
``,
`WORKSPACE_ID=${w.id} \\`,
`PLATFORM_URL=${targetUrl} \\`,
`python3 -m examples.remote-agent.run`,
`python3 -c "from molecule_agent import RemoteAgentClient; \\`,
` c = RemoteAgentClient.register_from_env(); \\`,
` c.pull_secrets(); \\`,
` c.run_heartbeat_loop()"`,
``,
`# For a richer demo (logging, graceful shutdown) see`,
`# sdk/python/examples/remote-agent/run.py in the molecule-monorepo checkout.`,
`# The agent will register, mint its bearer token (cached at`,
`# ~/.molecule/${w.id}/.auth_token), pull secrets, then heartbeat.`,
].join("\n");