Skip to content

codex-fleet: Windows support via bundled PowerShell replacements for caffeinate and sips - #3

Open
morp1e wants to merge 1 commit into
avenoxai:mainfrom
morp1e:windows-support
Open

codex-fleet: Windows support via bundled PowerShell replacements for caffeinate and sips#3
morp1e wants to merge 1 commit into
avenoxai:mainfrom
morp1e:windows-support

Conversation

@morp1e

@morp1e morp1e commented Aug 23, 2026

Copy link
Copy Markdown

"This broke on my setup" report, with the fix attached.

I run codex-fleet on Windows 11 as the delegation layer for an Obsidian-based agent vault. The bash body works as written through Git Bash — /tmp, ~, find -mmin, 2>/dev/null and $CODEX_HOME all resolve. Two macOS binaries don't exist there, and both sit on load-bearing paths:

  • caffeinate -i guards every fleet spawn. Without it a lid-close silently kills mid-flight lanes — precisely the failure the skill warns about ("~5KB of output, zero edits"). On Windows there was no guard at all.
  • sips is the documented downscale step after generating above the gpt-image-2 minimum size. No equivalent ships with Windows, and ImageMagick isn't a safe assumption.

What this adds

Two dependency-free PowerShell scripts under skills/codex-fleet/scripts/, plus a ## Platform notes section documenting the mapping.

Need macOS Windows
Stop the machine sleeping mid-fleet caffeinate -i scripts/Invoke-KeepAwake.ps1
Downscale / centre-crop a render sips -z / sips -c scripts/Resize-Image.ps1

Both use only the .NET base library — SetThreadExecutionState and System.Drawing. No install step, no ImageMagick, no persistent system setting changed.

One design note worth flagging: Invoke-KeepAwake.ps1 is a background sentinel, not a wrapper. The execution-state flag is process-scoped, so a caffeinate-style wrapper would release the block the moment its wrapped command exits — useless for a fleet. It's started once before spawning lanes and holds the block for its own lifetime.

This is additive — macOS is untouched

  • Every macOS instruction is unchanged.
  • The spawn recipe still leads with caffeinate -i.
  • Both sips references keep the macOS command and append the Windows option in parentheses.
  • Diff is +211 / -3; the 3 are the two sips lines and one README line, each replaced in place with a superset.
  • SKILL.md frontmatter (name, description) is byte-identical.

Verification

Run on Windows 11 26H1, PowerShell 7, Git Bash.

Parser::ParseFile              both scripts, 0 errors

Resize-Image.ps1
  900x300 -> -Width 300                     RESIZED 300x100    (aspect preserved)
  900x300 -> -Width 256 -Height 256 -Crop   RESIZED 256x256    (centre-cropped)
  dimensions re-read independently via System.Drawing: 300x100, 256x256

Invoke-KeepAwake.ps1
  KEEPAWAKE_ON until=... minutes=5 pid=38160
  process alive after 6s: yes
  Stop-Process -> exits cleanly, block released

Get-Help    both scripts return their synopsis (comment-based help intact)

Limit I want to be straight about: I could not confirm the block through powercfg /requests — that needs an elevated prompt and I didn't want to run the fleet elevated. The evidence I do have is that SetThreadExecutionState returns the previous state mask on success and 0 on failure; the script hard-exits on 0 and did not, so the call was accepted. If you want the powercfg confirmation before merging, I'm happy to run it elevated and post the output.

Linux is deliberately out of scope here — I didn't test it, so I didn't claim it.

Happy to adjust naming, placement, or drop the README hunk if you'd rather keep requirements terse.

The skill's bash body already runs on Windows through Git Bash — /tmp, ~,
find -mmin, 2>/dev/null and $CODEX_HOME all resolve there. Two macOS binaries
do not exist, and both sit on load-bearing paths:

- `caffeinate -i` guards every fleet spawn. Without it a lid-close silently
  kills mid-flight lanes, which is exactly the failure the skill warns about.
- `sips` is the documented downscale step after generating above the
  gpt-image-2 minimum size.

Adds two dependency-free PowerShell replacements under scripts/ and documents
them in a new "Platform notes" section.

- Invoke-KeepAwake.ps1 — holds ES_CONTINUOUS | ES_SYSTEM_REQUIRED via
  SetThreadExecutionState for its own lifetime. Run once in the background
  before spawning lanes rather than wrapping each spawn: the flag is
  process-scoped, so a wrapper releases it the moment its command exits.
  Changes no persistent power setting; the block lifts when the process ends.
- Resize-Image.ps1 — System.Drawing scale (sips -z) and centre-crop then
  scale (sips -c). Never writes to the source file.

Both use only the .NET base library. No ImageMagick, no install step.

This change is additive. Every macOS instruction is unchanged, the spawn
recipe still leads with `caffeinate -i`, and both `sips` references keep the
macOS command with the Windows option appended.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant