Skip to content

[WRONG BRANCH] fix(scripts): run ocx-run commands in the requested workdir - #287

Draft
luvs01 wants to merge 1 commit into
mainfrom
codex/fix-ocx-run-workdir-argument-issue
Draft

[WRONG BRANCH] fix(scripts): run ocx-run commands in the requested workdir#287
luvs01 wants to merge 1 commit into
mainfrom
codex/fix-ocx-run-workdir-argument-issue

Conversation

@luvs01

@luvs01 luvs01 commented Aug 15, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Fix ocx-run so the validated workdir is actually used when launching the job, because previously the wrapped command inherited the caller's current directory and could fail for project-relative commands like bun run test.

Description

  • Update scripts/ocx-run to change into the validated workdir before executing the job by replacing the direct setsid timeout ... "$@" invocation with (cd "$workdir" && exec setsid timeout --signal=TERM --kill-after=60s "$limit" "$@"), while preserving backgrounding, process-group timeout behavior, logging, PID tracking, and status writes.

Testing

  • Ran a focused temporary-directory probe that confirmed the child observed the requested workdir, and ran bun run typecheck, bun run privacy:scan, and git diff --check, all of which completed successfully.

Codex Task

Summary by CodeRabbit

  • Bug Fixes
    • Job commands now run from the configured working directory before execution begins.
    • Improved consistency for commands that depend on relative paths or local files.

@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: fed43580-18ba-4813-8a6e-1138457b6dcb

📥 Commits

Reviewing files that changed from the base of the PR and between 161c09f and 298d625.

📒 Files selected for processing (1)
  • scripts/ocx-run

📝 Walkthrough

Walkthrough

The job launcher now changes to the requested workdir before it starts the command through setsid and timeout.

Changes

Job execution

Layer / File(s) Summary
Apply workdir before launching the job
scripts/ocx-run
Line 128 changes the command sequence so the job enters workdir before execution under setsid and timeout.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: ⚪ Minimal · up to 298d6

The change makes commands run in the validated requested workdir while preserving existing process handling; no actionable merge-blocking risk remains after normal checks and review.

Suggested reviewers: lidge-jun

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: running ocx-run commands in the requested workdir.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-ocx-run-workdir-argument-issue

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the bug Something isn't working label Aug 15, 2026
@github-actions

Copy link
Copy Markdown

Deterministic PR hygiene checks passed.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 298d625629

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/ocx-run
# setsid gives the job its own process group so a timeout kills the children too;
# --kill-after upgrades to SIGKILL for a process that ignores SIGTERM.
setsid timeout --signal=TERM --kill-after=60s "$limit" "$@" > "$log" 2>&1 &
(cd "$workdir" && exec setsid timeout --signal=TERM --kill-after=60s "$limit" "$@") > "$log" 2>&1 &

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Treat hyphen-leading workdirs as paths

When scripts/ocx-run receives a valid relative workdir named -, the preceding -d check succeeds, but Bash interprets cd "-" as a request to switch to $OLDPWD; the wrapped command therefore succeeds in the wrong directory. Other hyphen-leading directory names can instead be parsed as invalid options. Use cd -- "$workdir" (or canonicalize the path) so every validated workdir is treated as a directory operand.

Useful? React with 👍 / 👎.

@github-actions github-actions Bot changed the title fix(scripts): run ocx-run commands in the requested workdir [WRONG BRANCH] fix(scripts): run ocx-run commands in the requested workdir Aug 15, 2026
@github-actions

github-actions Bot commented Aug 15, 2026

Copy link
Copy Markdown

⏳ DRAFT

  • wrong target branch (main); retarget to dev.

What to do

  • Retarget this PR to dev — all contributions go to dev.

Its title has been prefixed with [WRONG BRANCH].
This pull request was already a draft. Its draft status will be preserved after every issue above is resolved.

@github-actions
github-actions Bot marked this pull request as draft August 15, 2026 02:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aardvark bug Something isn't working codex

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant