Setting the execution bit only if it's not set#61
Setting the execution bit only if it's not set#61tisnik merged 1 commit intolightspeed-core:mainfrom
Conversation
…rts the pod with a random user. If the user has already execute permission then it is not needed to set it. Not setting the permissions can prevent the error in an openshift pod.
WalkthroughIntroduces a guard in script preparation to check if the script is already executable before applying chmod(755), modifying the control flow to conditionally set executable permissions. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant SR as ScriptRunner
participant OS as OS/Filesystem
SR->>OS: Resolve script path
SR->>OS: Check executability (os.access(path, X_OK))
alt Already executable
OS-->>SR: true
note right of SR: Skip chmod
else Not executable
OS-->>SR: false
SR->>OS: chmod(path, 0o755)
OS-->>SR: permissions updated
end
SR-->>SR: Proceed with script run
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
lsc_agent_eval/src/lsc_agent_eval/core/agent_goal_eval/script_runner.py (1)
45-46: Drop redundantresolve()call before access check.You already resolved the path a few lines up; handing the existing
Pathobject toos.accessavoids the second filesystem lookup and keeps things tidy.os.accesshappily accepts path-like objects.- if not os.access(str(script_path.resolve()), os.X_OK): + if not os.access(script_path, os.X_OK):
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
lsc_agent_eval/src/lsc_agent_eval/core/agent_goal_eval/script_runner.py(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-07-16T12:07:29.169Z
Learnt from: asamal4
PR: lightspeed-core/lightspeed-evaluation#19
File: lsc_agent_eval/tests/core/agent_goal_eval/test_script_runner.py:0-0
Timestamp: 2025-07-16T12:07:29.169Z
Learning: In the lsc_agent_eval package, the ScriptRunner class was modified to use absolute paths internally rather than documenting path normalization behavior, providing more predictable and consistent path handling.
Applied to files:
lsc_agent_eval/src/lsc_agent_eval/core/agent_goal_eval/script_runner.py
If it is run in an OpenShift pod then it fails, because OpenShift starts the pod with a random user. If the user has already execute permission then it is not needed to set it. Not setting the permissions can prevent the error in an OpenShift pod.
Summary by CodeRabbit