OneCLI gateway: ownership check uses group existence, not installation identity
Confirmation
- I confirm that this is not an exploitable vulnerability and can be discussed in public.
What should be safer?
NanoClaw registers each agent group with OneCLI as ensureAgent({ name, identifier: agentGroupId }) (src/gateway-providers/onecli.ts:76 on main). The identifier carries nothing about which install it belongs to. Group ids are ag-${randomUUID()} (src/templates/create-agent.ts:99, src/cli/resources/groups.ts:211), so fresh installs never collide. The collision happens when two installs share one local OneCLI gateway and one install's data/ (the SQLite DB) was copied from the other, for example when someone clones a working install to try a branch. The two copies then hold the same group ids, and OneCLI treats their groups as one agent:
- Both copies use the same OneCLI agent, and so the same container config and whatever OneCLI has attached to that identifier.
- With the gateway stack in #3815–#3818, approval ownership becomes "this group id exists in my DB" (
src/gateway-approval-coordinator.ts:216,GatewayApprovalScope.ownsAgentGroup). Both copies pass that check for the shared ids. When copy A (re)starts, it takes copy B's pending request as its own stale request and submitsdeny. Copy B's approval card is then dead.
What should be more resilient: the OneCLI agent identifier should name the install as well as the group, so two installs sharing a gateway cannot claim each other's agents or approvals, whatever they did with their data/.
Constraints on a fix:
- OneCLI identifiers are 1–50 chars of lowercase letters, digits and hyphens (@onecli-sh/sdk 2.2.1 README,
createAgent).ag-<uuid>is already 39 chars, so<slug>-<groupId>doesn't fit. The fix needs a short install-scoped prefix or a hash. - Changing the identifier moves every existing install onto new OneCLI agents. The upgrade has to carry over (or re-create) whatever is attached to the old identifier, and the approval ownership check has to accept both forms during the transition. That needs its own migration and review, which is why it was left out of the gateway stack.
- The copied-DB setup may be unsupported. If so, this can instead be a documented limitation plus a startup check that warns when another install is using the same gateway with the same group ids.
How can we verify the concern?
Needs a local configuration choice (a copied data/ directory); no host access or source changes.
- Install NanoClaw in checkout A with the local OneCLI gateway and create an agent group.
- Copy A to checkout B, including
data/, and point B at the same OneCLI. - On main: both checkouts call
ensureAgentwith the same identifier.ensureAgentreturns the existing agent when the identifier is taken (SDK README), so B shares A's OneCLI agent. This step follows from the code and the SDK docs; it was not run live. - With #3815–#3818 applied: trigger a gated request from B, then restart A before approving it. A submits
denyfor B's request.
A unit-level repro of step 4 drives the real @onecli-sh/sdk 2.2.1 ApprovalClient poller. Two copies both own ag-shared, and copy A's decisions on copy B's stale request are [{"id":"from-copy-b","decision":"deny"}]. Verified 2026-09-23 at e692148d and again on the stack merged onto main 8aefde46.
Affected version
main 8aefde46 (shared OneCLI agent); gateway stack #3815–#3818 at e692148d (approval denial)
AI assistance
Yes. I verified it myself and can explain it
AI assistance details
Claude Code (with an OpenAI Codex adversarial pass) raised the approval-ownership case during review of #3815–#3818, wrote the unit repro, and traced the identifier path and SDK constraints. I reviewed the findings.
Related trust boundary
- Credentials
- Human approval
Source: nanocoai/nanoclaw