Skip to content

Sync the Pi theme into PI_CODING_AGENT_DIR when it is set - #13693

Closed
manuaudio wants to merge 4 commits into
omacom:quattrofrom
manuaudio:fix/pi-theme-honors-agent-dir
Closed

manuaudio wants to merge 4 commits into
omacom:quattrofrom
manuaudio:fix/pi-theme-honors-agent-dir

Conversation

@manuaudio

@manuaudio manuaudio commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #13691.

omarchy-theme-set-pi hardcoded PI_AGENT_DIR="$HOME/.pi/agent". Pi reads its config from PI_CODING_AGENT_DIR when that variable is set, so theme changes wrote the generated theme and activation setting into a directory Pi never reads.

The script now uses ${PI_CODING_AGENT_DIR:-$HOME/.pi/agent}, matching the existing configurable-directory behavior for Claude and Hermes. It also expands the exact leading-tilde forms Pi supports (~ and ~/...), including values supplied by a service or config file where a shell never expands them.

The focused regression covers both command paths. An existing configured directory receives ordinary theme sync without changing settings.json; --activate creates the configured directory when needed and selects omarchy-system. The same ordinary-sync check against current quattro leaves the configured theme file missing, while this branch passes. The focused run also covers the default path, missing-directory skip, settings preservation, and leading-tilde expansion: 6 cases passed. bash -n bin/omarchy-theme-set-pi test/cli, git diff --check, the added-line security scan, and a fresh Codex review pass with no blocking findings.

The skill-symlink paths from the issue remain separate in #13836 because they do not run during theme changes. I did not run the broad local suite on this machine; GitHub CI remains the broad check.

omarchy-theme-set-pi always wrote to ~/.pi/agent, so on a machine that points pi elsewhere with PI_CODING_AGENT_DIR the theme and its settings landed where pi never looks. It now follows that variable, as the Claude and Hermes theme syncs follow CLAUDE_CONFIG_DIR and HERMES_HOME.

Fixes omacom#13691

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sanjyay

sanjyay commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

This is an independent community review and unaffiliated with the Omarchy team, intended to help prepare PRs for their review.

Tested commit 01490dc1eeb930b802dfe4d9b0d877fb5906a6c8 in an isolated Omarchy test environment.

Verification Summary

  • Base reproduction (origin/quattro): bin/omarchy-theme-set-pi hardcoded PI_AGENT_DIR="$HOME/.pi/agent". When running with PI_CODING_AGENT_DIR pointing to an alternate directory, theme files (omarchy-system.json) and settings were created in ~/.pi/agent rather than the configured agent directory.
  • PR branch behavior: With PI_AGENT_DIR="${PI_CODING_AGENT_DIR:-$HOME/.pi/agent}", theme sync and activation properly write to $PI_CODING_AGENT_DIR when defined, matching the environment variable patterns used by Claude (CLAUDE_CONFIG_DIR) and Hermes (HERMES_HOME).
  • Automated test suite: Executed ./test/cli, confirming the new regression tests for PI_CODING_AGENT_DIR pass (pi theme sync follows PI_CODING_AGENT_DIR) and fallback behavior without the variable is preserved. Command metadata check (omarchy commands --check) passed cleanly across 467 commands.
Test Suite Execution Details
$ PI_TEST_AGENT_DIR="$PI_TMPDIR/pi-work"
$ HOME="$PI_TMPDIR" PI_CODING_AGENT_DIR="$PI_TEST_AGENT_DIR" bin/omarchy-theme-set-pi --activate
$ test -f "$PI_TEST_AGENT_DIR/themes/omarchy-system.json" && echo "PASS"
PASS
$ jq -e '.theme == "omarchy-system"' "$PI_TEST_AGENT_DIR/settings.json"
{
  "theme": "omarchy-system"
}
$ test ! -d "$PI_TMPDIR/.pi" && echo "PASS"
PASS

$ bin/omarchy commands --check
Command metadata check passed (467 commands)

If you'd prefer not to receive these independent reviews on your PRs, reply to this comment and say so, and I won't review your future PRs.

@manuaudio

Copy link
Copy Markdown
Contributor Author

Thanks for the independent verification, @sanjyay.

@chessing234

Copy link
Copy Markdown
Contributor

theme path looks good. skill symlinks had the same hardcoded ~/.pi/agent hole — that half is in #13836 if you want them to land together.

@manuaudio

Copy link
Copy Markdown
Contributor Author

Thanks @chessing234, that's the half I left out. #13836 and this touch different files, so they can land in either order or together.

@omarchybot omarchybot added the bug Something isn't working label Oct 1, 2026
pi resolves PI_CODING_AGENT_DIR through its own tilde expansion, so a value like ~/.config/pi set somewhere a shell never expands it is one pi reads from $HOME/.config/pi. The script took it literally: a theme switch found no such directory and skipped the sync, and the install-time --activate created a ~ directory under the working directory and themed that instead.

