mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-23 16:42:19 +00:00
* feat(workspace): search hosts by tag (#3001)
Co-authored-by: Cursor <cursoragent@cursor.com>
* feat(cli): bind Skills+CLI chat session via host env
Hide --chat-session from agents so they cannot spoof another chat tenant.
The host injects NETCATTY_CLI_CHAT_SESSION_ID, and Copilot/CodeBuddy
approval gates reject leftover flags and env-prefix overrides.
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix(ai): isolate Skills+CLI chat env across concurrent SDK turns
Cursor and OpenCode mutate process.env around spawn. Serialize those
writes so overlapping chats cannot inherit or restore the wrong
NETCATTY_CLI_CHAT_SESSION_ID.
Co-authored-by: Cursor <cursoragent@cursor.com>
* Revert "feat(workspace): search hosts by tag (#3001)"
This reverts commit 4b651a3841.
* fix(ai): preserve chat isolation when cancelling Cursor startup
* fix(ai): isolate Cursor turns in cancellable workers
* fix(ai): contain native Cursor cleanup in a utility process
* fix(ai): report Cursor utility process fatal errors
---------
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: bincxz <16399091+binaricat@users.noreply.github.com>
45 lines
1.4 KiB
JavaScript
45 lines
1.4 KiB
JavaScript
const test = require("node:test");
|
|
const assert = require("node:assert/strict");
|
|
const { withExclusiveProcessEnv } = require("./processEnvGate.cjs");
|
|
|
|
const TENANT_KEY = "NETCATTY_CLI_CHAT_SESSION_ID";
|
|
|
|
test("withExclusiveProcessEnv isolates overlapping tenant mutations", async () => {
|
|
const original = process.env[TENANT_KEY];
|
|
delete process.env[TENANT_KEY];
|
|
const seen = [];
|
|
let releaseA;
|
|
const holdA = new Promise((resolve) => { releaseA = resolve; });
|
|
|
|
try {
|
|
const turnA = withExclusiveProcessEnv({ [TENANT_KEY]: "chat-a" }, async () => {
|
|
seen.push(["a-start", process.env[TENANT_KEY]]);
|
|
await holdA;
|
|
seen.push(["a-end", process.env[TENANT_KEY]]);
|
|
});
|
|
|
|
while (seen.length === 0) await new Promise((resolve) => setImmediate(resolve));
|
|
|
|
const turnB = withExclusiveProcessEnv({ [TENANT_KEY]: "chat-b" }, async () => {
|
|
seen.push(["b", process.env[TENANT_KEY]]);
|
|
});
|
|
|
|
await new Promise((resolve) => setImmediate(resolve));
|
|
assert.equal(process.env[TENANT_KEY], "chat-a");
|
|
assert.equal(seen.some((row) => row[0] === "b"), false);
|
|
|
|
releaseA();
|
|
await Promise.all([turnA, turnB]);
|
|
|
|
assert.deepEqual(seen, [
|
|
["a-start", "chat-a"],
|
|
["a-end", "chat-a"],
|
|
["b", "chat-b"],
|
|
]);
|
|
assert.equal(process.env[TENANT_KEY], undefined);
|
|
} finally {
|
|
if (original === undefined) delete process.env[TENANT_KEY];
|
|
else process.env[TENANT_KEY] = original;
|
|
}
|
|
});
|