Skip to content

fix(shell): preserve heredoc contexts and reject arithmetic placeholders - #8342

Open
waleedlatif1 wants to merge 7 commits into
stagingfrom
codex/shell-placeholder-context-safety
Open

waleedlatif1 wants to merge 7 commits into
stagingfrom
codex/shell-placeholder-context-safety

Conversation

@waleedlatif1

@waleedlatif1 waleedlatif1 commented Sep 26, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Preserve shell quote state across heredocs and track direct environment reads inside expanding bodies without treating literal bodies or delimiters as reads.
  • Reject placeholders in Bash arithmetic syntax ($((...)), $[...], ((...)), array subscripts, numeric [[ ... ]] comparisons, and statically named let arguments), including nested substitutions, before Bash can re-evaluate their values.
  • Share arithmetic context ancestry so nested placeholders do not duplicate scanner stacks.
  • Preserve array-shaped command arguments while rejecting actual array assignments, including those following comments. Keep redirection paths outside builtin arithmetic argument contexts.

Type of Change

  • Bug fix

Testing

  • Compiler and scanner suites: 185 passed, 3 existing skips; Bash runtime regressions cover literal arguments and direct environment reads.
  • Verified regressions fail on the original compiler and independently disabled each fix to confirm its tests fail.
  • Application type-check, lint, all 51 audits, block registry audit, and docs manifest check passed.
  • Regenerated agent stream docs, docs manifest, and skill links; no generated changes.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Sep 26, 2026 10:28pm UTC

Request Review

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@greptile-apps

greptile-apps Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Adds validation to reject placeholders in shell arithmetic contexts.

The PR appears safe to merge; no outstanding previous finding or actionable new issue remains.

Summary

The PR updates the shell placeholder scanner to preserve context across heredocs, recognize arithmetic positions, and distinguish array assignments from literal arguments. It adds compiler and runtime regressions for those cases.

Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Source[Shell source] --> Scan[Scan quote, command, and heredoc contexts]
  Scan --> Classify{Placeholder context}
  Classify -->|Arithmetic| Reject[Reject bound placeholder]
  Classify -->|Supported shell text| Compile[Compile binding]
  Classify -->|Literal heredoc or delimiter| Preserve[Preserve literal text]
Loading

Reviews (7) · Last reviewed commit: "fix(shell): preserve placeholders in let..."

Comment thread apps/sim/lib/execution/code-placeholders/shell.ts
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

Comment thread apps/sim/lib/execution/code-placeholders/shell.ts
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 2 files

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread apps/sim/lib/execution/code-placeholders/shell.ts
Comment thread apps/sim/lib/execution/code-placeholders/shell.ts
@waleedlatif1
waleedlatif1 force-pushed the codex/shell-placeholder-context-safety branch from 934b442 to b9b0e8c Compare September 26, 2026 22:04
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 2 files

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread apps/sim/lib/execution/code-placeholders/shell.ts Outdated
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

Comment thread apps/sim/lib/execution/code-placeholders/shell.ts
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

Comment thread apps/sim/lib/execution/code-placeholders/shell.ts
@waleedlatif1
waleedlatif1 force-pushed the codex/shell-placeholder-context-safety branch from d19f0ad to 29d9576 Compare September 26, 2026 22:28
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

This branch was previously deployed

1 inactive deployment
Preview — 29d95762 Deployed Sep 26, 2026 by vercel[bot]
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