Co-Authored-By: Codex Medium <noreply@openai.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@omarchybot omarchybot added the verified Omarchy Triage has verified that this issue is ready for final review label Oct 3, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed and verified on a disposable Omarchy worker, with Codex Medium as a second opinion.

The bug is real and this fixes it. With PI_CODING_AGENT_DIR set, omarchy-theme-set-pi --activate on quattro writes the theme and the theme setting into ~/.pi/agent and leaves the configured directory untouched; on this branch both land in the configured directory and ~/.pi is not created. The same check fails again with the one-line fix reverted, and the default path still works when the variable is unset. The change matches how omarchy-theme-set-claude and omarchy-theme-set-hermes handle their variables.

One thing pushed to your branch (8559e78). pi expands a leading ~ in PI_CODING_AGENT_DIR itself (~ and ~/…, nothing else), so a value like ~/.config/pi set somewhere a shell never expands it is one pi reads from $HOME/.config/pi. The script took it literally: a theme switch found no such directory and skipped the sync, and the install-time --activate created a ~ directory under the working directory. The script now expands it the same way, with a test/cli check that fails without it. Codex Medium raised this; a second round on the new commit found nothing further (it reads the same session, so its agreement is not guaranteed to be independent).

Tests. test/cli on the worker stops at vscode generated theme references current theme file, which fails the same way on quattro and which #13065 updates. With that one check repaired, every check passes: 116 on this branch, and 119 with it merged into current quattro.

What it waits on: the suite going green on quattro (#13065), then the maintainer. #13836 handles the skill symlinks the issue also mentions; the two touch different files.

@greptile-apps

greptile-apps Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Pi theme sync now follows PI_CODING_AGENT_DIR, with the existing default when it is empty or unset.

  • Pi theme changes follow the agent folder Pi is configured to use.

No new actionable issues found. Tests were inspected, not run.

Reviews (4) · Last reviewed commit: "Merge upstream/quattro into fix/pi-theme..." · Reviewed by Greptile

Comment thread test/cli Resolved
@omarchybot omarchybot removed the verified Omarchy Triage has verified that this issue is ready for final review label Oct 7, 2026
@omarchybot omarchybot added verified Omarchy Triage has verified that this issue is ready for final review ready Good to merge labels Oct 7, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Re-checked at e5f7265 on a disposable Omarchy worker, with Codex Medium as a second opinion.

The fix still holds. The new commit only adds the ordinary-sync check to test/cli. Running my own reproduction again at this head: with PI_CODING_AGENT_DIR pointing at an existing directory, a theme switch on quattro leaves that directory without the theme, and --activate writes into ~/.pi/agent instead. On this branch both land in the configured directory and ~/.pi is not created. Reverting the fix brings the failure back. The default path still works when the variable is unset.

The new test is real. Against quattro's script it fails at the theme-file check, because the default directory has just been removed and the configured one is ignored. Removing pi-work before the --activate case means that case has to create the directory itself, so it cannot pass on what the ordinary sync left behind.

Tests. test/cli is green with this branch merged into current quattro (120 checks). On the branch alone it stops only at vscode generated theme references current theme file, which fails the same way on its merge base and which quattro has since fixed in #14259.

Second opinion. Codex Medium agreed on the reproduction and the test (it reads the same session, so its agreement is not guaranteed to be independent). It also pointed out that pi 1.0.3 accepts a file:// URL in PI_CODING_AGENT_DIR, which I confirmed in pi's own path handling. Supporting that here would mean percent-decoding a URL in bash for a value almost nobody sets, so I've left it alone and mention it only so it's on record.

What it waits on: the maintainer. #13836 handles the skill symlinks from the issue, and #13713 and #13718 change this same script for unrelated reasons; each merges cleanly with this one.

@paulogeyer

Copy link
Copy Markdown
Contributor

+1, tested on my laptop (ASUS Vivobook, Intel Arc) with a headless harness (synthetic HOME and a stub pi.json).

On quattro, omarchy-theme-set-pi --activate with PI_CODING_AGENT_DIR set still writes themes/omarchy-system.json and settings.json under ~/.pi/agent. On this PR (e5f7265), the same run writes into the configured directory, and a PI_CODING_AGENT_DIR='~/…' value expands to $HOME/… the way Pi does. I didn't soak it with a live Pi agent.

@manuaudio

Copy link
Copy Markdown
Contributor Author

@paulogeyer Thanks for testing both the configured directory and leading-tilde path independently. The missing live Pi-agent soak is already the remaining limitation, so this gives the maintainer another useful reproduction without overstating it.

@manuaudio

manuaudio commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor Author

I merged current quattro into 143b6bcb and resolved the only conflict in test/cli by keeping the Pi configured-directory cases alongside the newer Claude theme assertion. The focused Pi harness passes for default activation, ordinary configured-directory sync with settings preservation, configured-directory creation, and leading-tilde expansion. bash -n passes, the PR-scoped diff check is clean, and fresh Codex and Greptile reviews found no blocking issue. The first VM run hit unrelated timing failures in dropdown-test.sh and i18n-startup-test.sh; current quattro was green, and a clean rerun passed all GitHub checks. I did not run test/all, test/shell, or test/cli locally.

@manuaudio
manuaudio force-pushed the fix/pi-theme-honors-agent-dir branch from a42f167 to 143b6bc Compare October 29, 2026 16:59
@omarchybot omarchybot added verified Omarchy Triage has verified that this issue is ready for final review ready Good to merge and removed verified Omarchy Triage has verified that this issue is ready for final review ready Good to merge labels Oct 30, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

I re-checked this at 143b6bc, which merges current quattro into the branch. The PR's own diff is unchanged by that merge, and the one conflict in test/cli was resolved keeping both the Pi cases and quattro's newer Claude theme assertion.

What ran, on a disposable Omarchy worker:

  • Reproduction, with PI_CODING_AGENT_DIR pointed at a directory under a scratch HOME. On quattro (7eedd17), and on this head with the bin/omarchy-theme-set-pi change reverted, an ordinary sync leaves the configured directory without a theme, and --activate writes into ~/.pi/agent instead. On this head, both sync and activate go to the configured directory, ~/.pi/agent is left alone, and a literal ~/pi-tilde expands to $HOME/pi-tilde.
  • test/cli passed at this head, and again with the head merged into current quattro. CI is green as well.

Second opinion: Codex Medium and muse-wonder (via pi, thinking high) reviewed the diff and the merge resolution. Codex found no defects, judged the change proportionate, and confirmed by reading that the new tests fail without the fix. muse-wonder agreed on the main paths. It also noted three things this change doesn't handle:

  • A ~user/... value is not expanded. I left this as is: Pi itself expands only ~ and ~/, so the script already matches where Pi reads.
  • A relative value resolves against whatever directory the theme change runs from.
  • The variable only takes effect when the desktop session exports it.

The last two come from how the variable is set rather than from this change. Independence of the reviews isn't guaranteed.

Nothing was pushed to the branch. This now waits on the maintainer. The skill-symlink half of #13691 is still in #13836.

Arash-Afshar added a commit to Arash-Afshar/omarchy that referenced this pull request Nov 6, 2026
…r's pick

omarchy-theme-set-pi wrote the theme and the theme setting into ~/.pi/agent
even when PI_CODING_AGENT_DIR moves Pi's agent tree, so Pi never saw either.
Its Claude and Hermes siblings already follow their agent's variable.

- The agent directory is ${PI_CODING_AGENT_DIR:-~/.pi/agent}, with a leading
  ~ expanded the way Pi expands it (pi 1.5.0 getAgentDir()).
- --activate, which install/user/theme.sh runs on every re-provision, only
  fills in an unset theme. A theme the user picked in Pi is kept.
- The settings write goes through a symlinked settings.json (dotfiles) to its
  target, keeps the file's mode, and leaves the file untouched with no temp
  litter when it is not valid JSON, reporting the failure.

test/shell.d/theme-set-pi-test.sh covers each case; it fails on the first
assertion against the previous script.

Fixes omacom#13691 (theme half). Supersedes omacom#13693, omacom#13718, omacom#13713 (Pi half) and
the Pi half of omacom#13983.
@manuaudio

Copy link
Copy Markdown
Contributor Author

This still merges cleanly, and every reported check passes. The configured-directory and leading-tilde paths have focused coverage plus an independent laptop reproduction; the default path remains unchanged. Is there any remaining proof or scope change you would like before this lands?

@manuaudio

Copy link
Copy Markdown
Contributor Author

Closing to keep the review queue clean; happy to reopen if this is still wanted.

@manuaudio manuaudio closed this Nov 7, 2026
@Susensio

Copy link
Copy Markdown
Contributor

Please reopen this. omarchy-theme-set-pi on quattro/v4.5.0 still hardcodes PI_AGENT_DIR="$HOME/.pi/agent", and #13691 is still open — the only local remedy is a bootstrap step patching the shipped command. The closing note says you're happy to reopen if it's still wanted; it is. #13836 covers the skill-symlink half, not the theme path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ready Good to merge verified Omarchy Triage has verified that this issue is ready for final review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

omarchy-theme-set-pi themes ~/.pi/agent even when PI_CODING_AGENT_DIR points elsewhere

6 participants