Skip to content

Commit b1d644b

Browse files
committed
addressing codex review
1 parent b8bd5fe commit b1d644b

2 files changed

Lines changed: 30 additions & 8 deletions

File tree

src/auto-reply/reply/directive-handling.model.test.ts

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1856,7 +1856,7 @@ describe("persistInlineDirectives internal exec scope gate", () => {
18561856
expect(sessionEntry.verboseLevel).toBeUndefined();
18571857
});
18581858

1859-
it("skips exec persistence for non-webchat callers without operator.admin", async () => {
1859+
it("skips exec persistence for non-webchat gateway callers without operator.admin", async () => {
18601860
const sessionEntry = await persistInternalOperatorWriteDirective(
18611861
"/exec host=node security=allowlist ask=always node=worker-1",
18621862
{
@@ -1872,7 +1872,7 @@ describe("persistInlineDirectives internal exec scope gate", () => {
18721872
expect(sessionEntry.execNode).toBeUndefined();
18731873
});
18741874

1875-
it("skips verbose persistence for non-webchat callers without operator.admin", async () => {
1875+
it("skips verbose persistence for non-webchat gateway callers without operator.admin", async () => {
18761876
const sessionEntry = await persistInternalOperatorWriteDirective("/verbose full", {
18771877
messageProvider: "telegram",
18781878
surface: "telegram",
@@ -1882,7 +1882,7 @@ describe("persistInlineDirectives internal exec scope gate", () => {
18821882
expect(sessionEntry.verboseLevel).toBeUndefined();
18831883
});
18841884

1885-
it("allows non-webchat callers with operator.admin to persist exec defaults", async () => {
1885+
it("allows non-webchat gateway callers with operator.admin to persist exec defaults", async () => {
18861886
const sessionEntry = await persistInternalOperatorWriteDirective(
18871887
"/exec host=node security=allowlist ask=always node=worker-1",
18881888
{
@@ -1898,6 +1898,32 @@ describe("persistInlineDirectives internal exec scope gate", () => {
18981898
expect(sessionEntry.execNode).toBe("worker-1");
18991899
});
19001900

1901+
it("allows non-webchat channel callers without gateway scopes to persist exec defaults", async () => {
1902+
const sessionEntry = await persistInternalOperatorWriteDirective(
1903+
"/exec host=node security=allowlist ask=always node=worker-1",
1904+
{
1905+
messageProvider: "telegram",
1906+
surface: "telegram",
1907+
gatewayClientScopes: undefined,
1908+
},
1909+
);
1910+
1911+
expect(sessionEntry.execHost).toBe("node");
1912+
expect(sessionEntry.execSecurity).toBe("allowlist");
1913+
expect(sessionEntry.execAsk).toBe("always");
1914+
expect(sessionEntry.execNode).toBe("worker-1");
1915+
});
1916+
1917+
it("allows non-webchat channel callers without gateway scopes to persist verbose defaults", async () => {
1918+
const sessionEntry = await persistInternalOperatorWriteDirective("/verbose full", {
1919+
messageProvider: "telegram",
1920+
surface: "telegram",
1921+
gatewayClientScopes: undefined,
1922+
});
1923+
1924+
expect(sessionEntry.verboseLevel).toBe("full");
1925+
});
1926+
19011927
it("treats internal provider context as authoritative over external surface metadata", async () => {
19021928
const sessionEntry = await persistInternalOperatorWriteDirective("/verbose full", {
19031929
messageProvider: "webchat",

src/auto-reply/reply/directive-handling.shared.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,7 @@ function canPersistInternalDirective(params: {
2727
surface?: string;
2828
gatewayClientScopes?: string[];
2929
}): boolean {
30-
const hasGatewayContext =
31-
params.gatewayClientScopes !== undefined ||
32-
params.messageProvider !== undefined ||
33-
params.surface !== undefined;
34-
if (!hasGatewayContext) {
30+
if (params.gatewayClientScopes === undefined) {
3531
return true;
3632
}
3733
const scopes = params.gatewayClientScopes ?? [];

0 commit comments

Comments
 (0)