Skip to content

fix keychain - #1479

Merged
shunkakinoki merged 7 commits into
mainfrom
fix-keychain
Apr 15, 2026
Merged

fix keychain#1479
shunkakinoki merged 7 commits into
mainfrom
fix-keychain

Conversation

@shunkakinoki

@shunkakinoki shunkakinoki commented Apr 15, 2026

Copy link
Copy Markdown
Owner
  • fix: keychain
  • chore: update
  • chore: update
  • chore: update
  • chore: update
  • chore: update
  • chore: update

Summary by cubic

Replaced tmuxinator with a built-in tmux bootstrap for default sessions and improved make build host resolution on macOS. Added clipboard aliases across shells, expanded tests, and refreshed dependencies.

  • New Features

    • Added __tmux_bootstrap_default_session and wired it into _tpo, _tmo, _tdo, _two, and _tss, with a tmux-resurrect restore path; included tests for bootstrap and helpers.
    • Makefile Darwin builds now use HOST to select named NixOS/Darwin configs and fall back to DETECTED_HOST; added a spec for host resolution.
    • Added copy/paste aliases to bash, fish, and zsh.
  • Dependencies

    • Updated various CLI/tools in package.json and refreshed bun.lock.

Written for commit 6a06968. Summary will update on new commits.

@coderabbitai

coderabbitai Bot commented Apr 15, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0916e17a-1e98-46e1-9836-068c3b20f498

📥 Commits

Reviewing files that changed from the base of the PR and between 0c5e18c and 6a06968.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (19)
  • Makefile
  • home-manager/programs/bash/default.nix
  • home-manager/programs/fish/default.nix
  • home-manager/programs/fish/functions/__tmux_bootstrap_default_session.fish
  • home-manager/programs/fish/functions/_tdo_function.fish
  • home-manager/programs/fish/functions/_tmo_function.fish
  • home-manager/programs/fish/functions/_tpo_function.fish
  • home-manager/programs/fish/functions/_tss_function.fish
  • home-manager/programs/fish/functions/_two_function.fish
  • home-manager/programs/zsh/default.nix
  • package.json
  • spec/fish/__tmux_bootstrap_default_session_test.fish
  • spec/fish/_tdo_function_test.fish
  • spec/fish/_tmo_function_test.fish
  • spec/fish/_tpo_function_test.fish
  • spec/fish/_tss_function_test.fish
  • spec/fish/_two_function_test.fish
  • spec/llm_update_spec.sh
  • spec/make_build_host_resolution_spec.sh

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.


📝 Walkthrough

Summary by CodeRabbit

Release Notes

  • New Features

    • Added copy and paste shell aliases for clipboard operations across bash, fish, and zsh shells.
    • Improved tmux session initialization workflow.
  • Chores

    • Updated dependencies to latest versions.
  • Tests

    • Expanded and enhanced test coverage for shell integration improvements.

Walkthrough

This pull request introduces a new Fish tmux session bootstrapping system that replaces tmuxinator-based management, adds shell aliases for clipboard operations, updates the Makefile's host resolution logic for Darwin/NixOS builds, and bumps multiple npm dependencies.

Changes

Cohort / File(s) Summary
Makefile Build Logic
Makefile
Expanded nix-build target's Darwin branch with conditional host-specific logic: checks HOST against NIXOS_NAMED_HOSTS to dispatch between NixOS and Darwin build configs, falls back to DETECTED_HOST, then generic build ref if neither is set.
Shell Aliases
home-manager/programs/bash/default.nix, home-manager/programs/fish/default.nix, home-manager/programs/zsh/default.nix
Added copyclipboard-copy and pasteclipboard-paste aliases across bash, fish, and zsh shells; removed ocd alias and prior ~/.local/scripts-based copy/paste abbrs from Fish.
Tmux Bootstrap Function
home-manager/programs/fish/functions/__tmux_bootstrap_default_session.fish
New Fish function that creates detached tmux sessions (primary, mobile, desktop, work) with preconfigured windows and layouts, replacing tmuxinator dependency.
Fish Tmux Helper Functions
home-manager/programs/fish/functions/_tpo_function.fish, home-manager/programs/fish/functions/_tmo_function.fish, home-manager/programs/fish/functions/_tdo_function.fish, home-manager/programs/fish/functions/_tss_function.fish, home-manager/programs/fish/functions/_two_function.fish
Modified functions to invoke __tmux_bootstrap_default_session instead of tmuxinator; _tss_function now delegates work to _two_function and default sessions to their respective helpers; _two_function implements tmux-resurrect restore logic with bootstrap fallback.
Fish Configuration
home-manager/programs/fish/default.nix
Added __tmux_bootstrap_default_session.fish to managed function files and reordered _update_local_binaries_function position.
Fish Tests
spec/fish/__tmux_bootstrap_default_session_test.fish, spec/fish/_tpo_function_test.fish, spec/fish/_tmo_function_test.fish, spec/fish/_tdo_function_test.fish, spec/fish/_tss_function_test.fish, spec/fish/_two_function_test.fish
Added comprehensive tests for new bootstrap function and updated existing tests to verify bootstrap invocation, client switching/attaching behavior, and tmuxinator bypass.
Build Infrastructure Tests
spec/make_build_host_resolution_spec.sh, spec/llm_update_spec.sh
Added Makefile host resolution spec for Darwin/NixOS build dispatch; updated shell command awk logic for directory concatenation.
Dependencies
package.json
Bumped versions for 25 npm packages including @anthropic-ai/claude-code, @github/copilot, @google/gemini-cli, oxlint, and others.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Fish as Fish Function
    participant Bootstrap as __tmux_bootstrap_<br/>default_session
    participant Tmux
    participant Session as Tmux Session

    User->>Fish: Call _tpo_function (primary)
    alt primary session exists
        Fish->>Tmux: has-session -t primary
        Tmux-->>Fish: success
    else primary session missing
        Fish->>Bootstrap: __tmux_bootstrap_default_session primary
        Bootstrap->>Tmux: new-session -d -s primary -n btop
        Tmux->>Session: Create detached primary session
        Session-->>Tmux: success
        Bootstrap->>Tmux: new-window -t primary:1 -n dotfiles
        Tmux->>Session: Add dotfiles window
        Bootstrap->>Tmux: select-layout -t primary:1 even-horizontal
        Bootstrap-->>Fish: Bootstrap complete
    end
    
    alt Inside tmux ($TMUX set)
        Fish->>Tmux: switch-client -t primary
    else Outside tmux
        Fish->>Tmux: attach-session -t primary
    end
    
    Tmux-->>User: Session ready
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • #1297: Directly modifies the same Fish tmux helper functions and their test suite with overlapping bootstrap/migration logic.
  • #1286: Modifies _two_function.fish to implement tmux-resurrect restore logic with fallback bootstrapping.
  • #1475: Updates Makefile host-based build target selection logic with named-host conditional resolution.

Suggested labels

bug

Poem

🐰 Tmux sessions, bootstrapped with care,
No tmuxinator needed anywhere,
Copy, paste, through aliases bright,
Nix-build chooses left or right,
Fish functions hop with newfound flight!

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-keychain

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.

@shunkakinoki
shunkakinoki merged commit 48c77ff into main Apr 15, 2026
28 of 30 checks passed
@shunkakinoki
shunkakinoki deleted the fix-keychain branch April 15, 2026 21:11
@mesa-dot-dev

mesa-dot-dev Bot commented Apr 15, 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 15, 2026

Copy link
Copy Markdown

Mesa Description

TL;DR

Fixed an issue related to the keychain and included several chore updates.

What changed?

Specific file changes are not available, but the PR addresses a keychain fix and contains multiple chore updates.

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 refactors tmux session management by replacing tmuxinator with a custom Fish bootstrap function and updates the Makefile to improve host resolution during Nix builds on Darwin. It also standardizes copy and paste aliases across shell environments and bumps several package dependencies. Feedback was provided regarding _two_function.fish, where the tmux-resurrect restore script is detected before the tmux server is active, which may cause the restoration process to be skipped.

Comment on lines +11 to +21
set -l restore (tmux list-keys 2>/dev/null | string match -rg '(/\S+/resurrect/scripts/restore\.sh)')
set -l restore $restore[1]
set -l bootstrapped 0

# Start a server if needed so we can invoke the restore script.
if not tmux list-sessions 2>/dev/null | grep -q .
# No server running — start one; continuum will auto-restore work session
tmux new-session -d -s _bootstrap
# Give continuum a moment to restore
sleep 3
if tmux has-session -t work 2>/dev/null
tmux kill-session -t _bootstrap 2>/dev/null
if test -n "$TMUX"
tmux switch-client -t work
else
tmux attach-session -t work
set bootstrapped 1
end

if test -n "$restore"

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.

high

The detection of the tmux-resurrect restore script happens before ensuring the tmux server is running. If the server is not already active, tmux list-keys will fail, and the restore variable will be empty. Consequently, the subsequent attempt to restore the session (lines 21-38) will be skipped even if a restore script is configured. The detection should be moved after the bootstrap session is created to ensure the server is reachable.

  set -l bootstrapped 0

  # Start a server if needed so we can invoke the restore script.
  if not tmux list-sessions 2>/dev/null | grep -q .
    tmux new-session -d -s _bootstrap
    set bootstrapped 1
  end

  set -l restore (tmux list-keys 2>/dev/null | string match -rg '(/\S+/resurrect/scripts/restore\.sh)')
  set -l restore $restore[1]

  if test -n "$restore"

@cubic-dev-ai cubic-dev-ai 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.

1 issue found across 20 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="spec/make_build_host_resolution_spec.sh">

<violation number="1" location="spec/make_build_host_resolution_spec.sh:18">
P2: This test can report success even when `make build` fails because `;` makes the shell return the status of `cat` instead of `make`.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

After 'cleanup'

It 'uses an explicit named NixOS host on Darwin builds'
When run bash -c 'make build HOST=matic OS=Darwin ARCH=arm64 DETECTED_HOST=galactica NIX_EXEC=nix NIX_ENV=ok NIX_FLAGS= NIX_USER_TRUSTED=yes 2>/dev/null; cat "$MOCK_LOG"'

@cubic-dev-ai cubic-dev-ai Bot Apr 15, 2026

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.

P2: This test can report success even when make build fails because ; makes the shell return the status of cat instead of make.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At spec/make_build_host_resolution_spec.sh, line 18:

<comment>This test can report success even when `make build` fails because `;` makes the shell return the status of `cat` instead of `make`.</comment>

<file context>
@@ -0,0 +1,31 @@
+After 'cleanup'
+
+It 'uses an explicit named NixOS host on Darwin builds'
+When run bash -c 'make build HOST=matic OS=Darwin ARCH=arm64 DETECTED_HOST=galactica NIX_EXEC=nix NIX_ENV=ok NIX_FLAGS= NIX_USER_TRUSTED=yes 2>/dev/null; cat "$MOCK_LOG"'
+The status should be success
+The output should include '.#nixosConfigurations.matic.config.system.build.toplevel'
</file context>
Fix with Cubic

shunkakinoki added a commit that referenced this pull request Apr 15, 2026
* fix: keychain

* chore: update

* chore: update

* chore: update

* chore: update

* chore: update

* chore: update
shunkakinoki pushed a commit that referenced this pull request Apr 17, 2026
fishtape wraps the remaining arguments of @test with `test`, so

  @test "unknown session returns failure" test \$unknown_status -ne 0

expanded to `test test 1 -ne 0` (5 args) which fish's test rejects,
causing shell-test to fail since PR #1479 introduced this spec.
Drop the literal `test` so fishtape produces `test 1 -ne 0`.
@shunkakinoki shunkakinoki mentioned this pull request Apr 17, 2026
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