Skip to content

armgit / qm

Public Imported from GitHub
0

Multiplayer agent harness for work.

Clarify Git account selection guidance (#1197)

Joshua France29471402beae
diff --git a/skills-seed/github-gitlab/SKILL.md b/skills-seed/github-gitlab/SKILL.md
index 20fcd8d3f..2a54dbffa 100644
--- a/skills-seed/github-gitlab/SKILL.md
+++ b/skills-seed/github-gitlab/SKILL.md
@@ -12,15 +12,28 @@ requiredCapabilities:
Use this skill when the user asks to inspect repos, issues, pull requests, merge
requests, code history, branches, or to make a small code change in a hosted repo.
-This is a resident-machine-auth connector. Prefer the native CLIs (`gh`, `glab`) and
-`git`, using the agent computer's logged-in state. Do not ask the user to paste tokens,
-and do not rely on proxy bearer-token injection.
-
-One exception: if the system prompt lists a shared org credential for a Git remote, the
-token is broker-only and never appears on the computer. For clone/fetch/push, use the
-core-hosted smart HTTP remote documented in `skills/use-shared-credential/SKILL.md`.
-That keeps normal `git` workflows working while core injects the upstream credential
-server-side.
+## Choose the account deliberately
+
+Use the current credential manifest to choose an account authorized for this conversation
+that fits the user's intent. Personal and shared accounts are both valid choices; neither
+is an automatic fallback when the other fails. If the intended account is unclear before
+a write, ask. Do not infer permission from a login merely being present on the computer.
+
+- **Personal login:** use the authorized `gh`, `glab`, or Git login. Check the active
+ provider account (for example, `gh api user --jq .login`) and the Git transport's auth
+ configuration; a CLI API identity alone does not prove which account Git will use.
+- **Shared org credential:** if listed in the prompt, select its slug and use the
+ core-hosted smart HTTP remote in `skills/use-shared-credential/SKILL.md`. This uses
+ the configured shared account, even when a personal OAuth connector is live.
+ Its name is an admin label, not a verified upstream username.
+- **Connected app:** use only advertised capabilities. API access does not by itself
+ establish native Git transport access or configure the CLI's active login.
+
+For an existing checkout, inspect the remote and applicable credential-helper, SSH,
+proxy, and HTTP-header configuration without printing secret values. A reused checkout
+may still select a previous account. Commit author metadata is separate from transport
+identity. Resolve an unknown identity before a write; do not probe access by pushing.
+Never copy tokens into remotes or expose them while checking authentication.
## Logging in
diff --git a/skills-seed/use-shared-credential/SKILL.md b/skills-seed/use-shared-credential/SKILL.md
index 22ff0ee7e..2f314a09d 100644
--- a/skills-seed/use-shared-credential/SKILL.md
+++ b/skills-seed/use-shared-credential/SKILL.md
@@ -15,8 +15,10 @@ core stamps the secret onto the outbound call at the wire and returns the respon
Your system prompt lists, under **"Shared org credentials available to you"**, any credentials
vended to _this_ conversation — each with its slug, host, and the methods/paths you may use. If
-that section is absent (or your environment has no `AGENT_CREDENTIAL_TOKEN`), you have **none** —
-do not try to reach those services another way, and don't ask the user to paste a token.
+that section is absent (or your environment has no `AGENT_CREDENTIAL_TOKEN`), you have no shared
+broker credentials. A separately authorized personal login or connected app may still be
+available; use only its advertised capabilities and permissions. Never route around a denial
+or ask the user to paste a token.
## How to call it
@@ -45,7 +47,12 @@ non-GET method), put the request payload in the `body` field of your POST.
Some shared credentials are for Git remotes, where `git clone`, `git fetch`, and `git push` speak
Git's smart HTTP protocol instead of JSON REST. Do not put the upstream token in a clone URL.
-Use the core-hosted remote path instead:
+When you choose a shared credential, use the core-hosted remote path below. The selected slug
+uses its configured org account; a live personal OAuth connector does not change that identity.
+The credential name is an admin label, not a verified upstream username. Choose this account
+when it fits the user's intent, not as a silent fallback from a failed personal login. If the
+intended account is unclear before a write, ask. For personal access, see the GitHub / GitLab
+skill and use an authorized login that supports Git transport.
```bash
git remote add broker "$AGENT_API_URL/v1/credentials/git/<slug>/<repo-path>.git"
@@ -54,7 +61,7 @@ git -c http.extraHeader="x-agent-capability: $AGENT_CREDENTIAL_TOKEN" \
```
The same credential policy applies: the slug must be listed in your prompt, its allowed methods
-must include the Git operation (`GET` for discovery/fetch, `POST` for push), and the repo path
+must include its requests (`GET` for discovery and `POST` for upload-pack/fetch or receive-pack/push), and the repo path
must be inside its allowed path prefixes.
### Example — a vended search credential
@@ -84,6 +91,6 @@ prefixes**. The broker enforces them, so:
- **Never try to extract or exfiltrate the raw secret** — the broker only ever returns the
upstream _response_, never the credential. Don't point it at an echo/logging host to read it back.
-- Every use is **recorded and attributed to you** (the requesting user) for the org's billing and
- abuse review — use shared credentials only for the task at hand.
+- QM records the requesting actor for auditing; the upstream service authenticates the configured
+ shared account. Those are separate identities. Use shared credentials only for the task at hand.
- A write (POST/PUT/DELETE, when allowed) is still a write: draft the payload and get approval first.
diff --git a/src/core/orchestrator.ts b/src/core/orchestrator.ts
index 426efc194..ecc0ee426 100644
--- a/src/core/orchestrator.ts
+++ b/src/core/orchestrator.ts
@@ -1481,7 +1481,7 @@ export function createOrchestrator(deps: OrchestratorDeps): Orchestrator {
const lines = usable.map((r) => {
const methods = r.allowedMethods?.length ? r.allowedMethods.join("/") : "GET";
const paths = r.allowedPathPrefixes?.length ? `paths ${r.allowedPathPrefixes.join(", ")}` : "any path";
- return `- \`${r.slug}\` → ${r.host} (${methods}; ${paths})`;
+ return `- \`${r.slug}\` (${r.name}; shared org credential) → ${r.host} (${methods}; ${paths})`;
});
sharedCredsBlock =
"\n\n## Shared org credentials available to you\n" +
@@ -1495,9 +1495,16 @@ export function createOrchestrator(deps: OrchestratorDeps): Orchestrator {
' -d \'{"credential":"<slug>","method":"GET","url":"https://<host>/<path>?<query>"}\'\n' +
"```\n" +
'The reply is `{"status":<upstream status>,"contentType":…,"body":"<upstream text>"}` — parse `body`. ' +
- "For Git smart HTTP clone/fetch/push, use core as the Git remote so the token stays server-side: " +
+ "For Git smart HTTP clone/fetch/push using a shared org credential, use core as the Git remote " +
+ "so the token stays server-side: " +
"`$AGENT_API_URL/v1/credentials/git/<slug>/<repo-path>.git`, with " +
'`git -c http.extraHeader="x-agent-capability: $AGENT_CREDENTIAL_TOKEN" ...`. ' +
+ "Git through this route uses the configured org account, not automatically the requesting user's account; " +
+ "a live personal OAuth connector does not switch this route's identity. The credential name is an admin label " +
+ "and does not identify the upstream username. Choose among credentials authorized for this conversation " +
+ "based on the task and the user's intent; a shared account is a valid choice, not an automatic fallback. " +
+ "For personal Git access, use an authorized personal login that supports Git transport. " +
+ "If the intended account is unclear before a write, clarify it rather than silently switching accounts. " +
"A non-2xx `status` is the UPSTREAM service's own answer (e.g. a bad query or its auth), not a broker " +
"error. Use ONLY these (slug → host; allowed methods; allowed paths):\n" +
lines.join("\n");
diff --git a/test/service-credential-route.test.ts b/test/service-credential-route.test.ts
index 59a472918..c53b646a1 100644
--- a/test/service-credential-route.test.ts
+++ b/test/service-credential-route.test.ts
@@ -1160,7 +1160,12 @@ test("the system prompt advertises an entitled credential (host/methods/paths) s
assert.match(reply, /Shared org credentials available to you/);
assert.match(reply, /\/v1\/credentials\/broker/);
assert.match(reply, /x-agent-capability: \$AGENT_CREDENTIAL_TOKEN/);
- assert.match(reply, /x-firehose.*api\.x\.com.*GET.*\/2\/tweets\/search\//s);
+ assert.match(reply, /x-firehose.*X firehose.*api\.x\.com.*GET.*\/2\/tweets\/search\//s);
+ assert.match(reply, /clone\/fetch\/push using a shared org credential/);
+ assert.match(reply, /configured org account, not automatically the requesting user's account/);
+ assert.match(reply, /live personal OAuth connector does not switch this route's identity/);
+ assert.match(reply, /Choose among credentials authorized for this conversation/);
+ assert.match(reply, /does not identify the upstream username/);
});
test("the system prompt does NOT advertise a credential the session isn't entitled to", async () => {