docs: document set_working_directory relative path contract in runner AGENTS.md#22399
docs: document set_working_directory relative path contract in runner AGENTS.md#22399github-actions[bot] wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 51fe448183
ℹ️ 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".
|
|
||
| **Pull-step directory fallback:** When pull steps run but none produces a `directory` output or changes CWD, `_ensure_entrypoint_in_workspace` copies storage into the workspace root as a fallback. This handles setup-only pull steps (e.g., `run_shell_script` for environment prep) that do not control the working directory themselves. | ||
|
|
||
| **`set_working_directory` relative path contract:** Before running pull steps, the resolver sets `_PULL_STEP_SOURCE_CWD` (from `deployments/steps/core.py`) to the original process CWD. `set_working_directory` resolves relative paths against this context var when set. The var is cleared after each step (in the step completion callback), so only the *first* `set_working_directory` call in a sequence sees the original CWD — subsequent calls resolve against the CWD left by preceding steps (e.g., the workspace root after a `git_clone`). This enables `set_working_directory: "."` in a baked-image deployment to point to the container WORKDIR rather than the temporary workspace root. |
There was a problem hiding this comment.
Put this contract in an AGENTS scope that covers it
This new note documents a contract shared with src/prefect/deployments/steps/core.py and pull.py, but src/prefect/runner/AGENTS.md only applies to files under src/prefect/runner/. That means future changes to set_working_directory or _PULL_STEP_SOURCE_CWD in deployments/steps will not see the instruction, which defeats the stated purpose of preserving this cross-module behavior. Please move or duplicate the contract into an AGENTS.md whose scope includes the deployments step files, such as the common src/prefect/AGENTS.md or a new scoped file under src/prefect/deployments/steps/.
Useful? React with 👍 / 👎.
Automated AGENTS.md update triggered by commit 6da5a09.
This PR was generated by Claude Code analyzing the diff from the latest push to main and updating any stale AGENTS.md files.
Why this belongs in AGENTS.md
Changed files in triggering push