Skip to content

WIP: fix(startup): own-invocation shape + respawn door for the startup funnel (rubash#2129 companion) - #699

Merged
caomengxuan666 merged 1 commit into
masterfrom
fix/2129-niu-startup-carrier
Oct 29, 2026
Merged

caomengxuan666 merged 1 commit into
masterfrom
fix/2129-niu-startup-carrier

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

WIP: niu companion fix for the rubash#2129 P0 — the field path (implements §6 of the engine-side fix report in ~/workspace/fix-2129-p0/REPORT.md; stands alone against current engine master, no dependency on rubash PR #2138).

Defect

niu's entry classification was clean (argv-only ShellInvocation parse), but the startup funnel trusted the inherited env carrier: login_shell_active() read __RUBASH_LOGIN_SHELL back from the session executor, consumed at run_startup_files (login → profile chain replaces the rc branch) and source_non_interactive_env (the -c route). Nothing scrubbed an inherited carrier, niu never consulted the respawn state, and the funnel had no run-once guard — so the #2129 recursion reproduces verbatim on niu: profile chains into rc → fzf procsub line → next niu -c generation inherits the carrier → profile again.

Fix (3 parts, per the §6 spec)

  1. Carrier normalization. Login classification is host state (Shell::own_login_shell): argv[0] - seed at construction, invocation.login at apply_invocation_before_startup, or the legacy -c -l route's new mark_own_login_shell door. login_shell_active() reads the field; the carrier is a write-only projection for engine faces. At construction, an inherited __RUBASH_LOGIN_SHELL is scrubbed (unset_env, already ledgered) unless own argv earned login, and an inherited __RUBASH_INTERACTIVE is scrubbed unconditionally — every face that earns the interactive shape writes it after classification.
  2. Respawn gate. Construction snapshots the respawn state once, from the same marker pair the engine tests at Executor::new (__RUBASH_COPROC_CHILD / __RUBASH_SHELL_PID) — no new rubash API token consumed. Both funnel entries source NOTHING for a respawned child (the parent session already ran startup).
  3. Pins — tests/issue2129_startup_carrier.rs (8 tests, watchdog-bounded, counter-file counting): carrier adoption on the -c route (single + both markers), respawn sourcing nothing on both funnels (both marker spellings), guards for own -l (engine -lc, legacy -c -l, --login -c) and for a genuine nested interactive child keeping its own rc branch, plus the fzf-shape e2e. Baseline: 6 red — the e2e hit the 30 s watchdog with 527–549 generations and a live linear niu chain in ps; fixed: 8/8 green, rc body in exactly one generation.

The two niubash#422 unit tests that modeled login by planting the carrier now set the host classification field (the seam they were modeling).

Verification

  • Runtime lib suite: 678 passed / 21 failed on baseline AND fixed trees — identical failure name sets (pre-existing Linux-box environment failures; logs in the cluster REPORT).
  • Startup-adjacent integration suites all green: startup_files 29, issue587 4, issue588 3, issue590 3, issue591 5, issue603 5, issue694 12, issue404_406 3, issue562 6, rc_readonly_loader 14, theme_preview_channel 6.
  • cargo build --locked --workspace --all-targets green; fmt clean; CR=0.

Full report: ~/workspace/fix-2129-niu/REPORT.md.

Fixes unixwin/rubash#2129
Refs unixwin/rubash#2133

…nel (rubash#2129)

The niu-side companion to the rubash#2129 P0: the startup funnel
read the exported __RUBASH_LOGIN_SHELL carrier back, so a child
that merely inherited it (the procsub respawn out of an rc file —
fzf's completion.bash shape) adopted the parent's login shape,
re-ran the profile chain, and recursed without bound.

- Login classification is host state now (Shell::own_login_shell):
  argv[0] '-' seed, the ShellInvocation parse, or the legacy
  -c -l mark (new mark_own_login_shell door). login_shell_active
  reads the field; the carrier is a write-only projection.
- Carrier normalization at construction: an inherited
  __RUBASH_LOGIN_SHELL is scrubbed unless own argv earned login;
  an inherited __RUBASH_INTERACTIVE is scrubbed unconditionally
  (every interactive face re-writes it after classification).
- Respawn door: construction snapshots the engine's respawn marker
  pair (__RUBASH_COPROC_CHILD / __RUBASH_SHELL_PID, read once, no
  new API token); both funnel entries source nothing for a
  respawned child — the parent session already ran startup.
- Pins: tests/issue2129_startup_carrier.rs (8 tests, watchdog-
  bounded, counter-file counting). Baseline: 6 red incl. the
  fzf-shape e2e (527-549 generations in 30s); fixed: 8/8 green
  with the rc body in exactly one generation. The two #422 unit
  tests that modeled login by planting the carrier now set the
  host classification field.
@caomengxuan666
caomengxuan666 marked this pull request as ready for review October 29, 2026 17:07
@caomengxuan666
caomengxuan666 merged commit a3d8871 into master Oct 29, 2026
8 of 12 checks passed
@caomengxuan666
caomengxuan666 deleted the fix/2129-niu-startup-carrier branch October 30, 2026 01:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant