seat: give role sessions a git identity and report the checkout commit (row 104, #1598)
sandboxArgv sets GIT_AUTHOR_NAME/EMAIL and GIT_COMMITTER_NAME/EMAIL from
the instance and business ids (name = instance id, email
<instance>@<business>.mosaic.invalid); spawnSession and the launcher pass
the ids through. checkout results carry the clone's commit (a kept clone
gets none), and the bundle prompt names it. allowed() is unchanged.
Packet agents/darkwing/work/queue-104/r1/ (manifest f99f2ae7). Dewey
approved round 1 in 28293 (posted under jarvis by mistake; 28294 is
Dewey's confirmation). Sage's gate on f00613106 plus the candidate:
every package suite and scripts/test-*.sh green (test-release failed 3
activation checks once, not reproduced; rerun 14/0).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -248,7 +248,7 @@ export function createLauncher({
|
||||
claudeBin: env.MOSAIC_CLAUDE_BIN || null,
|
||||
readOnly,
|
||||
};
|
||||
const child = spawnSession({ runDir, env: sessionEnv(env, run), paths, bwrap });
|
||||
const child = spawnSession({ runDir, env: sessionEnv(env, run), paths, business: b.id, role: instance, bwrap });
|
||||
let bound = false;
|
||||
let entry = null;
|
||||
const exited = new Promise((resolve) => child.once("close", (code, signal) => resolve(sessionExit(code, signal))));
|
||||
|
||||
@@ -226,6 +226,12 @@ test("the PM launches a coder through its launch tool; the coder answers; refusa
|
||||
assert.equal(gitBound(coder.pid), true);
|
||||
assert.equal(gitBound(readSessions(f.dataRoot).find((s) => s.instance === "pm").pid), false);
|
||||
assert.equal(JSON.parse(readFileSync(join(coder.runDir, "session.json"), "utf8")).gitSocket, gitSocketPath(f.dataRoot));
|
||||
// Row 104 (#1598): each runner commits as its own instance, in this business.
|
||||
const identity = (pid) => readFileSync(`/proc/${pid}/environ`, "utf8").split("\0").filter((e) => e.startsWith("GIT_")).sort();
|
||||
for (const who of ["pm", "coder"]) {
|
||||
const runnerPid = readSessions(f.dataRoot).find((s) => s.instance === who).runnerPid;
|
||||
assert.deepEqual(identity(runnerPid), [`GIT_AUTHOR_EMAIL=${who}@acme.mosaic.invalid`, `GIT_AUTHOR_NAME=${who}`, `GIT_COMMITTER_EMAIL=${who}@acme.mosaic.invalid`, `GIT_COMMITTER_NAME=${who}`], who);
|
||||
}
|
||||
|
||||
// The coder claimed its role and answers its own messages.
|
||||
const hello = await client.call("message.send", { to: "coder", class: "REQUEST", body: "hello" });
|
||||
@@ -285,7 +291,7 @@ test("each launch makes sure the workspace has a clone of the project: cloned, f
|
||||
assert.equal(gitIn(clone, "rev-parse", "HEAD"), one);
|
||||
assert.equal(gitIn(clone, "symbolic-ref", "--short", "HEAD"), "main");
|
||||
assert.equal(gitIn(clone, "config", "--get-all", "remote.origin.url"), project);
|
||||
assert.ok(prompt(pm1.run).includes(`- Project clones: stack at ${clone}, on branch main. `));
|
||||
assert.ok(prompt(pm1.run).includes(`- Project clones: stack at ${clone}, on branch main at commit ${one} when this session started. `));
|
||||
|
||||
// While the PM runs, a second launch is refused before the host runs git
|
||||
// in its workspace: the root moved on, and the clone didn't.
|
||||
@@ -299,7 +305,7 @@ test("each launch makes sure the workspace has a clone of the project: cloned, f
|
||||
const second = await setup(t, undefined, given);
|
||||
const pm2 = await second.launcher.launchPm();
|
||||
assert.equal(gitIn(clone, "rev-parse", "HEAD"), two);
|
||||
assert.ok(prompt(pm2.run).includes(`- Project clones: stack at ${clone}, on branch main. `));
|
||||
assert.ok(prompt(pm2.run).includes(`- Project clones: stack at ${clone}, on branch main at commit ${two} when this session started. `));
|
||||
assert.deepEqual(kept(), []);
|
||||
await second.client.call("role.release");
|
||||
assert.equal(await second.close(), 0);
|
||||
|
||||
Reference in New Issue
Block a user