feat(cli,mcp): take the requester id from the agent session - #165
Conversation
Without --agent-id or SIMLOCK_AGENT_ID, the CLI and simlock mcp now use the Claude Code or Codex session id as <tool>:<id> before falling back to the pid. One shared resolveRequesterId in src/agent-identity replaces the two copies of that rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E7hp6xYT1cA3BXRYiUukby
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E7hp6xYT1cA3BXRYiUukby
…rity Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E7hp6xYT1cA3BXRYiUukby
Manual verification (real iOS simulators, inside a Claude Code session)All four checks pass on
Not covered: the gateway passthrough case ( |
Known limitation:
|
Closes #158
Without
--agent-idorSIMLOCK_AGENT_ID, the CLI andsimlock mcpnow useCLAUDE_CODE_SESSION_IDasclaude-code:<id>orCODEX_SESSION_IDascodex:<id>, then the pid as before. OneresolveRequesterIdin the newsrc/agent-identityreplaces the two copies of the rule. Docs updated indocs/CLI.mdandREADME.md.Beyond the three comments the spec named, two more comments and one
docs/CLI.mdsentence were fixed because the change made them false.Completion conditions
simlock leasein one Claude Code session, and one Codex session: same requester, second getsREQUESTER_ALREADY_LEASEDnaming the first lease. Checked with a throwaway e2e run against the fake driver.lease --detachthensimctlwith no--leaseruns on that device; another session's id is refused. Same throwaway e2e run.statusandlist --leasesshowclaude-code:<id>/codex:<id>. Same run.simlock mcpleases under the CLI's id; a CLI lease after it getsREQUESTER_ALREADY_LEASED. Same run, plus the unit test "the CLI and simlock mcp resolve the same session-derived requester id".SIMLOCK_AGENT_IDbeats the session id;--agent-idbeats both. Unit tests and the e2e run.simlock mcp", README "MCP integration".Checks: typecheck, typecheck:e2e, lint, format:check, unit (1872 passed), e2e (60 passed). Every new path was broken and failed on a named assertion.
Review
Spec review: 4 findings, 1 fixed. Code review: 9 findings, 5 fixed.
Rejected:
simlock mcpin one session now share one requester and one lease (raised twice) — this is the specified outcome.SIMLOCK_AGENT_IDresolves to""and no test pins it — unchanged behaviour; the spec keeps "defined wins, as today".process.envthrough, so under an agent tool e2e runs as the session id — out of scope here; the suite passes with and without the variable.Written by an agent.
🤖 Generated with Claude Code
https://claude.ai/code/session_01E7hp6xYT1cA3BXRYiUukby
Generated by Claude Code