{"issue":{"id":7,"title":"Allow agents to request explicit grants when starting abso login","authorship":{"title":{"kind":"unknown","actor":null,"provenance":"unknown","authorField":null},"description":{"kind":"unknown","actor":null,"provenance":"unknown","authorField":null}},"parent":null,"status":"open","agent":"codex-mac-1","agents":[],"blockedBy":[],"labels":[],"versions":[],"waitingOn":[],"opened":{"by":"codex-mac-1","at":1791679622342,"atIso":"2026-10-11T00:47:02.342Z"},"updated":1791680713156,"closed":null,"children":0,"description":"An agent usually starts abso login and gives the user a link to approve. Today the CLI cannot specify the requested projects, roles, agent limit, or expiry, so the user must construct the grant on the website without that context. In this cloud onboarding, the intended projects were abso, abso-website, abso-core, and abso-ops, with agent seat codex-mac-1. Add login options for requested grants and carry them into the device authorization flow. The approval page should prefill and clearly summarize the request; the user must be able to narrow or reject it, and nothing is granted until approval. Validate grant inputs, document the options, preserve current behavior when omitted, and test request propagation and approval boundaries. Coordinate with the abso-website ticket for the grants-page UX.","lines":null,"watchers":["codex-mac-1"]},"comments":[{"id":2,"by":"codex-mac-1","kind":"comment","text":"Related website work: abso-website #238 covers the box-login grants approval UX and prefilling requested grants. codex-bootstrap has been notified from codex-mac-1.","authorship":{"kind":"unknown","actor":null,"provenance":"unknown","authorField":null},"at":1791679663143,"atIso":"2026-10-11T00:47:43.143Z"},{"id":3,"by":"codex-mac-1","kind":"comment","text":"Published the client request support in version 102. Login now accepts --projects, --role, --max-agents and --days, validates them before network access, and sends optional requested_grant fields on /login/device. Omitted flags preserve the existing request. Tests confirm that only the actual user-approved grant is stored, including narrower approval. The 21 affected test files, TypeScript check and changed-file lint passed. End-to-end completion still requires server-side request handling and approval-page prefilling; this issue stays open until those are verified.","authorship":{"kind":"unknown","actor":null,"provenance":"unknown","authorField":null},"at":1791680712269,"atIso":"2026-10-11T01:05:12.269Z"}],"edits":[],"asks":[],"claims":[],"children":[],"publicProjects":[],"fileRefs":{},"parent":null,"change":{"id":1193,"agent":"codex-mac-1","title":"Add requested grant options to login","kind":"note","note":{"text":"Add requested grant options to login","files":["client/README.md","client/src/box.ts","client/src/main.ts","client/test/box.test.ts"]},"issue":7,"draft":null,"time":1791680607029,"timeIso":"2026-10-11T01:03:27.029Z","open":false,"versions":[{"version":102,"draft":null,"message":"Let login request projects, roles, agent limits and duration","time":1791680699999,"timeIso":"2026-10-11T01:04:59.999Z","files":["client/README.md","client/src/box.ts","client/src/main.ts","client/test/box.test.ts"]}],"files":["client/README.md","client/src/box.ts","client/src/main.ts","client/test/box.test.ts"],"settled":[],"refusals":[],"notes":[],"reviewers":[]},"detail":{"diff":{"from":101,"to":102,"files":[{"path":"client/README.md","added":17,"removed":0,"diff":"--- a/client/README.md\n+++ b/client/README.md\n@@ -32,6 +32,23 @@\n \n ## Setting up a folder\n \n+### Requesting access at login\n+\n+An agent can request the access it needs when starting a box login:\n+\n+```bash\n+abso login --projects alpha,beta --role writer --max-agents 1 --days 30 --no-browser\n+```\n+\n+The client sends a `requested_grant` with the device request: `projects`\n+(each with `project` and `role`), `max_agents`, and `days`. Only supplied\n+fields are sent; project roles default to `writer`. The role option requires\n+projects. Agent limits range from 1 to 50 and durations from 1 to 90 days.\n+The person approving still chooses the actual grant and can narrow or reject\n+the request. Servers must support requested grants to prefill their approval\n+page; older servers may ignore the suggestions. Without these options, login\n+works as before. The request itself never authorizes access.\n+\n Folders and machines set up before abso had its name keep working: the older \n `.avcs/` folder, `~/.avcs/` files, `AVCS_` environment names and `.avcsignore` are \n read when the new ones are not there. New things are written under the new names."},{"path":"client/src/box.ts","added":43,"removed":2,"diff":"--- a/client/src/box.ts\n+++ b/client/src/box.ts\n@@ -12,7 +12,7 @@\n import { chmodSync, existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from \"node:fs\";\n import { homedir, hostname } from \"node:os\";\n import { dirname, join } from \"node:path\";\n-import { UsageError } from \"./args.ts\";\n+import { type Parsed, str, UsageError } from \"./args.ts\";\n import { homeFile, homeWritePath, OLD_STATE_DIR, STATE_DIR } from \"./state-dir.ts\";\n \n /** What the person who approved the code allowed: each project with the highest role its agents get there, and how many agents. */\n@@ -21,6 +21,40 @@\n \treadonly max_agents: number;\n }\n \n+/** Requested access is a suggestion for the person approving, never an authorization. */\n+export interface LoginRequest {\n+\treadonly projects?: readonly { readonly project: string; readonly role: \"reader\" | \"writer\" | \"owner\" }[];\n+\treadonly max_agents?: number;\n+\treadonly days?: number;\n+}\n+\n+export function loginRequest(args: Parsed): LoginRequest | undefined {\n+\tconst projects = str(args, \"projects\");\n+\tconst role = str(args, \"role\");\n+\tconst maxAgents = str(args, \"max-agents\");\n+\tconst days = str(args, \"days\");\n+\tif (projects === undefined && role === undefined && maxAgents === undefined && days === undefined) return undefined;\n+\tif (role !== undefined && projects === undefined) throw new UsageError(\"--role needs --projects\");\n+\tconst requestedRole = role ?? \"writer\";\n+\tif (requestedRole !== \"reader\" && requestedRole !== \"writer\" && requestedRole !== \"owner\")\n+\t\tthrow new UsageError(\"--role is reader, writer or owner\");\n+\tconst names = projects?.split(\",\").map((name) => name.trim());\n+\tif (names && (names.length > 100 || names.some((name) => !/^[A-Za-z0-9._-]+$/.test(name))))\n+\t\tthrow new UsageError(\n+\t\t\t\"--projects is a comma-separated list of up to 100 project names (letters, digits, dot, dash and underscore)\",\n+\t\t);\n+\tconst integer = (value: string, name: string, max: number): number => {\n+\t\tif (!/^[0-9]+$/.test(value) || !Number.isInteger(Number(value)) || Number(value) < 1 || Number(value) > max)\n+\t\t\tthrow new UsageError(`--${name} is from 1 to ${max}`);\n+\t\treturn Number(value);\n+\t};\n+\treturn {\n+\t\t...(names ? { projects: [...new Set(names)].map((project) => ({ project, role: requestedRole })) } : {}),\n+\t\t...(maxAgents === undefined ? {} : { max_agents: integer(maxAgents, \"max-agents\", 50) }),\n+\t\t...(days === undefined ? {} : { days: integer(days, \"days\", 90) }),\n+\t};\n+}\n+\n export interface BoxRecord {\n \treadonly server: string;\n \treadonly id: string;\n@@ -205,6 +239,7 @@\n const STILL_WAITING_MS = 60_000;\n \n export interface LoginIo {\n+\treadonly request?: LoginRequest;\n \treadonly fetch?: typeof fetch;\n \treadonly sleep?: (ms: number) => Promise<void>;\n \treadonly now?: () => number;\n@@ -222,7 +257,13 @@\n \tconst fetcher = io.fetch ?? fetch;\n \tconst sleep = io.sleep ?? ((ms) => new Promise((done) => setTimeout(done, ms)));\n \tconst now = io.now ?? Date.now;\n-\tconst start = await call(server, \"/login/device\", { name: boxName(), client: \"abso\" }, undefined, fetcher);\n+\tconst start = await call(\n+\t\tserver,\n+\t\t\"/login/device\",\n+\t\t{ name: boxName(), client: \"abso\", ...(io.request ? { requested_grant: io.request } : {}) },\n+\t\tundefined,\n+\t\tfetcher,\n+\t);\n \tconst { device_code: device, user_code: code, verification_uri_complete: link } = start.body;\n \tlet interval = Number(start.body.interval) || 5;\n \t// The server says when its code runs out; a server that says never still gets an end."},{"path":"client/src/main.ts","added":12,"removed":3,"diff":"--- a/client/src/main.ts\n+++ b/client/src/main.ts\n@@ -7,7 +7,7 @@\n import { ApiError } from \"./api.ts\";\n import { bool, type FlagSpec, type Parsed, parseArgs, str, UsageError } from \"./args.ts\";\n import { bodyFilesHelp, readBodyFiles, withBodyFiles } from \"./body-files.ts\";\n-import { boxPublic, boxText, login, logout, readBox } from \"./box.ts\";\n+import { boxPublic, boxText, login, loginRequest, logout, readBox } from \"./box.ts\";\n import { runDiff, runFiles, runLog, runRestore, runShow } from \"./changes.ts\";\n import { runCheckIgnore } from \"./check-ignore.ts\";\n import { runCi } from \"./ci.ts\";\n@@ -174,8 +174,16 @@\n \t\t},\n \t},\n \tlogin: {\n-\t\tflags: { server: \"string\", \"no-browser\": \"boolean\" },\n-\t\tusage: \"abso login [--server <url>] [--no-browser]\",\n+\t\tflags: {\n+\t\t\tserver: \"string\",\n+\t\t\t\"no-browser\": \"boolean\",\n+\t\t\tprojects: \"string\",\n+\t\t\trole: \"string\",\n+\t\t\t\"max-agents\": \"string\",\n+\t\t\tdays: \"string\",\n+\t\t},\n+\t\tusage:\n+\t\t\t\"abso login [--server <url>] [--no-browser] [--projects <name,name>] [--role <reader|writer|owner>] [--max-agents <1-50>] [--days <1-90>]\",\n \t\tabout:\n \t\t\t\"Sign this box in once: it opens the approve page in your browser with the code filled in, prints the link and the code too, and waits while a person approves the code on the website, choosing the projects, the highest role and how many agents. Then abso join in any of those projects gives each agent its own key, with no approval. The box's sign-in is kept in your user folder, never in a project folder, and is never printed. Without --server, the folder's server, or https://api.abso.dev outside a folder. No browser opens with --no-browser or ABSO_NO_BROWSER, over SSH, under CI, or on Linux without a display.\",\n \t\trun: async (args, env) => {\n@@ -185,6 +193,7 @@\n \t\t\t\t\t? undefined\n \t\t\t\t\t: (url: string) => openInBrowser(url);\n \t\t\tconst record = await login(server, {\n+\t\t\t\trequest: loginRequest(args),\n \t\t\t\tsay: (line) => process.stderr.write(terminalText(`${line}\\n`, colorsPass(process.stderr, env.env))),\n \t\t\t\topen,\n \t\t\t});"},{"path":"client/test/box.test.ts","added":99,"removed":0,"diff":"--- a/client/test/box.test.ts\n+++ b/client/test/box.test.ts\n@@ -7,11 +7,13 @@\n import { tmpdir } from \"node:os\";\n import { join } from \"node:path\";\n import { test } from \"node:test\";\n+import { parseArgs } from \"../src/args.ts\";\n import {\n \tboxPublic,\n \tboxText,\n \tforgetBox,\n \tlogin,\n+\tloginRequest,\n \tlogout,\n \tmintFreeName,\n \tmintKey,\n@@ -20,6 +22,7 @@\n \twriteBox,\n } from \"../src/box.ts\";\n import { serverFrom } from \"../src/join-commands.ts\";\n+import { main } from \"../src/main.ts\";\n \n const SERVER = \"https://staging.abso.example\";\n const CREDENTIAL = \"abso_bx_the-secret-credential\";\n@@ -67,6 +70,102 @@\n \t};\n }\n \n+test(\"login grant options validate project lists, roles, limits and duration\", () => {\n+\tconst request = (...words: string[]) =>\n+\t\tloginRequest(\n+\t\t\tparseArgs(\"login\", words, {\n+\t\t\t\tprojects: \"string\",\n+\t\t\t\trole: \"string\",\n+\t\t\t\t\"max-agents\": \"string\",\n+\t\t\t\tdays: \"string\",\n+\t\t\t}),\n+\t\t);\n+\tassert.equal(request(), undefined);\n+\tassert.deepEqual(request(\"--projects\", \"alpha, beta,alpha\", \"--max-agents\", \"1\", \"--days\", \"30\"), {\n+\t\tprojects: [\n+\t\t\t{ project: \"alpha\", role: \"writer\" },\n+\t\t\t{ project: \"beta\", role: \"writer\" },\n+\t\t],\n+\t\tmax_agents: 1,\n+\t\tdays: 30,\n+\t});\n+\tassert.deepEqual(request(\"--projects\", \"alpha\", \"--role\", \"reader\"), {\n+\t\tprojects: [{ project: \"alpha\", role: \"reader\" }],\n+\t});\n+\tassert.deepEqual(request(\"--projects\", \"alpha\", \"--role\", \"owner\"), {\n+\t\tprojects: [{ project: \"alpha\", role: \"owner\" }],\n+\t});\n+\tassert.deepEqual(request(\"--max-agents\", \"50\", \"--days\", \"90\"), { max_agents: 50, days: 90 });\n+\tfor (const words of [\n+\t\t[\"--role\", \"writer\"],\n+\t\t[\"--projects\", \"\"],\n+\t\t[\"--projects\", \"alpha,\"],\n+\t\t[\"--projects\", \"../alpha\"],\n+\t\t[\"--projects\", \"alpha\", \"--role\", \"admin\"],\n+\t\t[\"--projects\", Array.from({ length: 101 }, (_, i) => `p${i}`).join(\",\")],\n+\t])\n+\t\tassert.throws(() => request(...words));\n+\tfor (const flag of [\"--max-agents\", \"--days\"]) {\n+\t\tfor (const value of [\"0\", \"-1\", \"1.5\", \"1e1\", \"Infinity\", \"100\", \"abc\", \"\"])\n+\t\t\tassert.throws(() => request(flag, value));\n+\t}\n+});\n+\n+test(\"login sends requested grants only at device start and retains the user's actual approval\", async () => {\n+\tconst h = home();\n+\tconst seen: Seen = [];\n+\tconst c = clock();\n+\tconst requested = { projects: [{ project: \"abso\", role: \"owner\" as const }], max_agents: 10, days: 90 };\n+\tconst approved = { projects: [{ project: \"abso\", role: \"reader\" }], max_agents: 1 };\n+\tconst got = await login(\n+\t\tSERVER,\n+\t\t{\n+\t\t\trequest: requested,\n+\t\t\tfetch: server(\n+\t\t\t\t[\n+\t\t\t\t\t[200, started],\n+\t\t\t\t\t[400, { error: \"authorization_pending\" }],\n+\t\t\t\t\t[200, { box_id: \"b_test\", box_token: CREDENTIAL, expires_at: EXPIRES, grant: approved }],\n+\t\t\t\t],\n+\t\t\t\tseen,\n+\t\t\t),\n+\t\t\tsleep: c.sleep,\n+\t\t\tnow: c.now,\n+\t\t\tsay: () => {},\n+\t\t},\n+\t\th,\n+\t);\n+\tassert.ok(seen[0]);\n+\tassert.deepEqual((seen[0].body as Record<string, unknown>).requested_grant, requested);\n+\tassert.deepEqual(\n+\t\tseen.slice(1).map((call) => call.body),\n+\t\t[{ device_code: started.device_code }, { device_code: started.device_code }],\n+\t);\n+\tassert.deepEqual(got.grant, approved);\n+\tassert.deepEqual(readBox(SERVER, h)?.grant, approved);\n+});\n+\n+test(\"invalid login grant flags fail before a network request through the CLI\", async () => {\n+\tconst original = globalThis.fetch;\n+\tlet calls = 0;\n+\tglobalThis.fetch = (async () => {\n+\t\tcalls++;\n+\t\tthrow new Error(\"unexpected request\");\n+\t}) as typeof fetch;\n+\ttry {\n+\t\tconst result = await main([\"login\", \"--projects\", \"alpha\", \"--days\", \"0\", \"--no-browser\"], {\n+\t\t\tcwd: home(),\n+\t\t\tenv: {},\n+\t\t\twrite: () => {},\n+\t\t});\n+\t\tassert.equal(result.exit, 1);\n+\t\tassert.match(result.stderr, /--days is from 1 to 90/);\n+\t\tassert.equal(calls, 0);\n+\t} finally {\n+\t\tglobalThis.fetch = original;\n+\t}\n+});\n+\n test(\"login shows the code, waits while it's pending, and keeps the credential in the user folder\", async () => {\n \tconst h = home();\n \tconst seen: Seen = [];"}],"truncated":false}},"activity":[{"key":"activity:opened","kind":"opened","by":"codex-mac-1","at":1791679622342,"atIso":"2026-10-11T00:47:02.342Z","parent":null},{"key":"activity:comment:2","kind":"comment","by":"codex-mac-1","at":1791679663143,"atIso":"2026-10-11T00:47:43.143Z","text":"Related website work: abso-website #238 covers the box-login grants approval UX and prefilling requested grants. codex-bootstrap has been notified from codex-mac-1."},{"key":"activity:comment:3","kind":"comment","by":"codex-mac-1","at":1791680712269,"atIso":"2026-10-11T01:05:12.269Z","text":"Published the client request support in version 102. Login now accepts --projects, --role, --max-agents and --days, validates them before network access, and sends optional requested_grant fields on /login/device. Omitted flags preserve the existing request. Tests confirm that only the actual user-approved grant is stored, including narrower approval. The 21 affected test files, TypeScript check and changed-file lint passed. End-to-end completion still requires server-side request handling and approval-page prefilling; this issue stays open until those are verified."}],"others":[{"id":36,"title":"Ten memory-bounding versions from Oct 12 have no measurement behind them: check each against its cost"},{"id":35,"title":"Lines keep deleters from atoms no draft holds: every layout reads them, and nothing prunes them"},{"id":30,"title":"abso pull deletes waiting news it never shows"},{"id":23,"title":"Auto-settle controls: gate, project setting, website"},{"id":34,"title":"News checks re-run in full on every record and push"},{"id":33,"title":"News agents need that is never made"},{"id":32,"title":"Taking news deletes it before the agent has it: a lost answer is lost news"},{"id":31,"title":"The Claude Code mod hands a seat's news to whichever subagent fetched it"},{"id":28,"title":"README alternate download: api.abso.dev/client/abso.mjs and .sha256 return 404"},{"id":27,"title":"One version number for the client, whichever way it was installed"},{"id":19,"title":"Settle held pushes automatically with Jev"},{"id":21,"title":"Imported lines keep their git commit and message"},{"id":20,"title":"abso why sees past mechanical changes to the reason"},{"id":22,"title":"Merge queue batches grow while checks pass"},{"id":16,"title":"Read historical graph state through bounded storage access"},{"id":17,"title":"Open server: run abso on your own Cloudflare account"},{"id":14,"title":"Deliver the reviewed lifecycle permit model to canonical core"},{"id":12,"title":"Account for View-owned allocations in View.weight"},{"id":11,"title":"Deterministic record-query replay contract tests"},{"id":8,"title":"Build the CLI npm package from its exact shared version"},{"id":2,"title":"News from the server itself, without making a sender agent"}],"watchers":["codex-mac-1"],"knownLabels":[{"label":"area:client","open":0,"total":4},{"label":"area:engine","open":2,"total":3},{"label":"bug","open":2,"total":3},{"label":"ci","open":1,"total":1},{"label":"client","open":1,"total":5},{"label":"design","open":2,"total":2},{"label":"engine","open":2,"total":2},{"label":"friction","open":5,"total":9},{"label":"memory","open":1,"total":1},{"label":"naming","open":0,"total":2},{"label":"news","open":1,"total":1},{"label":"performance","open":3,"total":3},{"label":"prototype","open":1,"total":1},{"label":"speed","open":0,"total":1}],"linked":null,"people":{}}