You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(tools): preserve attach_to_session through cron handler - #93854
forward attach_to_session from the registered tool handler into cronjob()
include explicitly stored true and false values in agent-facing cron job output
add regression coverage for handler propagation, persistence, update read-back, and list read-back
Problem
The cronjob schema and implementation accept and persist attach_to_session, but the registered tool handler did not forward the argument. Agent-originated attach-only updates therefore reached cronjob() without any update value and returned No updates provided.
Separately, _format_job() omitted the field from tool responses. Even values written through direct callers were therefore invisible in update and list read-back.
Why this change
The registered handler is the path used by agent tool calls, so accepting a field in the schema is not sufficient unless the handler forwards it. Agent-facing output must then faithfully expose both explicit boolean values: false is meaningful because it can override globally enabled delivery mirroring. The field remains omitted for legacy jobs where it was never set, preserving the distinction between "unset" and an explicit boolean value.
Reproduction
Create a cron job without attach_to_session.
Through the registered tool handler, update only attach_to_session.
Observe No updates provided. because the handler drops the argument.
Through a direct caller, persist the value and observe that update and list responses omit it.
Related to #57556, which identified the missing handler forwarding. This focused change also preserves an explicit false value and covers both booleans through the registered handler.
Related: open #57556 already includes the same _format_job() read-back behavior along with the handler passthrough. This PR is the focused output-only subset.
Thanks — #57556 exposed an important second layer of this bug. I have incorporated the missing registered-handler forwarding into this PR and added handler-level regression coverage for both attach_to_session=True and False.
This PR's formatter preserves either explicit boolean value rather than only truthy state, because false can override globally enabled delivery mirroring. The focused cron suite now passes 175 tests.
The attach_to_session handler-forward hole this PR fixes has been salvaged onto current main via #95366 (from #84829, the variant with the explicit-false _format_job guard plus real-store round-trip tests — several open PRs fixed the same one-line hole, and one had to be picked). Closing as a duplicate; thank you for finding and fixing the real bug, and sorry it collided with other submissions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
comp/cronCron scheduler and job managementP2Medium — degraded but workaround existssweeper:risk-session-stateSweeper risk: may lose/corrupt/mis-associate session or context statetype/bugSomething isn't working
3 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
attach_to_sessionfrom the registered tool handler intocronjob()trueandfalsevalues in agent-facing cron job outputProblem
The
cronjobschema and implementation accept and persistattach_to_session, but the registered tool handler did not forward the argument. Agent-originated attach-only updates therefore reachedcronjob()without any update value and returnedNo updates provided.Separately,
_format_job()omitted the field from tool responses. Even values written through direct callers were therefore invisible in update and list read-back.Why this change
The registered handler is the path used by agent tool calls, so accepting a field in the schema is not sufficient unless the handler forwards it. Agent-facing output must then faithfully expose both explicit boolean values:
falseis meaningful because it can override globally enabled delivery mirroring. The field remains omitted for legacy jobs where it was never set, preserving the distinction between "unset" and an explicit boolean value.Reproduction
attach_to_session.attach_to_session.No updates provided.because the handler drops the argument.Testing
ruff check tools/cronjob_tools.py tests/tools/test_cronjob_tools.pyscripts/run_tests.sh tests/tools/test_cronjob_tools.py tests/cron/test_scheduler.py tests/cron/test_cronjob_schema.py— 175 passedRelated work
Related to #57556, which identified the missing handler forwarding. This focused change also preserves an explicit
falsevalue and covers both booleans through the registered handler.Platform tested