Skip to content

Commit

Pull requests: unnamed, a pull request is its author's, not an agent's

A pull request opened through the API or MCP without `agent` was labelled "agent", so rules for agents only held for a person's script too. Left out, the label is now the author's username, and "agent" only when an agent's token opens it; the same in the work service for any caller. The rules guide and the parameter say so.

syntaqxcommitted Parent73ab43aBrowse files
4 files+10−50/4 viewed
+4−2
21802180 },
21812181 "agent": {
21822182 "type": "string",
2183− "description": "A label for the agent doing the work, e.g. \"claude-code\".",
2183+ "description": "A label for the agent doing the work, e.g. \"claude-code\". Left out, the pull request is its author's (or \"agent\" when an agent's token opens it).",
21842184 },
21852185 "base": {
21862186 "type": "string",
39983998 title: text(input, "title"),
39993999 body: text(input, "body"),
40004000 branch: optional_text(input, "branch"),
4001− agent: optional_text(input, "agent").unwrap_or_else(|| "agent".into()),
4001+ // Unnamed, the change is its author's, unless an agent's token opened it.
4002+ agent: optional_text(input, "agent")
4003+ .unwrap_or_else(|| if g1t_contracts::rules::is_agent(&user) { "agent".into() } else { user.username.clone() }),
40024004 runtime: Runtime::External,
40034005 base: optional_text(input, "base"),
40044006 },
+3−2
117117 default. `applies_to` is `everyone` (the default), `agents` or `people`.
118118
119119 A change counts as an agent's when it is pushed with an agent's token, or
120−when its pull request was made by g1t or opened with an agent label through
121−the API or MCP. A pull request a person opens on the site is a person's.
120+when its pull request was made by g1t, opened with an agent's token, or opened
121+naming an agent (`agent`) through the API or MCP. A pull request a person
122+opens on the site, or through the API without naming an agent, is a person's.
122123
123124 ### Branches and tags
124125
+0−0

Binary or large file; its contents are not shown.

+3−1
10541054 Err(message) => return Ok(Outcome::fail(FailureCode::Invalid, message)),
10551055 },
10561056 };
1057+ // Unnamed, the change is its author's, unless an agent opened it.
10571058 let agent = match a.agent.trim() {
1058− "" => "agent",
1059+ "" if g1t_contracts::rules::is_agent(&a.actor) => "agent",
1060+ "" => a.actor.username.as_str(),
10591061 agent => agent,
10601062 };
10611063 let runtime = match a.runtime {