Skip to content

fix(config): honor terminal.shell at startup spawn (CTX-0295 finding) #495

Closed

Description

@Xuepoo

Priority: P1 | Area: config | Labels: fix,area:config,P1 | Milestone: v0.1.0 | Task: CTX-0298

Context

CTX-0295's configuration verification matrix (recording/ctx-0295/config-matrix.md, row 9) found terminal.shell DEAD: the knob is parsed (Lua + file), validated, merged by scalar-replace, attributed, reload-classified RestartRequired, and trust-gated (trust.rs rejects it in project layers), but no consumer reads effective.terminal.shell. Startup used only the CLI program or $SHELL (crates/bitty-app/src/main.rs), so the knob had no effect.

Root cause

The startup spawn path resolves the program via resolve_spawn_program / resolve_default_shell / SpawnSpec::resolve, which consult only args.program and $SHELL. app_config.effective.terminal.shell was read only by bitty config check for display.

Fix

  • Wire the effective configured shell into the startup spawn path and the frozen SpawnSpec replayed by split panes / headless fallback.
  • Precedence: explicit CLI program > configured terminal.shell > $SHELL > /bin/sh.
  • Direct argv[0] throughout: no shell interpolation, no word splitting. The trust gate (project layers may not declare terminal.shell) is unchanged.
  • Fail-closed: config validation now also rejects control characters in terminal.shell; the spawn resolver trims and skips blank, oversized, or control-laden values, falling through to the next layer. A configured shell that fails to spawn retries /bin/sh, matching the existing $SHELL failure path.

Acceptance criteria

  • Effect-level spawn test proves the configured shell is executed as argv[0] (marker side effect), configured shell outranks $SHELL, blank config fails closed to $SHELL, and a missing configured shell falls back to /bin/sh.
  • terminal.shell control-character validation covered by unit tests.
  • just check, full workspace tests, Windows target check, actionlint, and CI green.
  • Documentation: no terminal.shell reference exists in bitty-docs (configuration docs are candidate schema only); CHANGELOG entry added in-repo.
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

    P1area:configfix

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions