Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(client-runtime): highlight inline scripts after bundled exec -a options #48261

Opensaphid(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/48261/headopened View on GitHub

Problem

Expanded work-log commands lose syntax highlighting for inline scripts when Bash exec bundles -a with -c or -l. The parser mistakes the alternate process name for the interpreter.

Deterministic repro on origin/main (a75e74eb48d6bb7b758401bc85a8d24d9c690bfa)

From the repo root with dependencies installed:

node --input-type=module <<'JS'
import { embeddedScripts } from './packages/client-runtime/src/work-log/embeddedScripts.ts';
for (const options of ['-ca', '-la', '-lca']) {
  const command = `exec ${options} myname python3 -c 'print(1)'`;
  console.log(options, embeddedScripts(command).map(({ language, text }) => ({ language, text })));
}
JS
  • Observed: All three return [], so the quoted script keeps its shell token styling.
  • Expected: All three detect { language: 'python', text: 'print(1)' } and apply Python token styling to the original script span.

For a work-log fixture, replay an ACP tool_call with kind: "execute" and title and rawInput.command both set to exec -lca myname python3 -c 'print(1)'; expand the command under Worked for. ACP and Codex both store the command as command_execution.input. Live coalescing keeps the latest whole running item, and output-tail limits apply to output, not that input. toolCallLines trims the command before it reaches ShellCommandBlock on web/desktop or CommandCodeText on mobile. Neither renderer discards the embedded styles: both use withEmbeddedScripts to overlay them on the shell tokens.

Change

Treat bundled Bash exec options ending in a and preceded only by c or l as taking the next argument. The parser skips the alternate name and finds the real interpreter for web, desktop, and mobile through their shared client-runtime code. No provider, wire, or copy changes are needed.

Scope

Small fix for an obvious bug; no issue needed under CONTRIBUTING.md.

Verification

  • Base: all three focused cases failed with AssertionError: expected [] to deeply equal [ [ 'python', 'print(1)', …(1) ] ]. Head: all three passed.
  • vp run check:changed exited 0: format, lint, Knip, seven-package typecheck, and all 176 tests in the affected file passed.
  • Before/after Bash and parser transcript: Bash printed 1 for all three commands on both sides; only the patched parser detected the Python script.
  • Not shown: Rendered before/after screenshots; the isolated web scenario stayed on the splash screen before reaching the work log. Desktop shell and native mobile rendering were not exercised.

Authored by GPT-6.2 Sol (Codex); reviewed by Gemini 4 Neon (Antigravity).

Not shown

  • Rendered before/after UI screenshots in web/desktop/mobile were not captured because the isolated web scenario remained on the splash screen (already disclosed in the PR body's Not shown section).
    1. tanstack-source added labelsbug

    2. Approvability

      Verdict: Approved at 7e309a1

      Macroscope's review found this PR approvable — This corrects inline-script highlighting after bundled exec options that consume an argument. Its effects are confined to syntax presentation, without changing command execution or stored data.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    3. Explain Change →

      No actionable comments were generated in the recent review.

      Walkthrough

      The exec command parser now skips the next word for matching attached option bundles. Tests verify Python inline script detection after exec -c, exec -l, and exec -lc.

      Changes: Exec option handling

      Layer / File(s)Summary
      Handle exec option values
      packages/client-runtime/src/work-log/embeddedScripts.ts, packages/client-runtime/src/work-log/embeddedScripts.test.ts
      programIndex skips the next word for matching attached exec option bundles. Tests check Python inline script detection after exec -c, exec -l, and exec -lc.

      Estimated code review effort: 2 (Simple) | ~10 minutes

      Change: Bug fix

      Suggested reviewers: only21mil, iamshadmantaqi

      Merge Risk: Minimal · up to 7e309

      This fixes syntax highlighting for inline Python scripts in expanded work-log commands when exec bundles -a with -c or -l. The change is small and covered by focused tests, and no merge-blocking risk remains.

      Pre-merge checks: Passed 4

      Check nameStatusExplanation
      Title checkPassedThe title names the actual fix: work-log inline scripts lose highlighting when Bash exec bundles -a with -c or -l. The changeset adds a parser rule in embeddedScripts.ts for bundled -[cl]+a options th…
      Description checkPassedThe description follows the template sections: Problem, Change, Scope, and Verification. It gives a deterministic reproduction, names the root cause (the parser takes the alternate process name as the…
      Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
      Full details: Title check

      Explanation

      The title names the actual fix: work-log inline scripts lose highlighting when Bash exec bundles -a with -c or -l. The changeset adds a parser rule in embeddedScripts.ts for bundled -[cl]+a options that skips the alternate process name, plus tests for -ca, -la, and -lca. The title is specific and matches the main change. Its scope is client-runtime, which matches the changed package. The title is a conventional commit at 75 characters.

      Full details: Description check

      Explanation

      The description follows the template sections: Problem, Change, Scope, and Verification. It gives a deterministic reproduction, names the root cause (the parser takes the alternate process name as the interpreter), and explains the fix. Scope says no issue is needed under CONTRIBUTING.md. Verification gives focused before and after results and the check:changed run, and it states what was not checked (rendered screenshots, desktop, and native mobile). The description is long and includes some detail beyond the template, and it cites an agent attribution line, which the template asks for. These are minor issues. The description is mostly complete.

      Finishing Touches

      Generate unit tests (beta)

      • Create a new PR
      • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
      Recent review info

      Run configuration

      Commits

      Reviewing files that changed from the base of the PR and between a75e74eb48d6bb7b758401bc85a8d24d9c690bfa and 7e309a1ed54704a7be34e92d2a0651f130a2c4c9.

      Files selected for processing: 2

      • packages/client-runtime/src/work-log/embeddedScripts.test.ts
      • packages/client-runtime/src/work-log/embeddedScripts.ts

      Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.

Sign in to join this conversation.