Repository navigation
fix(cron): treat TinySecurity's policy refusals of a shell job as final #8583
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
senamakel
merged 2 commits into
tinyhumansai:main
from
M3gA-Mind:fix/ts-e2e-031-cron-policy-refusal-final
Nov 6, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
35 changes: 35 additions & 0 deletions
35
crates/openhuman-core/src/cron/scheduler/shell_job_tests.rs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| use super::*; | ||
| use crate::security::policy::Refusal; | ||
|
|
||
| #[test] | ||
| fn a_policy_refusal_is_final_for_the_retry_loop() { | ||
| // TS-E2E-031: these used to reach the retry loop as "[policy-blocked] …", | ||
| // which it retried as if waiting could change the policy's answer. | ||
| for refusal in [ | ||
| Refusal::Protected, | ||
| Refusal::ReadOnly, | ||
| Refusal::Hidden, | ||
| Refusal::NotAllowed, | ||
| Refusal::HighRisk, | ||
| Refusal::Category, | ||
| Refusal::LocalOnly, | ||
| ] { | ||
| let output = refusal_output(refusal); | ||
| assert!( | ||
| output.starts_with(POLICY_REFUSAL_PREFIX), | ||
| "{refusal:?} must be final: {output}" | ||
| ); | ||
| assert!(output.ends_with(&refusal.to_string()), "{output}"); | ||
| } | ||
| } | ||
|
|
||
| #[test] | ||
| fn an_unavailable_module_or_spent_budget_stays_retryable() { | ||
| for refusal in [Refusal::Unavailable, Refusal::RateLimit] { | ||
| let output = refusal_output(refusal); | ||
| assert!( | ||
| !output.starts_with(POLICY_REFUSAL_PREFIX), | ||
| "{refusal:?} may recover and must stay retryable: {output}" | ||
| ); | ||
| } | ||
| } |
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Script executed:
rg -n 'tracing::|refusal_output|classify_failure|check_command' crates/openhuman-core/src/cron/scheduler/shell_job.rs crates/openhuman-core/src/cron/scheduler/executor.rs crates/openhuman-core/src/security/policy/native_commands.rsRepository: tinyhumansai/openhuman
Length of output: 1767
Script executed:
Repository: tinyhumansai/openhuman
Length of output: 29649
Script executed:
Repository: tinyhumansai/openhuman
Length of output: 25152
Script executed:
Repository: tinyhumansai/openhuman
Length of output: 27523
Script executed:
Repository: tinyhumansai/openhuman
Length of output: 4764
Script executed:
Repository: tinyhumansai/openhuman
Length of output: 5161
Script executed:
Repository: tinyhumansai/openhuman
Length of output: 40971
Log the shell-policy retry decision.
Policy refusals can leave traces without a job-correlated refusal category and retry decision. Log the category and retry eligibility with the job ID, without command content.
As per coding guidelines: “Add grep-friendly debug or trace logs for new flows, branches, external calls, retries, timeouts, state changes, and errors.”
Source: Coding guidelines