Skip to content

fix(cli): tri ui command fails with FileNotFound - PATH not passed to subprocess #396

Closed

Description

@gHashTag

Bug

tri ui command fails with error:
swift build failed: FileNotFound

Root Cause

In src/tri/tri_commands.zig, the uiBuild function calls std.process.Child.run but does NOT pass the current environment to the subprocess:

zig const result = std.process.Child.run(.{ .allocator = allocator, .argv = &.{ "swift", "build" }, .cwd = "apps/queen", .max_output_bytes = 256 * 1024, // ❌ Missing: .env = ... or .has_env = true })

Expected Behavior

When tri ui is run, it should:

  1. Kill old Trinity.app processes
  2. Run swift build in apps/queen directory
  3. Copy binary to Trinity.app bundle
  4. Open Trinity.app

Actual Behavior

Step 2 fails with FileNotFound because the subprocess doesn't inherit PATH from the parent process.

Workaround

Launch Queen UI directly:
bash ./.build/arm64-apple-macosx/debug/trinity

Fix Required

Add environment inheritance to uiBuild function. In Zig 0.15.x, the correct API needs to be determined (tested: .has_env, .env = std.process.Child.Env.from_current_process, absolute paths - none worked).

Priority: P2 (medium) - workaround exists

Activity

  1. gHashTag commented on Mar 23, 2026

    @gHashTag
    OwnerAuthor

    ✅ Status: COMPLETE

    Fixed both issues:

    1. tri ui PATH inheritance (see commit 3768aad)

      • Added std.process.getEnvMap() to pass environment to subprocess
      • .env_map = &env_map in std.process.Child.run()
    2. TRI-27 golden test (same commit)

      • Fixed loader memory packing (4 bytes per word, not 1 per word)
      • Fixed PC initialization (offset 10 = word 2)
      • Fixed CPUState typo in test_golden.zig
      • Fixed assembler size field reservation

    Result: zig build test-tri27-golden now passes ✅

    φ² + 1/φ² = 3 | TRINITY

  2. gHashTag commented on Mar 23, 2026

    @gHashTag
    OwnerAuthor

    Closing issue - both parts fixed and committed

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions