Skip to content

fix(setup): link design/dist and make-pdf/dist into Codex runtime roots (#1159) - #2891

Open
mamedov wants to merge 1 commit into
garrytan:mainfrom
mamedov:fix/codex-runtime-root-design-pdf
Open

mamedov wants to merge 1 commit into
garrytan:mainfrom
mamedov:fix/codex-runtime-root-design-pdf

Conversation

@mamedov

@mamedov mamedov commented Sep 17, 2026

Copy link
Copy Markdown

Why (in your own words)

On a Codex install, gstack-design-shotgun, gstack-design-consultation, gstack-plan-design-review and gstack-make-pdf report DESIGN_NOT_AVAILABLE / MAKE_PDF_NOT_AVAILABLE even though ./setup built both binaries. The generated Codex preflights look in two places: the repo-local sidecar .agents/skills/gstack/{design,make-pdf}/dist and the global root via $GSTACK_DESIGN / $GSTACK_MAKE_PDF, which point at ~/.codex/skills/gstack/{design,make-pdf}/dist. Neither create_codex_runtime_root() nor create_agents_sidecar() ever linked those directories, so the design flow silently degrades to HTML wireframes. This PR links design/dist and make-pdf/dist into both roots. It links dist/ only, because make-pdf/ ships its own SKILL.md that Codex would pick up as a duplicate skill. It also updates hosts/codex.ts runtimeRoot so the host metadata matches what setup installs, following the opencode precedent. This covers problems 2 and 3 from #1159. Problem 1 ($HOME$GSTACK_*) was already fixed in v1.64.0.0.

Live evidence

create_codex_runtime_root() from main vs this branch, run into an empty HOME against a real built install (gstack v1.87.4.0, macOS arm64), then the DESIGN SETUP and MAKE-PDF SETUP blocks copied verbatim from the generated Codex gstack-design-shotgun and gstack-make-pdf skills, each in a fresh bash with only HOME, PATH, GSTACK_DESIGN, GSTACK_MAKE_PDF set:

--- setup from main: ls ~/.codex/skills/gstack ---
bin browse ETHOS.md gstack-upgrade lib office-hours review SKILL.md supabase
DESIGN_NOT_AVAILABLE
MAKE_PDF_NOT_AVAILABLE (run './setup' in the gstack repo to build it)
--- setup from branch: ls ~/.codex/skills/gstack ---
bin browse design ETHOS.md gstack-upgrade lib make-pdf office-hours review SKILL.md supabase
DESIGN_READY: ~/.codex/skills/gstack/design/dist/design
MAKE_PDF_READY: ~/.codex/skills/gstack/make-pdf/dist/pdf

In a real Codex session (codex-cli 0.154.0) with the same two links in place, the verbatim DESIGN SETUP block run through codex exec returns DESIGN_READY: /Users/<me>/.codex/skills/gstack/design/dist/design, provided GSTACK_DESIGN reaches the shell call (see "Not addressed here" below).

New regression test, run against the unfixed setup and then the fixed one:

$ bun test test/setup-codex-design-pdf-runtime.test.ts   # setup from main
(fail) codex global root (symlink install): design and make-pdf preflights report READY
(fail) codex global root (Windows copy install): design and make-pdf preflights report READY
(fail) agents sidecar (symlink install): design and make-pdf preflights report READY
(fail) agents sidecar (Windows copy install): design and make-pdf preflights report READY
 2 pass
 4 fail

$ bun test test/setup-codex-design-pdf-runtime.test.ts   # this branch
 6 pass
 0 fail

The test builds each root with the real setup shell functions, then runs the exact bash block that generateDesignSetup / generateMakePdfSetup emit for Codex in a fresh process, and asserts *_READY. It also asserts make-pdf/SKILL.md and design/src do not leak into either root. A negative control runs the pre-fix layout and expects *_NOT_AVAILABLE.

Full free suite (bun run test) on this branch fails in 63 files (CSO, PTY, autoplan, plan-count and similar), none of which exercise setup host roots. I ran the same 63 files on untouched main (a6b3a575) on the same machine and they fail there too (323 failing tests). Comparing failing test names, the branch added none. The two name-level differences were a secret-scan timing test that passes on rerun, and the sync-spawn timeout tripwire, which caught a missing timeout in the new test and is fixed in this commit. Targeted run on the branch:

$ bun test test/setup-codex-design-pdf-runtime.test.ts test/setup-runtime-lib-command.test.ts \
    test/host-config.test.ts test/spawnsync-timeout-tripwire.test.ts
 97 pass
 0 fail

Scope

  • Changed: setup: create_codex_runtime_root() and create_agents_sidecar() link design/dist and make-pdf/dist. hosts/codex.ts: runtimeRoot lists what setup installs. New test/setup-codex-design-pdf-runtime.test.ts.
  • Verified live by: building the Codex root with main and branch setup against a real install and running the generated preflights, plus a codex exec session on macOS arm64, as above.
  • Did NOT test: a real Windows host, where the copy branch is covered only by the IS_WINDOWS=1 test cells. A full ./setup --host codex run from this branch on a clean machine was not done either.

Not addressed here, needs a maintainer call (details in #1159): Codex runs each shell tool call in a fresh process, so the GSTACK_* variables the generated preamble sets are empty in later blocks. With this PR the binaries are in place, but a skill run still resolves D="/design" unless those variables reach every call, for example via [shell_environment_policy.set] in ~/.codex/config.toml. Options are sketched in the issue comment.

Liveness proof (required for external contributors)

Authenticated GitHub login verified with gh api user --jq .login: mamedov. GSTACK PR typed live into my terminal prompt:

GSTACK PR typed live in a terminal

The code, tests and this description were prepared with Claude Code at my direction; I reviewed the result.

Checklist

🤖 Generated with Claude Code

https://claude.ai/code/session_01MwmFu1FwFwji6XSmnY7315

…ts (garrytan#1159)

Generated Codex design and make-pdf skills resolve their binaries from
.agents/skills/gstack/{design,make-pdf}/dist first, then from
$GSTACK_DESIGN / $GSTACK_MAKE_PDF under ~/.codex/skills/gstack. Neither
create_codex_runtime_root() nor create_agents_sidecar() linked those
directories, so both preflights reported *_NOT_AVAILABLE on a fresh
Codex install even though setup had built the binaries.

Link dist/ only: make-pdf/ ships its own SKILL.md, which Codex would
discover as a duplicate skill. hosts/codex.ts runtimeRoot now lists what
setup installs, matching the opencode precedent.

The new test builds both roots with the real setup functions and runs the
exact preflight blocks the generator emits for Codex in a fresh process.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MwmFu1FwFwji6XSmnY7315
@trunk-io

trunk-io Bot commented Sep 17, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

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