Skip to content

Show real shell identity in Kandelo's default prompt - #1246

Open
brandonpayton wants to merge 14 commits into
mainfrom
emdash/fancier-default-shell-kbzu2
Open

Show real shell identity in Kandelo's default prompt#1246
brandonpayton wants to merge 14 commits into
mainfrom
emdash/fancier-default-shell-kbzu2

Conversation

@brandonpayton

Copy link
Copy Markdown
Member

Why

Kandelo's default shell prompt is currently a fixed kandelo$. It does
not show which account owns the shell or where that shell is working.
That makes sessions harder to understand today and will become
misleading as real login support introduces more than one user.

The kernel and root filesystem also report a generic hostname, while
the browser used to inject its own prompt. Shell identity should come
from the guest's real account, hostname, and working directory instead
of a presentation-layer substitute. Browser Guide commands also need
a reliable completion boundary because ordinary command output may
itself end in $ or # .

This change gives users a compact prompt that exposes the state they are
actually operating in:

user@kandelo ~/path ❯

What changed

  • Set the kernel nodename and /etc/hostname default to kandelo.
  • Add an interactive-Bash profile using Bash's \u, \h, and \w
    expansions, so the user, real hostname, and current directory stay
    dynamic.
  • Render user and host in cyan, the directory in blue, and the prompt
    glyph in green for ordinary users or red for root.
  • Keep a plain \u@\h \w \$ prompt for TERM=dumb and leave Dash and
    noninteractive shells unaffected.
  • Remove the browser's synthetic PS1 and preserve exact configured
    prompts and conservative custom-shell readiness paths.
  • Add OSC 133 prompt boundaries to the styled default. Once a session
    proves marker support, Guide commands wait for the trailing B
    boundary instead of accepting prompt-looking command output.
  • Classify the current complete terminal-history suffix after
    synchronous replay. This also prevents completed readiness listeners
    from leaking.
  • Advance the kernel, rootfs, shell, and source-image package revisions
    and regenerate the package projection so stale hostname or prompt
    artifacts cannot retain a valid identity.
  • Document the user-visible hostname, prompt, privilege, fallback, and
    readiness contracts.

Node.js and browser hosts share the readiness implementation. The
Node.js source-image smoke test verifies the image-owned hostname and
profile. Chromium and WebKit exercise the visible prompt and terminal
command path.

This does not change the application binary interface (ABI), so
ABI_VERSION is unchanged.

Validation

Fresh final-tree checks through scripts/dev-shell.sh:

  • kernel uname hostname unit: 1 passed, 1,248 filtered;
  • focused readiness, session, rootfs, and source-image Vitest:
    130 passed;
  • Chromium shell, Bash, Vim, and NetHack flow: 1 passed;
  • WebKit shell-input flow: 1 passed;
  • generated program-package projection: no drift;
  • ABI snapshot, C header, and TypeScript bindings: consistent; and
  • git diff --check origin/main...HEAD: clean.

Earlier validation on this branch also passed all 1,249 kernel unit
tests, the mandatory Node.js source-image smoke test, and manual
Chromium checks for the initial prompt, /tmp directory update, colors,
effective user, hostname, terminal focus, and Guide completion.

Two independent final reviews found no Critical, Important, or Minor
issues.

Known limitations

  • The repository-wide Vitest inventory remains red with nine executed
    test failures and 21 collection failures. The recorded failures
    concern package provenance, artifact closure, unavailable fixtures,
    and existing runtime timeouts outside this prompt path.
  • The two focused Sortix cases remain red with one failure and one
    timeout in the current artifact/runtime environment.
  • The normal ./run.sh browser launcher stops before app launch because
    the Homebrew shell package still awaits its immutable bottle
    selection. The focused Chromium and WebKit runs above use coherent
    local artifacts.
  • Broader browser inventories were not rerun. Performance was not
    measured.
  • The existing environment still exports USER=player while the
    effective account is user. The prompt intentionally uses Bash's
    \u, which follows the effective account. Reconciling that
    environment variable belongs to the upcoming login work.

The uname nodename change alters kernel Wasm bytes, but revision 1
still allowed fetched localhost kernels under the current cache
identity.

Advance the kernel package revision, regenerate dependent projection
keys, and protect the metadata contract with a focused regression test.

Validated the uname unit test, rootfs contract, projection checker,
ABI check, and changed-test formatting. Broader Task 5 suites remain
outside this focused correction.
Remember how the existing shell prompt was recognized before starting a
queued guide command. When that prompt ended with OSC 133 B, require the
same boundary for completion so command output ending in `$ ` or `# `
cannot advance the queue early.

Keep exact configured prompts and conservative fallbacks for shells that
do not demonstrate marker support.
Accumulate synchronous PTY history before choosing the current prompt
boundary. This prevents an older fallback or marker prompt from deciding
the mode after the user changes prompt behavior.

Classifying only after onData returns also ensures the replay-time wait
has a real unsubscribe function, so completed guide commands do not leak
listeners.
@github-actions

Copy link
Copy Markdown
Contributor

Phase B-1 matrix build status — pr-1246-staging-run-31449474154-attempt-1

ABI v42. 0 built, 2 failed, 2 total.

Package Arch Status Sha
kernel wasm32 failed
rootfs wasm32 failed

Auto-generated; replaced on each push. Raw data in the publish-status workflow artifact.

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