Skip to content
Merged
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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ jobs:
kill "$AEGIS_PID" || true
fi
- name: Check bundle size
run: "THRESHOLD_KB=2195\nSERVER_SIZE=$(find dist/ -name \"*.js\" ! -path \"\
run: "THRESHOLD_KB=2210\nSERVER_SIZE=$(find dist/ -name \"*.js\" ! -path \"\
*/__tests__/*\" ! -path \"*/dashboard/*\" -exec du -ck {} + | tail -1 | awk '{print $1}')\nSERVER_SIZE_KB=$((SERVER_SIZE))\n\
echo \"## Bundle Size Report\" >> \"$GITHUB_STEP_SUMMARY\"\necho \"\" >> \"\
$GITHUB_STEP_SUMMARY\"\necho \"| Scope | Size (KB) | Threshold (KB) | Status\
Expand Down Expand Up @@ -330,7 +330,7 @@ jobs:
}
- name: Check bundle size
if: runner.os != 'Windows'
run: "THRESHOLD_KB=2195\nSERVER_SIZE=$(find dist/ -name \"*.js\" ! -path \"\
run: "THRESHOLD_KB=2210\nSERVER_SIZE=$(find dist/ -name \"*.js\" ! -path \"\
*/__tests__/*\" ! -path \"*/dashboard/*\" -exec du -ck {} + | tail -1 | awk '{print $1}')\nSERVER_SIZE_KB=$((SERVER_SIZE))\n\
echo \"## Bundle Size Report\" >> \"$GITHUB_STEP_SUMMARY\"\necho \"\" >> \"\
$GITHUB_STEP_SUMMARY\"\necho \"| Scope | Size (KB) | Threshold (KB) | Status\
Expand Down
2 changes: 1 addition & 1 deletion scripts/check-bundle-size.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Bundle size gate — mirrors CI threshold from .github/workflows/ci.yml
set -euo pipefail

THRESHOLD_KB=2195
THRESHOLD_KB=2210

if [ ! -d "dist" ]; then
echo "❌ dist/ not found — run 'npm run build' first"
Expand Down
4 changes: 2 additions & 2 deletions src/__tests__/acp-local-storage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ describe('file ACP local-dev storage profile', () => {

it('persists sessions, event replay, and queued actions across profile restart', async () => {
const storageFile = path.join(scratchDir, 'local-acp-storage.json');
const firstProfile = createFileAcpLocalStorageProfile({ filePath: storageFile });
const firstProfile = createFileAcpLocalStorageProfile({ filePath: storageFile, persistDebounceMs: 0 });
await firstProfile.start();

await firstProfile.sessionStore.create(makeSessionRecord({ status: 'running' }));
Expand All @@ -227,7 +227,7 @@ describe('file ACP local-dev storage profile', () => {
);
await firstProfile.stop();

const secondProfile = createFileAcpLocalStorageProfile({ filePath: storageFile });
const secondProfile = createFileAcpLocalStorageProfile({ filePath: storageFile, persistDebounceMs: 0 });
await secondProfile.start();

const session = await secondProfile.sessionStore.get('session-1', scope);
Expand Down
6 changes: 3 additions & 3 deletions src/__tests__/fix-3366-acp-persist-cascade.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe('Issue #3366: ACP local storage persist() failure cascade', () => {
});

it('recovers from a failed persist — subsequent writes succeed', async () => {
const profile = createFileAcpLocalStorageProfile({ filePath });
const profile = createFileAcpLocalStorageProfile({ filePath, persistDebounceMs: 0 });
await profile.start();
expect(profile.getPersistError()).toBeNull();

Expand All @@ -75,7 +75,7 @@ describe('Issue #3366: ACP local storage persist() failure cascade', () => {
});

it('does NOT cascade rejection across multiple sequential failures', async () => {
const profile = createFileAcpLocalStorageProfile({ filePath });
const profile = createFileAcpLocalStorageProfile({ filePath, persistDebounceMs: 0 });
await profile.start();

// Make dir read-only
Expand Down Expand Up @@ -106,7 +106,7 @@ describe('Issue #3366: ACP local storage persist() failure cascade', () => {
});

it('stop() does not throw even when writeChain has a rejection', async () => {
const profile = createFileAcpLocalStorageProfile({ filePath });
const profile = createFileAcpLocalStorageProfile({ filePath, persistDebounceMs: 0 });
await profile.start();

// Make dir read-only so persist fails
Expand Down
2 changes: 2 additions & 0 deletions src/__tests__/server-core-coverage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const originalEnv: Record<string, string | undefined> = {
AEGIS_HOST: process.env.AEGIS_HOST,
AEGIS_AUTH_TOKEN: process.env.AEGIS_AUTH_TOKEN,
AEGIS_ALLOWED_WORK_DIRS: process.env.AEGIS_ALLOWED_WORK_DIRS,
AEGIS_PERSIST_DEBOUNCE_MS: process.env.AEGIS_PERSIST_DEBOUNCE_MS,
};

const authToken = 'server-core-token';
Expand Down Expand Up @@ -100,6 +101,7 @@ describe('server core coverage integration', () => {
process.env.AEGIS_HOST = '127.0.0.1';
process.env.AEGIS_AUTH_TOKEN = authToken;
process.env.AEGIS_ALLOWED_WORK_DIRS = sandboxRoot;
process.env.AEGIS_PERSIST_DEBOUNCE_MS = '0';

vi.spyOn(globalThis, 'setInterval').mockImplementation((() => 0) as any);
vi.spyOn(globalThis, 'clearInterval').mockImplementation((() => undefined) as any);
Expand Down
2 changes: 2 additions & 0 deletions src/__tests__/server-phase3.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const originalEnv: Record<string, string | undefined> = {
AEGIS_HOST: process.env.AEGIS_HOST,
AEGIS_AUTH_TOKEN: process.env.AEGIS_AUTH_TOKEN,
AEGIS_ALLOWED_WORK_DIRS: process.env.AEGIS_ALLOWED_WORK_DIRS,
AEGIS_PERSIST_DEBOUNCE_MS: process.env.AEGIS_PERSIST_DEBOUNCE_MS,
};

const authToken = 'phase3-test-token';
Expand Down Expand Up @@ -111,6 +112,7 @@ describe('server.ts Phase 3 — internal functions', () => {
process.env.AEGIS_HOST = '127.0.0.1';
process.env.AEGIS_AUTH_TOKEN = authToken;
process.env.AEGIS_ALLOWED_WORK_DIRS = sandboxRoot;
process.env.AEGIS_PERSIST_DEBOUNCE_MS = '0';

// Capture interval callbacks instead of discarding them
vi.spyOn(globalThis, 'setInterval').mockImplementation(((cb: (...args: unknown[]) => void, ms?: number) => {
Expand Down
5 changes: 5 additions & 0 deletions src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -806,8 +806,13 @@ async function main(): Promise<void> {
sessions = new SessionManager(config, sessionStore);

// Issue #2607 / ACP-064: Initialize ACP local storage profile and backend
// Issue #4032: Allow test override of persist debounce via env var.
const persistDebounceMs = process.env.AEGIS_PERSIST_DEBOUNCE_MS
? parseInt(process.env.AEGIS_PERSIST_DEBOUNCE_MS, 10)
: undefined;
acpLocalProfile = createFileAcpLocalStorageProfile({
filePath: path.join(config.stateDir, 'acp-local-storage.json'),
...(persistDebounceMs !== undefined ? { persistDebounceMs } : {}),
});
await acpLocalProfile.start();
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down
Loading
Loading