Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
8f131f2
fix(ci): isolate account test prerequisites
vacterro Oct 28, 2026
4ac9be5
fix(installer): normalize owned target paths
vacterro Oct 28, 2026
8064c96
test(identity): report render mismatch location
vacterro Oct 28, 2026
274be71
test(identity): capture execution label context
vacterro Oct 28, 2026
69f3528
test(identity): stabilize first-paint comparisons
vacterro Oct 28, 2026
918dda5
fix(access): preserve unowned ACL grants
vacterro Oct 28, 2026
c081c6e
test(accounts): isolate credential launch checks
vacterro Oct 28, 2026
6775613
fix(accounts): stop stale work and scroll growth
vacterro Oct 28, 2026
32ce4ff
test(workers): import loader on clean Python
vacterro Oct 28, 2026
3e313bf
Isolate console injector evidence in temp storage
vacterro Oct 28, 2026
0969395
ci: encode Windows Python diagnostics as UTF-8
vacterro Oct 28, 2026
98cf7ed
fix: bind scenario manifest to published bytes
vacterro Oct 28, 2026
908e07a
test: use real folders for junk policy checks
vacterro Oct 28, 2026
529b897
ci: forward to the installed Python interpreter
codex Oct 28, 2026
a846add
ci: provide a complete OpenCode test fixture
codex Oct 28, 2026
f9be251
test: make scenario argv probes dependency-free
codex Oct 28, 2026
4b354c1
test: await shell recorder completion
codex Oct 28, 2026
a4169ef
test: measure scratch containment before cleanup
codex Oct 28, 2026
bdaf34b
test: canonicalize worker launch fixtures
codex Oct 28, 2026
0b983a8
test: expose failing SAIPATCH unit output
codex Oct 28, 2026
759791f
test(consoles): isolate launcher prerequisites
codex Oct 29, 2026
96eb470
test(consoles): bind physical engine identity
codex Oct 29, 2026
9eff11f
fix(usn): classify native mutation failures
codex Oct 29, 2026
37183f2
test: await cold shell recorders safely
codex Oct 29, 2026
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: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@

