Skip to content

fix: thread step_name to run_task for wrap-action support - #1039

Merged
seant-aws merged 1 commit into
aws-deadline:mainlinefrom
seant-aws:wrap-actions-step-name
Aug 6, 2026
Merged

fix: thread step_name to run_task for wrap-action support#1039
seant-aws merged 1 commit into
aws-deadline:mainlinefrom
seant-aws:wrap-actions-step-name

Conversation

@seant-aws

Copy link
Copy Markdown
Contributor

What was the problem/requirement? (What/Why)

openjd-sessions raises a ValueError when a task runs while a wrap environment (RFC 0008 WRAP_ACTIONS) is active and no step_name is given, because WrappedStep.Name has no value to render. The worker agent never passed step_name — the step template's name is available at the call site and was simply dropped — so a job that entered a wrap environment and then ran a task failed mid-session.

What was the solution? (How)

Thread step_name from the step template through Session.run_task, the SessionRuntime interface, and the Python adapter down to openjd.sessions.Session.run_task (the pinned openjd-sessions == 0.10.11 already accepts it). The argument is keyword-only and optional so the interface and both adapters stay uniform and existing callers are unaffected.

The Rust adapter accepts the argument but does not forward it yet: the pinned openjd-sessions release's _v1 wrapper does not expose the kwarg. OpenJobDescription/openjd-sessions-for-python#345 adds the forward upstream; a follow-up will bump the pin and wire it through once that ships.

What is the impact of this change?

The Python runtime is correct for RFC 0008 task runs. Inert for all existing jobs — openjd only reads step_name inside an active wrap hook, which cannot occur today since no extension is requestable end-to-end yet. No API or behavior change for callers that omit the argument.

How was this change tested?

  • hatch build — clean
  • hatch run all:test — 3050 passed / 39 skipped on each of Python 3.9, 3.10, and 3.11
  • hatch run lint — ruff check, ruff format, and mypy all clean
  • New test/unit/sessions/test_step_name_threading.py covers the threading at each layer (action → session → ABC → both adapters), asserting the literal step name arrives at the openjd session and that the Rust adapter accepts the kwarg without forwarding it

Was this change documented?

Yes — docstrings/comments on the interface and both adapters explain the parameter and why the Rust adapter defers forwarding.

Is this a breaking change?

No — a new optional keyword-only parameter with a None default at every layer.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

openjd-sessions raises when a task runs while a wrap environment is
active and no step_name is given, because RFC 0008's WrappedStep.Name
has no value to render. The agent never passed step_name, so a job that
entered a wrap environment and then ran a task failed.

Thread step_name from the step template through Session.run_task, the
SessionRuntime interface, and the Python adapter to the underlying
openjd session. The argument is keyword-only and optional so the
interface and both adapters stay uniform and existing callers are
unaffected.

The Rust adapter accepts the argument but does not forward it yet: the
pinned openjd-sessions release's v1 wrapper does not expose the kwarg.
No wrap-action job can reach either runtime today, since the service
does not yet accept extension requests at job submission.

Signed-off-by: Sean Tang <171081544+seant-aws@users.noreply.github.com>
@github-actions github-actions Bot added the waiting-on-maintainers Waiting on the maintainers to review. label Aug 5, 2026
@seant-aws
seant-aws marked this pull request as ready for review August 5, 2026 22:41
@seant-aws
seant-aws requested a review from a team as a code owner August 5, 2026 22:41
task_parameter_values=task_parameter_values,
os_env_vars=os_env_vars,
log_task_banner=log_task_banner,
step_name=step_name,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

step_name is forwarded unconditionally to self._session.run_task(...) (the real openjd.sessions.Session from the pinned openjd-sessions == 0.10.11). If that pinned release's Session.run_task does not accept a step_name keyword, this raises TypeError at runtime for every task run on the Python runtime.

This is worth double-checking because rust.py (lines 311-314) explicitly states the pinned release "does not expose the kwarg yet." The distinction drawn there is between the Rust _v1 wrapper and the native session — but the Python Session comes from the same pinned package, so please confirm 0.10.11's Session.run_task really does accept step_name.

Note the unit test test_run_task_when_step_name_provided_forwards_to_openjd_session patches OpenJDSession with a MagicMock, which accepts any kwargs — so it would pass even if the real signature rejects step_name, and cannot catch this mismatch.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@seant-aws
seant-aws merged commit 66ecb5c into aws-deadline:mainline Aug 6, 2026
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

waiting-on-maintainers Waiting on the maintainers to review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants