Skip to content

Feat/dock add codex - #1502

Merged
shunkakinoki merged 18 commits into
mainfrom
feat/dock-add-codex
Apr 18, 2026
Merged

Feat/dock add codex#1502
shunkakinoki merged 18 commits into
mainfrom
feat/dock-add-codex

Conversation

@shunkakinoki

@shunkakinoki shunkakinoki commented Apr 18, 2026

Copy link
Copy Markdown
Owner

Summary by cubic

Add Codex to the macOS Dock and ship several hardening and UX improvements. Includes a new mempalace config, macOS support for decafinate, safer local service defaults, SSH-friendly clipboard copy, and reliable uv Python wrappers that fix module import errors.

  • New Features

    • Added Codex.app to the macOS Dock (between ChatGPT and Claude).
    • Added mempalace home-manager module with config at ~/.mempalace/config.json.
    • Added macOS support for decafinate (uses caffeinate with PID-based control).
  • Bug Fixes

    • uv-globals: switched to wrapper scripts and a PATH-based python3 dispatcher (removes stale symlinks); fixes “No module named mempalace” and avoids venv corruption.
    • Security: enabled Nix sandbox in the Dockerfile; bound ollama and paperclip to 127.0.0.1; limited ollama to laptops and disabled docker-postgres on Galactica/Matic; added secure-dotenv to enforce 600 perms on .env files.
    • Clipboard: added OSC 52 copy fallback for SSH-capable terminals and clearer paste error messaging.

Written for commit d629b3c. Summary will update on new commits.

… python

Symlinks cause Python to resolve the real binary path, losing the
venv's pyvenv.cfg and site-packages. Wrapper scripts exec the venv
python directly so the venv context is preserved.

Closes the "No module named mempalace" error.
mkIf requires the NixOS module system to evaluate correctly.
Importing eagerly bypasses module merging and causes build hangs.
…host

Ollama was binding to 0.0.0.0 on all hosts with no authentication,
exposing the inference API to the network. Restrict to laptops only
and bind to 127.0.0.1.
Nix sandbox was disabled, allowing build scripts to read/write
arbitrary host paths without filesystem isolation.
Paperclip was binding to all interfaces on kyber. Since it sits
behind ingress (paperclip.shunkakinoki.com), it only needs localhost.
Activation script finds all .env files under $HOME (up to 4 levels
deep) and sets permissions to 600 on every home-manager switch.
Prevents secrets from being world-readable.
The hardcoded /etc/profiles/per-user path only exists on NixOS.
Search PATH for the next python3 that isn't the wrapper itself,
so it works on both NixOS and non-NixOS hosts.
The old code created symlinks from python3-<tool> to the venv python.
When the new wrapper code does cat > python3-<tool>, bash follows the
symlink and overwrites the target (the uv cpython binary), corrupting
every venv. Remove the old symlink first so cat creates a regular file.
…' into feat/dock-add-codex

# Conflicts:
#	home-manager/services/docker-postgres/default.nix
@coderabbitai

coderabbitai Bot commented Apr 18, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@shunkakinoki has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 52 minutes and 54 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 52 minutes and 54 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2b18f9b6-e6b1-4594-8fef-12727e5488fd

📥 Commits

Reviewing files that changed from the base of the PR and between 0ad62ae and d629b3c.

📒 Files selected for processing (1)
  • home-manager/services/paperclip/default.nix
📝 Walkthrough

Walkthrough

This PR introduces cross-platform improvements, new configuration modules, and service enhancements: adds mempalace and secure-dotenv modules, enables SSH clipboard via OSC 52, adds Darwin support to decafinate, refactors the python3 dispatcher, updates Claude permission modes from bypassPermissions to auto, conditionally gates services based on host type, changes service bind addresses to 127.0.0.1, updates the dotagents submodule, and reorganizes module imports.

Changes

Cohort / File(s) Summary
Mempalace Configuration
config/mempalace/default.nix, config/mempalace/config.json, config/default.nix
Introduces mempalace module with Home Manager file entry pointing to wiki path and adds module to config list.
Secure Dotenv Activation
home-manager/modules/secure-dotenv/default.nix, home-manager/modules/default.nix
New Home Manager activation module that enforces 600 permissions on .env files across home directory.
Clipboard Over SSH Support
home-manager/modules/local-scripts/clipboard-copy.sh, home-manager/modules/local-scripts/clipboard-paste.sh, spec/clipboard_copy_spec.sh, spec/clipboard_paste_spec.sh
Adds OSC 52 fallback for clipboard copy over SSH/Tmux/terminal, improves SSH paste error messaging, and extends tests to cover SSH scenario.
Cross-Platform Decafinate
home-manager/modules/local-scripts/decafinate.sh
Introduces OS detection and platform-specific logic for macOS/Darwin (caffeinate background process, pmset AC detection, launchd, local notifications) alongside retained Linux systemd behavior.
Python3 Dispatcher Refactoring
home-manager/modules/uv-globals/install-uv-globals.sh
Rewrites per-tool python3 wrapper generation and python3 dispatcher to exec venv bin/python3 directly, removes stale ~/.local/bin/python3, and searches PATH for system python3 with realpath validation.
Claude Permission Mode Updates
home-manager/programs/fish/functions/_clrc_function.fish, home-manager/programs/fish/functions/_clwrc_function.fish, spec/fish/_clrc_function_test.fish, spec/fish/_clwrc_function_test.fish
Changes claude remote-control --permission-mode argument from bypassPermissions to auto in Fish wrapper functions and updates test assertions accordingly.
Service Configuration and Enablement
home-manager/services/docker-postgres/default.nix, home-manager/services/ollama/default.nix, home-manager/services/paperclip/default.nix
Adds conditional gating based on host type (Galactica/Matic), changes OLLAMA_HOST and Paperclip HOST from 0.0.0.0 to 127.0.0.1.
Module and Import Management
home-manager/services/default.nix, config/paperclip/default.nix
Simplifies module imports by removing explicit argument passing and changes paperclip host from conditional to fixed 127.0.0.1.
Infrastructure and Configuration
Dockerfile, nix-darwin/config/dock.nix, config/hyprpanel/default.nix, dotagents
Updates Nix sandbox setting to true, reorders Codex.app in dock persistent-apps, reformats hyprpanel indentation, and updates dotagents submodule commit.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

enhancement


🐰 Hop, hop, hop—new features bloom!
Clipboards now whisper through SSH rooms,
Darwin joins forces with Linux so bright,
Services bind local, permissions set right!
The burrow expands—a cozy delight! 🏠✨

🚥 Pre-merge checks | ❌ 3