# SAIPEN byte-bound evidence (digest-verified; never convert line endings) -- T-1508.
.saipen/recovery/board-scrub/** -text

# The scenarios migration manifest hashes the published source bytes.
# Keep those text payloads stable even with core.autocrlf=true on Windows.
Scripts/scenarios/** text eol=lf
11 changes: 10 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:
jobs:
regs:
runs-on: windows-latest
env:
PYTHONIOENCODING: utf-8
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand All @@ -25,6 +27,11 @@ jobs:
# stubs must break the dependent harnesses, never silently skip.
powershell -NoProfile -ExecutionPolicy Bypass -File tests\test_ci_hermetic.ps1
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
- name: Test isolated CI Python launcher and argument forwarding
shell: pwsh
run: |
powershell -NoProfile -ExecutionPolicy Bypass -File tests\test_ci_python_launcher.ps1
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
- name: Run integrity suite
shell: pwsh
run: |
Expand Down Expand Up @@ -196,7 +203,9 @@ jobs:
- name: Test Explorer menu launch and argument contract
shell: pwsh
run: |
powershell -NoProfile -ExecutionPolicy Bypass -File tests\test_shell_menu.ps1
# Exercise a recorder that is still live after the old ten-second
# bound; preserve real shell resolution and drive-root assertions.
powershell -NoProfile -ExecutionPolicy Bypass -File tests\test_shell_menu.ps1 -RecorderDelayMilliseconds 12000
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
- name: Test single-instance activation publication
shell: pwsh
Expand Down
5 changes: 3 additions & 2 deletions SAITULS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7840,7 +7840,7 @@ int DrawAccountDetailPane(Graphics g, int px, int py, int pw, int ph, AccountRow
oy += 22;
}

return oy - startY + _acctDetailScrollY;
return oy - startY;
}

void DrawAccountsTab(Graphics g, int x, int y, int w, int h)
Expand Down Expand Up @@ -8950,9 +8950,10 @@ void SignInFlow(string label, string backend, string provider, string context)
// time out into a false READY, and never open a second account to
// "help" if they abandon it.
var sw = Stopwatch.StartNew();
while (sw.ElapsedMilliseconds < AuthPollBudgetMs)
while (!_closing && sw.ElapsedMilliseconds < AuthPollBudgetMs)
{
Thread.Sleep(3000);
if (_closing) return;
CliRun r = AccountsExec("status \"" + label + "\"", 20000);
var o = ParseEnv(r.Stdout);
if (o == null) continue;
Expand Down
4 changes: 3 additions & 1 deletion Scripts/accounts/InstallImage.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ function Get-SaiExecutableHash([string]$Path) {
function Install-SaiExecutableImage([string]$Source, [string]$Target, [string]$AllowedDirectory) {
$directory = (Get-Item -LiteralPath $AllowedDirectory -ErrorAction Stop).FullName
$destination = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($Target)
if (-not [string]::Equals([IO.Path]::GetDirectoryName($destination).TrimEnd('\'), $directory.TrimEnd('\'), [StringComparison]::OrdinalIgnoreCase)) {
$destinationDirectory = (Get-Item -LiteralPath ([IO.Path]::GetDirectoryName($destination)) -ErrorAction Stop).FullName
if (-not [string]::Equals($destinationDirectory.TrimEnd('\'), $directory.TrimEnd('\'), [StringComparison]::OrdinalIgnoreCase)) {
throw "Executable replacement target is outside its owned directory: $destination"
}
$destination = Join-Path $destinationDirectory ([IO.Path]::GetFileName($destination))
$sourcePath = (Get-Item -LiteralPath $Source -ErrorAction Stop).FullName
$sourceHash = Get-SaiExecutableHash $sourcePath
if ((Test-Path -LiteralPath $destination -PathType Leaf) -and
Expand Down
9 changes: 9 additions & 0 deletions Scripts/accounts/SaiAccounts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,16 @@ static Dictionary<string, object> AntigravityLogout()
return resp;
}

// In-process seam for an authenticated launch fixture; the shipped CLI
// has no environment variable or command that replaces the native reader.
internal static Func<Dictionary<string, object>> CredentialProbe = ReadCredential;

public static Dictionary<string, object> CheckCredential()
{
return CredentialProbe();
}

static Dictionary<string, object> ReadCredential()
{
IntPtr ptr; bool present = CredReadW("gemini:antigravity", 1, 0, out ptr);
var result = Obj();
Expand Down
12 changes: 9 additions & 3 deletions Scripts/accounts/SaiAccountsHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -922,13 +922,20 @@ private static bool IsTestMode()
return Environment.GetEnvironmentVariable("SAI_HELPER_TEST_MODE") == "1";
}

private static string ResolveUserSid(string username)
{
if (IsTestMode())
return "S-1-5-21-999999999-888888888-777777777-" + Math.Abs(username.GetHashCode() % 9000 + 1000);
return ((SecurityIdentifier)new NTAccount(username).Translate(typeof(SecurityIdentifier))).Value;
}

public static bool CreateLocalUser(string username, string password, out string sid, out string error)
{
sid = null; error = null;
if (IsTestMode())
{
// Simulated user for hermetic testing
sid = "S-1-5-21-999999999-888888888-777777777-" + Math.Abs(username.GetHashCode() % 9000 + 1000);
sid = ResolveUserSid(username);
return true;
}

Expand Down Expand Up @@ -1756,8 +1763,7 @@ private static Dictionary<string, object> HandleRequest(string op, Dictionary<st
// recover from.
try
{
var acct = new NTAccount(username);
sid = ((SecurityIdentifier)acct.Translate(typeof(SecurityIdentifier))).Value;
sid = ResolveUserSid(username);
}
catch (Exception ex)
{
Expand Down
44 changes: 39 additions & 5 deletions Scripts/accounts/sai_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
records the exact ACL state before and after the grant so a revoke removes only
what this lease demonstrably created.

stdlib only, no new dependencies. The ACL is written and read with the
platform's own tool (icacls), so every other ACE is preserved by construction
and no ownership is taken.
stdlib only, no new dependencies. ACL writes use icacls; explicit grants are
inspected through Windows security APIs in PowerShell. Existing explicit
grants and ACLs changed after a lease are refused rather than claimed.
"""
import json
import os
Expand Down Expand Up @@ -200,6 +200,37 @@ def icacls(path, verb, identity, rights=""):
(proc.stdout + proc.stderr).strip()[:300])


def has_explicit_allow(path, sid):
"""A pre-existing allow rule cannot be owned or revoked by this lease."""
quote = lambda value: "'" + str(value).replace("'", "''") + "'"
script = (
"$ErrorActionPreference='Stop'; "
"$acl=Get-Acl -LiteralPath %s; "
"$rules=$acl.GetAccessRules($true,$false,[Security.Principal.SecurityIdentifier]); "
"[bool](@($rules | Where-Object { $_.IdentityReference.Value -eq %s "
"-and $_.AccessControlType -eq 'Allow' }).Count) | ConvertTo-Json -Compress"
) % (quote(path), quote(sid))
# A parent PowerShell 7 module path cannot be reused by Windows PowerShell.
env = {key: value for key, value in os.environ.items() if key.upper() != "PSMODULEPATH"}
proc = subprocess.run(["powershell", "-NoLogo", "-NoProfile", "-NonInteractive", "-Command", script],
capture_output=True, text=True, timeout=60, env=env)
try:
answer = json.loads(proc.stdout)
except ValueError:
answer = None
if proc.returncode or type(answer) is not bool:
raise LeaseError("ACL_READ_FAILED", (proc.stdout + proc.stderr).strip()[:300])
return answer


def remove_owned_allow(lease):
"""Refuse removal when the current ACL no longer matches the lease."""
if acl_text(lease["source"]) != lease.get("acl_after"):
raise LeaseError("ACL_CHANGED_SINCE_GRANT",
"the ACL changed since this lease; refusing to remove unowned rules")
icacls(lease["source"], "/remove:g", lease["windows_sid"])


def ancestors_traversable(selector, target):
"""A read ACE on a nested object is unreachable unless every ancestor is
already traversable by that account. Opening a directory already requires
Expand Down Expand Up @@ -287,6 +318,9 @@ def cmd_grant(argv):
if "--recursive" in flags and not is_directory(target):
raise LeaseError("RECURSIVE_ONLY_FOR_DIRECTORIES", target)

if has_explicit_allow(target, sid):
raise LeaseError("EQUIVALENT_ACE_ALREADY_PRESENT",
"an explicit allow rule already exists for this SID; a lease cannot own it")
before = acl_text(target)
if recursive:
rights = "(OI)(CI)(R)"
Expand Down Expand Up @@ -350,7 +384,7 @@ def cmd_revoke(argv):

target = lease["source"]
before = acl_text(target)
icacls(target, "/remove:g", lease["windows_sid"])
remove_owned_allow(lease)
after = acl_text(target)

if after != lease.get("acl_before"):
Expand Down Expand Up @@ -414,7 +448,7 @@ def cmd_sweep(argv):
if lease is None or lease.get("revoked") or not lease_expired(lease):
continue
try:
icacls(lease["source"], "/remove:g", lease["windows_sid"])
remove_owned_allow(lease)
except LeaseError as ex:
# A lease that cannot be revoked stays in the journal and is
# reported. It is never silently dropped.
Expand Down
2 changes: 1 addition & 1 deletion Scripts/del_junk_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def check(name, cond):
ok = ok and cond

check("drive root selects SAFE_DISK", select_policy("G:\\") == "SAFE_DISK")
check("folder selects AGGRESSIVE_PROJECT", select_policy("V:\\a\\b") == "AGGRESSIVE_PROJECT")
check("folder selects AGGRESSIVE_PROJECT", select_policy(os.path.dirname(__file__)) == "AGGRESSIVE_PROJECT")
p = build_policy(False, now)
check("SAFE_DISK keeps build", not p["dir_junk"]("build"))
check("SAFE_DISK keeps dist", not p["dir_junk"]("dist"))
Expand Down
4 changes: 2 additions & 2 deletions Scripts/host/UsnJournalGuard.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ function Invoke-JournalResize([string]$vol, [int64]$minBytes, [int64]$targetByte
}
$r = Invoke-Fsutil -Arguments @('usn', 'createjournal', "m=$targetBytes", "a=$deltaBytes", $vol)
if ($r.ExecutionFailed -or $r.ExitCode -ne 0) {
Add-Problem (Format-Inv '{0}: createjournal failed exit {1}: {2}' @($vol, $r.ExitCode, $r.FirstLine))
Add-ToolProblem (Format-Inv '{0}: createjournal failed exit {1}: {2}' @($vol, $r.ExitCode, $r.FirstLine))
if (-not $script:IsAdmin) { $script:ElevationNeeded = $true }
# The resize was never issued: a later delete would destroy a journal
# over a permission or execution problem, so it stays forbidden.
Expand Down Expand Up @@ -524,7 +524,7 @@ function Invoke-JournalRecreate([string]$vol, [int64]$minBytes, [int64]$targetBy
Write-Log "WARNING: $vol : recreating the journal (deletejournal + createjournal) under explicit volume-scoped authorization; this forces a full volume rescan for every USN consumer"
$d = Invoke-Fsutil -Arguments @('usn', 'deletejournal', '/n', $vol)
if ($d.ExecutionFailed -or $d.ExitCode -ne 0) {
Add-Problem (Format-Inv '{0}: deletejournal failed exit {1}: {2}' @($vol, $d.ExitCode, $d.FirstLine))
Add-ToolProblem (Format-Inv '{0}: deletejournal failed exit {1}: {2}' @($vol, $d.ExitCode, $d.FirstLine))
if (-not $script:IsAdmin) { $script:ElevationNeeded = $true }
return $false
}
Expand Down
34 changes: 17 additions & 17 deletions Scripts/scenarios/MIGRATION.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"destination": "clean/office/OFFICE.cmd",
"active": false,
"reason": "Office scrub bundle; wrapper scenario is DISABLED pending launch-contract merge (admin, uninstall)",
"destination_sha256": "2866af22404f24941c3b66ce96ab1556a8209a45c6c0879001aa2e914aa9f73b"
"destination_sha256": "728dea69c812f9b94d74f5ddb3514c87974e2104b42eb3efca4622ea9c8b972e"
},
{
"source": "CLEAN/OFFICE_S/README.md",
Expand All @@ -85,7 +85,7 @@
"destination": "clean/office/README.md",
"active": false,
"reason": "Office scrub bundle; wrapper scenario is DISABLED pending launch-contract merge (admin, uninstall)",
"destination_sha256": "42b9dbd0f8da8399bd8eb8387d2822a4e431159da98a4d0bf6248d06bb4b15f9"
"destination_sha256": "dbb6899976fe5769c89c76a1c3057e3c232adde7621e7d9d4a4e87d6f5dbcd1d"
},
{
"source": "CLEAN/OFFICE_S/bin/CleanOffice.txt",
Expand All @@ -94,7 +94,7 @@
"destination": "clean/office/bin/CleanOffice.txt",
"active": false,
"reason": "Office scrub bundle; wrapper scenario is DISABLED pending launch-contract merge (admin, uninstall)",
"destination_sha256": "c0ff3e0b9cb14687e9ef6da7890941f753f6541ede627a3d14f3d43a20b1163c"
"destination_sha256": "0e8cd61f691d27d24467f844d8782da79293d4ff5176ce89b585ef8e26102259"
},
{
"source": "CLEAN/OFFICE_S/bin/OffScrub03.vbs",
Expand Down Expand Up @@ -438,7 +438,7 @@
"destination": "media/audio/album_tool.py",
"active": true,
"reason": "Mutagen-based album/tagging tool; optional folder arg (documented convention)",
"destination_sha256": "a706aac7dfa21f3db84a4415d8800d819a8d0e7ca45352494996e01f02ad897a"
"destination_sha256": "b20c47be1ec3268695c361836bc091235242cb9b53fdd9e473c1cffae749667c"
},
{
"source": "MEDIA/AUDIO/MP3/INST_TAG.ps1",
Expand Down Expand Up @@ -472,7 +472,7 @@
"destination": "media/audio/taglib_tag_from_filenames.ps1",
"active": false,
"reason": "Alternative tagger (TagLibSharp); active in registry but BLOCKED without bundled DLL",
"destination_sha256": "5f654ce6259cb31571515d455c2a79e3a3d3388b4b84f7ca797e4aec05fa80ca"
"destination_sha256": "619c771285846856e670cbb280ca5ddbead0c43321a62b6cf60ebf2ee18806f5"
},
{
"source": "MEDIA/AUDIO/MP3/MP3_WIN.py",
Expand All @@ -481,7 +481,7 @@
"destination": "media/audio/mp3_win.py",
"active": true,
"reason": "Mutagen-based album/tagging tool; optional folder arg (documented convention)",
"destination_sha256": "6561e9571d315649c637597ba6c647b541fdcec919e469059876d90893e12b2b"
"destination_sha256": "3d7ed3988b8637b85d644e09020bc679a8604399da6922b615f1fd8d509f0e7e"
},
{
"source": "MEDIA/AUDIO/MP3/REM_CTX.reg",
Expand Down Expand Up @@ -514,7 +514,7 @@
"destination": "media/audio/tag_from_list.ps1",
"active": false,
"reason": "ffmpeg-based tagger (re-encode path); enabled only after its output is verified",
"destination_sha256": "3954758e50fc1c5bf3dda0275f87ffef189ddeaabb5d23f84573e8246d92f360"
"destination_sha256": "e5c8e4a999e840064fd94263fd93b899e0ede595fbfb3c4de904b92eb2cd5fae"
},
{
"source": "MEDIA/AUDIO/MP3/TAG_MP3.py",
Expand All @@ -523,7 +523,7 @@
"destination": "media/audio/tag_mp3.py",
"active": true,
"reason": "Mutagen-based album/tagging tool; optional folder arg (documented convention)",
"destination_sha256": "b70d73257e70b3f1c52e81e87b1fb04b1e942e1ea43ce531d4f91f9782b8369b"
"destination_sha256": "477c513dea744fe6a7fefec2441ade84990112ee648ce515c861768182232cb6"
},
{
"source": "MEDIA/AUDIO/MP3/TagLibSharp.dll",
Expand Down Expand Up @@ -670,7 +670,7 @@
"destination": "media/image/compress_images_lossless.py",
"active": true,
"reason": "jpegoptim/oxipng lossless compressor; external bundled binaries REQUIRED",
"destination_sha256": "01ba6f5885211697a02e70f890e5427f993efee2f6a03d5d8ddbb80b693f05d7"
"destination_sha256": "03e2d85731e823e5164e727ab5b1fc185884dc70d642d367d4d310800322cdf2"
},
{
"source": "MEDIA/IMAGE/PIC/DDS2BW.py",
Expand All @@ -679,7 +679,7 @@
"destination": "media/image/convert_dds_to_bw.py",
"active": true,
"reason": "In-place DDS grayscale overwrite (SUFFIX='') -> destructive badge",
"destination_sha256": "4d205270e1c725a82774da33c0206e975cc81409c1d3ceb30bb2b84fe516535b"
"destination_sha256": "e11cf70d64a2dd914fecd28e9436ea8ff567877d87c5496eb6b2a6fb3f324796"
},
{
"source": "MEDIA/IMAGE/PIC/DDS2PNG.py",
Expand All @@ -688,7 +688,7 @@
"destination": "media/image/convert_dds_to_png.py",
"active": true,
"reason": "texconv converter, creates new files alongside originals (SAFE)",
"destination_sha256": "3a352449d29408c1295e99363cfcd4f094b864d833a152e0ecdfaef0750aeb41"
"destination_sha256": "e6cb5a2dcc5394a03c93e782629199c059972561f130cb36203d2b1ab13c6a50"
},
{
"source": "MEDIA/IMAGE/PIC/DDS2TGA.py",
Expand All @@ -697,7 +697,7 @@
"destination": "media/image/convert_dds_to_tga.py",
"active": true,
"reason": "texconv converter, creates new files alongside originals (SAFE)",
"destination_sha256": "6552e08eaeb447ea495ba84fc5e5f523761d26fb35feb908e60bfabc0a892a88"
"destination_sha256": "2c2cbff5b8f7d3ecfbc006afecdfe72dbff3148694910b5087a1208ff428af28"
},
{
"source": "MEDIA/IMAGE/PIC/PNG2DDS.py",
Expand All @@ -706,7 +706,7 @@
"destination": "media/image/convert_png_to_dds.py",
"active": true,
"reason": "texconv converter, creates new files alongside originals (SAFE)",
"destination_sha256": "abb46c82e9fa10e797038d11b46cb52b955d078f888071e3ec91830e4169ff6a"
"destination_sha256": "fd93efc40153bfefc75276c63dbadc6b5b86e5dd9546ea3ed3ce9e5b9350bcf9"
},
{
"source": "MEDIA/IMAGE/PIC/REP_DDS.ps1",
Expand All @@ -723,7 +723,7 @@
"destination": "media/image/replace_dds_with_png.py",
"active": false,
"reason": "main1.png repack helper; registry-listed but DISABLED (replace-in-place semantics unproven)",
"destination_sha256": "de18e81fefef3478d2e439e3849e4d5bd90bfe96020294d6237dcbc036116159"
"destination_sha256": "c8ed21c56d6c914c13ba27f7675fa8c7e7b65f7a36ab31af8f52c8abf400f5b1"
},
{
"source": "MEDIA/IMAGE/PIC/TGA2BW.py",
Expand All @@ -741,7 +741,7 @@
"destination": "media/image/convert_tga_to_dds.py",
"active": true,
"reason": "texconv converter, creates new files alongside originals (SAFE)",
"destination_sha256": "153a7e4465d19a686b9be801bc60c5923dcf75d3f155176e6cdfc919efbd19e6"
"destination_sha256": "2b0f46f5ab4ddf2a4b916f6a8ca5d468b58df6a130566ad3f9385a3df089da67"
},
{
"source": "MEDIA/IMAGE/PIC/TGA2DDS2.py",
Expand All @@ -750,7 +750,7 @@
"destination": "media/image/convert_tga_to_dds_alt.py",
"active": true,
"reason": "texconv converter, creates new files alongside originals (SAFE)",
"destination_sha256": "ff64a571db68a847beb94080da67e6999450caba609703132873c85ef2010905"
"destination_sha256": "c753fa0042926b0da47d48061f65d3ef3e92f12ee6b8c8baf171b45d6e79e1cb"
},
{
"source": "MEDIA/IMAGE/PIC/UPS_TGA.py",
Expand Down Expand Up @@ -1001,7 +1001,7 @@
"destination": "media/video/COMPRESS_V.sh",
"active": true,
"reason": "Git Bash AV1 batch compressor; source dirs moved to config; bash dependency verified on PATH",
"destination_sha256": "a5524b4589136dddb871f2051b6c52e6f064b16db15ccc1e05dbfd6ab653e220"
"destination_sha256": "a05b34317ab6f7b0b733229f63774b407f60cdb929be11a3afcfd1bd1fecfb69"
},
{
"source": "MEDIA/VIDEO/VID/GOV.ps1",
Expand Down
Loading
Loading