fix: sourced helpers share one self-locate block and fail loudly when they cannot locate themselves (#3024 rework)

The codex probe and the egress lib now carry one byte-identical block:
BASH_SOURCE under bash or %x under zsh, made absolute with $PWD, else a set
GSTACK_ROOT that holds the helper. Anything else (dash, sh, a shell that
cannot name the file) prints "gstack: cannot locate <helper> (shell: ...)"
with the docs/troubleshooting.md#sourced-helper-location URL and returns
before any bash- or zsh-only syntax. The Claude-only default path and the
$(pwd) fallback are gone.

The generated Codex preflight dot-sources the probe and, when it cannot load,
reports CODEX_MODE: helper_unavailable with the helper's own line instead of
falling through to not_authed. The class guard enumerates nested sources,
makes real resolver, auth, state-root and egress-home calls under bash and
zsh (absolute, relative then cd, bare name via PATH), covers dash and an
unknown shell, runs the full preflight, and lints BASH_SOURCE to the shared
block plus other bash-only constructs.

Co-authored-by: marcosdetry <marcosdetry@users.noreply.github.com>
Co-authored-by: akshaykalia <akshaykalia@users.noreply.github.com>
Co-authored-by: scottgigante-hubflow <scottgigante-hubflow@users.noreply.github.com>
Co-authored-by: woodsonl <woodsonl@users.noreply.github.com>
Co-authored-by: bezdekt <bezdekt@users.noreply.github.com>
This commit is contained in:
committed 2026-10-06 20:41:50 +00:00
1 parent a08cb03782
commit 5884117c02
16 files changed
+344 -74

No files matched your search

+5
View File
@@ -68,6 +68,11 @@ export const GATE_OUTCOMES = {
summary: "Codex refused the call for this account's usage or rate limit",
fix: "wait for the reset time in Codex's message above, or add credits or a higher plan for that account; the model choice is fine",
},
helper_unavailable: {
state: 'unavailable', anchor: 'sourced-helper-location',
summary: 'the gstack Codex helper could not be loaded into this shell',
fix: 'run the skill from bash or zsh, or export GSTACK_ROOT=<install dir>; if the helper file is missing, re-run ./setup (https://github.com/garrytan/gstack/blob/main/docs/troubleshooting.md#sourced-helper-location)',
},
probe_inconclusive: {
state: 'ran', anchor: 'codex-mode-unverified',
summary: 'the Codex model check timed out or hit a network error, so readiness is unverified',