❌ Failed checks (3 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title only addresses the dock configuration change and ignores the majority of the changeset, which includes clipboard scripts, Claude permission modes, paperclip/ollama host changes, new mempalace module, and more. Revise the title to reflect the primary/most significant changes in the PR, such as 'Update multiple services and utilities' or focus on the most impactful change.
Description check ⚠️ Warning No description was provided by the author; the PR lacks any explanation of its objectives, scope, or rationale. Add a description that explains the purpose of the changes, how they improve the system, and why these updates are necessary.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/dock-add-codex

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mesa-dot-dev

mesa-dot-dev Bot commented Apr 18, 2026

Copy link
Copy Markdown

You do not have enough credits to review this pull request. Please purchase more credits to continue.

@mesa-dot-dev

mesa-dot-dev Bot commented Apr 18, 2026

Copy link
Copy Markdown

Mesa Description

TL;DR

Added Codex to the macOS Dock and shipped several hardening and UX improvements, including a new mempalace config, macOS support for decafinate, safer local service defaults, SSH-friendly clipboard copy, and reliable uv Python wrappers.

What changed?

  • Dockerfile: Enabled sandboxing for Nix by setting sandbox to true.
  • config/default.nix: Included a new configuration import for mempalace.
  • config/hyprpanel/default.nix: Reformatted, specifically re-indenting hyprpanelSettings.
  • config/mempalace/config.json: New file defining {"palace": "/home/ubuntu/ghq/github.com/shunkakinoki/wiki"}.
  • config/mempalace/default.nix: New Nix config creating a symlink from config.json to ~/.mempalace/config.json.
  • config/paperclip/default.nix: Changed Paperclip host configuration to a fixed "127.0.0.1".
  • dotagents: Updated, likely reflecting changes in agent configurations.
  • home-manager/modules/default.nix: Included the new secure-dotenv module.
  • home-manager/modules/local-scripts/clipboard-copy.sh: Enhanced with OSC 52 escape sequence fallback for SSH-capable terminals.
  • home-manager/modules/local-scripts/clipboard-paste.sh: Improved error message for unsupported clipboard paste over SSH.
  • home-manager/modules/local-scripts/decafinate.sh: Updated to support both Linux and macOS with OS-specific power management.
  • home-manager/modules/secure-dotenv/default.nix: New module to automatically set .env file permissions to 600.
  • home-manager/modules/uv-globals/install-uv-globals.sh: Replaced symlinks with wrapper scripts for python3-<tool> and updated python3 dispatcher.
  • home-manager/programs/fish/functions/_clrc_function.fish: Changed --permission-mode for claude remote-control from bypassPermissions to auto.
  • home-manager/programs/fish/functions/_clwrc_function.fish: Changed --permission-mode for claude remote-control from bypassPermissions to auto.
  • home-manager/services/default.nix: Updated service definitions for 'dockerPostgres' and 'ollama' to directly reference module paths.
  • home-manager/services/docker-postgres/default.nix: Added conditional activation, enabling only when host is neither Galactica nor Matic.
  • home-manager/services/ollama/default.nix: Ollama service is now conditionally enabled based on host, and OLLAMA_HOST changed from 0.0.0.0 to 127.0.0.1.
  • home-manager/services/paperclip/default.nix: Paperclip service's HOST environment variable updated from 0.0.0.0 to 127.0.0.1.
  • nix-darwin/config/dock.nix: Reordered applications in the macOS dock, moving /Applications/Codex.app after /Applications/ChatGPT.app.
  • spec/clipboard_copy_spec.sh: New test suite for OSC 52 escape sequence and improved test isolation.
  • spec/clipboard_paste_spec.sh: Updated test case for unavailable clipboard backend with a more specific error message.
  • spec/fish/_clrc_function_test.fish: Updated expected --permission-mode argument from bypassPermissions to auto in tests.
  • spec/fish/_clwrc_function_test.fish: Updated expected --permission-mode flag from bypassPermissions to auto in tests.

Description generated by Mesa. Update settings

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces several configuration updates and script improvements across the repository. Key changes include enabling the Nix sandbox, adding a new mempalace module, refactoring the decafinate script to support macOS, and implementing a secure-dotenv module to enforce strict permissions on environment files. Additionally, several services like ollama and paperclip were restricted to localhost for improved security, and OSC 52 support was added for remote clipboard operations. Feedback focuses on improving the portability of the mempalace configuration using Nix-generated JSON, ensuring robust filename handling in shell scripts using null delimiters, and refining PID file checks in the decafinate script to prevent shell errors.

Comment on lines +1 to +7
{ ... }:
{
home.file.".mempalace/config.json" = {
source = ./config.json;
force = true;
};
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The configuration for mempalace currently relies on a static JSON file with a hardcoded home directory path. To improve portability across different users and environments, it is better to generate the JSON content dynamically using Nix and the config.home.homeDirectory option.

{ config, ... }:
{
  home.file.".mempalace/config.json" = {
    text = builtins.toJSON {
      palace = "${config.home.homeDirectory}/ghq/github.com/shunkakinoki/wiki";
    };
    force = true;
  };
}

Comment on lines +12 to +15
${pkgs.findutils}/bin/find "${homeDir}" \
-maxdepth 4 \
-name '.env' -o -name '.env.*' -o -name '*.env' \
2>/dev/null | while IFS= read -r f; do

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Parsing find output with a standard while read loop can fail if filenames contain spaces or newlines. Using -print0 and read -d '' is a more robust approach for handling arbitrary filenames, as recommended in the general rules for shell scripts in this repository.

    ${pkgs.findutils}/bin/find "${homeDir}" \
      -maxdepth 4 \
      \( -name '.env' -o -name '.env.*' -o -name '*.env' \) \
      -print0 2>/dev/null | while IFS= read -r -d "" f; do
References
  1. To robustly parse command output in shell scripts, use a unique delimiter (e.g., tab) in the format string and read with a matching IFS. This is safer than splitting by spaces with cut, especially when data fields might contain spaces.

systemctl --user is-active --quiet "$UNIT_FILE"
case "$OS" in
Darwin)
if [[ -f $PID_FILE ]] && kill -0 "$(cat "$PID_FILE")" 2>/dev/null; then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Checking for file existence with [[ -f $PID_FILE ]] is insufficient if the file is empty, as kill -0 will then be called with an empty argument, leading to a shell error. Using [[ -s $PID_FILE ]] ensures the file exists and contains data before attempting to read the PID.

Suggested change
if [[ -f $PID_FILE ]] && kill -0 "$(cat "$PID_FILE")" 2>/dev/null; then
if [[ -s $PID_FILE ]] && kill -0 "$(cat "$PID_FILE")" 2>/dev/null; then

# Conflicts:
#	home-manager/modules/local-scripts/decafinate.sh
@shunkakinoki
shunkakinoki merged commit 12c0af1 into main Apr 18, 2026
20 of 25 checks passed
@shunkakinoki
shunkakinoki deleted the feat/dock-add-codex branch April 18, 2026 08:49
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