Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/ci-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: CI Test

on:
push:
branches: [main]
pull_request:
types: [opened, reopened, synchronize, ready_for_review]

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
test:
name: "npm test"
runs-on: ubuntu-24.04
timeout-minutes: 30
if: github.event_name != 'pull_request' || !github.event.pull_request.draft

steps:
- name: Checkout
uses: actions/checkout@v5

- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: "24.16.0"
package-manager-cache: false

- name: Install pnpm
run: npm install -g pnpm@11.2.2

- name: Install dependencies
run: pnpm install --frozen-lockfile --prefer-offline

- name: Run tests
run: npm test
env:
CI: "true"
1 change: 1 addition & 0 deletions src/commands/doctor-config-flow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,7 @@ vi.mock("./doctor/channel-capabilities.js", () => {
? byChannel[channelName as keyof typeof byChannel]
: fallback,
};
resolveDoctorChannelAccountIds: () => undefined,
});

vi.mock("../plugins/doctor-contract-registry.js", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ vi.mock("../channel-capabilities.js", () => ({
groupAllowFromFallbackToAllowFrom: channelName !== "discord",
warnOnEmptyGroupSenderAllowlist: true,
}),
resolveDoctorChannelAccountIds: () => undefined,
}));

describe("doctor group allowFrom fallback migration", () => {
Expand Down
1 change: 1 addition & 0 deletions src/commands/doctor/shared/empty-allowlist-policy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ vi.mock("../channel-capabilities.js", () => ({
groupAllowFromFallbackToAllowFrom: channelName !== "imessage",
warnOnEmptyGroupSenderAllowlist: channelName !== "discord",
}),
resolveDoctorChannelAccountIds: () => undefined,
}));

vi.mock("./channel-doctor.js", () => ({
Expand Down
1 change: 1 addition & 0 deletions src/commands/doctor/shared/open-policy-allowfrom.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ vi.mock("../channel-capabilities.js", () => ({
groupAllowFromFallbackToAllowFrom: true,
warnOnEmptyGroupSenderAllowlist: true,
}),
resolveDoctorChannelAccountIds: () => undefined,
}));

describe("doctor open-policy allowFrom repair", () => {
Expand Down
1 change: 1 addition & 0 deletions src/commands/doctor/shared/preview-warnings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ vi.mock("../channel-capabilities.js", () => {
return {
getDoctorChannelCapabilities: () => fallback,
};
resolveDoctorChannelAccountIds: () => undefined,
});

vi.mock("./channel-doctor.js", () => ({
Expand Down
4 changes: 2 additions & 2 deletions src/logging/redact.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -986,15 +986,15 @@
);
});

it("forces redaction for tool details even when log redaction is disabled", () => {
it("respects redactSensitive off for tool details", () => {
writeConfig(`{
logging: {
redactSensitive: "off",
},
}`);

expect(redactToolDetail("OPENAI_API_KEY=sk-1234567890abcdef")).toBe(

Check failure on line 996 in src/logging/redact.test.ts

View workflow job for this annotation

GitHub Actions / checks-node-core-runtime-infra-process

[logging] src/logging/redact.test.ts > redactSensitiveText > respects redactSensitive off for tool details

AssertionError: expected 'OPENAI_API_KEY=sk-123…cdef' to be 'OPENAI_API_KEY=sk-1234567890abcdef' // Object.is equality Expected: "OPENAI_API_KEY=sk-1234567890abcdef" Received: "OPENAI_API_KEY=sk-123…cdef" ❯ src/logging/redact.test.ts:996:68

Check failure on line 996 in src/logging/redact.test.ts

View workflow job for this annotation

GitHub Actions / npm test

[logging] ../../src/logging/redact.test.ts > redactSensitiveText > respects redactSensitive off for tool details

AssertionError: expected 'OPENAI_API_KEY=sk-123…cdef' to be 'OPENAI_API_KEY=sk-1234567890abcdef' // Object.is equality Expected: "OPENAI_API_KEY=sk-1234567890abcdef" Received: "OPENAI_API_KEY=sk-123…cdef" ❯ ../../src/logging/redact.test.ts:996:68
"OPENAI_API_KEY=sk-123…cdef",
"OPENAI_API_KEY=sk-1234567890abcdef",
);
});

Expand Down
14 changes: 10 additions & 4 deletions src/logging/redact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -999,16 +999,22 @@ function resolveToolPayloadRedaction(
loggingConfig: LoggingConfig | undefined = readLoggingConfig(),
): RedactOptions {
const userPatterns = loggingConfig?.redactPatterns;
const mode = normalizeMode(loggingConfig?.redactSensitive);
if (mode === "off") {
return { mode: "off", patterns: [] };
}
const patterns =
userPatterns && userPatterns.length > 0
? [...userPatterns, ...DEFAULT_REDACT_PATTERNS]
: undefined;
return { mode: "tools", patterns };
return { mode, patterns };
}

// Forces tools-mode regardless of `logging.redactSensitive` (which governs log
// output, not UI surfaces), and merges user `logging.redactPatterns` with the
// built-in defaults so both apply.
// Resolves tool payload redaction, respecting `logging.redactSensitive` when
// set, and merges user `logging.redactPatterns` with the built-in defaults
// so both apply. When `redactSensitive` is "off", all tool payload redaction
// is disabled, matching the user's intent to disable sensitive-value masking
// (including in tool event args such as `Authorization: Bearer` headers).
export function redactToolPayloadText(text: string): string {
return redactToolPayloadTextWithConfig(text, readLoggingConfig());
}
Expand Down
Loading