Skip to content

ci: run memory final review repair on branch #1

ci: run memory final review repair on branch

ci: run memory final review repair on branch #1

name: Memory final self repair
on:
push:
branches:
- feat/memory-guard-observability-dev
permissions:
contents: write
jobs:
repair:
if: github.actor == 'twoimo'
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
ref: feat/memory-guard-observability-dev
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- uses: oven-sh/setup-bun@v2
with:
bun-version: '1.3'
- name: Add direct Windows accounting regressions
shell: bash
run: |

Check failure on line 28 in .github/workflows/memory-final-self-repair.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/memory-final-self-repair.yml

Invalid workflow file

You have an error in your yaml syntax on line 28
python3 - <<'PY'
from pathlib import Path
path = Path('packages/coding-agent/test/tools/resource-gc-redteam.test.ts')
text = path.read_text()
settings_import = 'import { Settings } from "../../src/config/settings";\n'
limit_import = 'import { resolveEffectiveMemoryLimit } from "../../src/runtime/memory-limit";\n'
if limit_import not in text:
if settings_import not in text:
raise SystemExit('settings import anchor missing')
text = text.replace(settings_import, settings_import + limit_import, 1)
import_anchor = '\t__resetResourceGcForTest,\n'
seam = '\t__sampleWindowsJobMemoryForTest,\n\t__selectMemoryPressureDomainForTest,\n'
if '__sampleWindowsJobMemoryForTest' not in text:
if import_anchor not in text:
raise SystemExit('resource-gc import anchor missing')
text = text.replace(import_anchor, import_anchor + seam, 1)
marker = '\tit("never evicts ownerless tabs under RSS pressure and warns once", async () => {'
tests = r''' it("keeps uncapped Windows Job commit charge separate from physical RAM", () => {
const gib = 1024 ** 3;
const hostBytes = 16 * gib;
const parentBytes = 2 * gib;
const snapshot = __sampleWindowsJobMemoryForTest(hostBytes, parentBytes, {
kind: "job_snapshot",
platform: "win32",
isInJob: true,
jobMemoryUsedBytes: String(20 * gib),
peakJobMemoryUsedBytes: String(21 * gib),
processPrivateUsageBytes: String(20 * gib),
processWorkingSetBytes: String(parentBytes),
peakProcessWorkingSetBytes: String(3 * gib),
});
expect(snapshot).not.toBeNull();
expect(snapshot?.parentBytes).toBe(parentBytes);
expect(snapshot?.domains).toContainEqual({
hardCapBytes: Number.MAX_SAFE_INTEGER,
totalUsageBytes: 20 * gib,
source: "windows_job",
});
expect(snapshot?.domains).toContainEqual({
hardCapBytes: hostBytes,
totalUsageBytes: parentBytes,
source: "windows_process_job_limit",
});
});
it("does not clamp a Windows commit-domain policy cap to physical RAM", () => {
const gib = 1024 ** 3;
const hostBytes = 16 * gib;
const policyLimitBytes = 24 * gib;
const snapshot = __sampleWindowsJobMemoryForTest(hostBytes, 2 * gib, {
kind: "job_snapshot",
platform: "win32",
isInJob: true,
jobMemoryUsedBytes: String(20 * gib),
peakJobMemoryUsedBytes: String(21 * gib),
processPrivateUsageBytes: String(20 * gib),
processWorkingSetBytes: String(2 * gib),
peakProcessWorkingSetBytes: String(3 * gib),
});
expect(snapshot).not.toBeNull();
const pressure = __selectMemoryPressureDomainForTest(snapshot!, policyLimitBytes);
const limit = resolveEffectiveMemoryLimit({
hardCapBytes: pressure.hardCapBytes,
policyLimitBytes,
});
expect(pressure.source).toBe("windows_job");
expect(limit.effectiveBytes).toBe(policyLimitBytes);
expect(limit.effectiveBytes).toBeGreaterThan(hostBytes);
const usageRatio = pressure.totalUsageBytes / limit.effectiveBytes!;
expect(usageRatio).toBeCloseTo(20 / 24, 8);
expect(usageRatio).toBeLessThan(1);
});
'''
if 'keeps uncapped Windows Job commit charge separate from physical RAM' not in text:
if text.count(marker) != 1:
raise SystemExit('test insertion anchor missing')
text = text.replace(marker, tests + marker, 1)
path.write_text(text)
PY
- name: Restore generated declarations
run: |
bun packages/natives/scripts/gen-enums.ts
cp packages/natives/native/index.d.ts /tmp/index.generated.d.ts
cp packages/natives/native/index.js /tmp/index.generated.js
bun packages/natives/scripts/gen-enums.ts
cmp /tmp/index.generated.d.ts packages/natives/native/index.d.ts
cmp /tmp/index.generated.js packages/natives/native/index.js
grep -F "macOS computer-use controller." packages/natives/native/index.d.ts
- name: Install and format
run: |
bun install --frozen-lockfile
bunx biome check --write packages/coding-agent/test/tools/resource-gc-redteam.test.ts
- name: Verify focused memory boundary
run: |
bun test --timeout 30000 \
packages/coding-agent/test/runtime/memory-limit.test.ts \
packages/coding-agent/test/runtime/memory-domain.test.ts \
packages/coding-agent/test/runtime/memory-guard.test.ts \
packages/coding-agent/test/tools/resource-gc.test.ts \
packages/coding-agent/test/tools/resource-gc-redteam.test.ts \
packages/coding-agent/test/gjc-runtime/linux-proc.test.ts \
packages/coding-agent/test/cli-memory-guard-native-smoke.test.ts \
packages/natives/test/memory-guard-native.test.ts \
packages/natives/test/memory-guard-build-wiring.test.ts
bun --cwd=packages/coding-agent run check
bun --cwd=packages/natives run check
- name: Commit verified repair and remove automation
shell: bash
run: |
git config user.name "twoimo"
git config user.email "32544727+twoimo@users.noreply.github.com"
git rm .github/workflows/memory-final-self-repair.yml
git rm -f .github/trigger/memory-final-review
git add \
packages/coding-agent/test/tools/resource-gc-redteam.test.ts \
packages/natives/native/index.d.ts \
packages/natives/native/index.js
git commit -m "test(coding-agent): cover Windows memory accounting"
git push origin HEAD:feat/memory-guard-observability-dev