Repository navigation
fix(connector): sealed BYOC jobs finish cleanly; secrets_ref key opens the report; no job escapes a stop - #2523
Merged
Merged
Conversation
…s_ref opens its report; no job escapes a stop fail-open class: lost-outcome-as-failure (unknown outcome). - The connector staged its own plaintext inputs (governed_policy.json, params.json, managed-dispatch.json, readback-params.json, qualification-authority.json) inside the run directory. A sealed bundle's run directory is a sealed set whose finalize refuses any plaintext file, so every sealed job wrote and then halted as child_outcome_unknown. These files now go to a 0700 staging directory beside the run, inside the job's 0700 temporary directory, which is removed when the job ends however it ends. The child gets their paths as before. - A bundle key delivered only through the job's secrets_ref reached the child but not the daemon, so the sealed report could not be opened and the run halted. The report is now opened with the key from the child's environment. It is held in memory for the read only and is never logged or written. - A stop signal between pool.submit and listing the job's future left that job out of shutdown's cancel_job. The job id is now listed before the submit. Tests (tests/test_connector_sealed_staging.py): - A real child process seals the run as the governed child does (writer, sealed report, finalize with adopt_external) through the real _subprocess_runner, with the key only in secrets_ref. It finishes as success, not halted. Nothing is in the run directory before the child, the staging directory is 0700, and everything is removed afterwards. - A sealed report read without the child's key is unknown. - A plaintext file in a sealed run directory is refused. - A stop between submit and register still cancels the job. The governed `openadapt_flow run` child itself is not exercised end to end. It needs a qualified program and a live managed-delivery authority.
Member
Author
Independent adversarial review: APPROVEFrom: Gemini Gemini cross-vendor review of the full diff against
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Follow-up to #2300, stacked on it. Retarget to
mainonce #2300 merges.What this fixes
Fail-open class: an unknown outcome reported as a failure, or as a halt for every job.
governed_policy.json,params.json,managed-dispatch.json,readback-params.jsonandqualification-authority.json. A sealed bundle's run directory is a sealed set, and its finalize refuses any plaintext file, so each sealed job made its writes and then halted aschild_outcome_unknown. These inputs now go in a0700staging directory next to the run, inside the job's0700temporary directory. That directory is removed when the job ends, however it ends. The child gets the same files at their new paths.secrets_refcouldn't open the report. The child received the bundle key but the daemon did not, so the sealed report was unreadable and the run halted. The report is now opened with the key from the child's environment. The key is used in memory for that read only and is never logged or written.pool.submitand registering the job's future left that job out of the shutdowncancel_job. The job id is now listed before the submit.Tests
The new tests are in
packages/flow/tests/test_connector_sealed_staging.py.report.json, thenfinalize(adopt_external=True). It runs through the real_subprocess_runner, with the key only insecrets_ref. The job finishes assuccess, not halted. The run directory is empty before the child starts, the staging directory is0700, and everything is removed afterwards.The governed
openadapt_flow runchild itself is not exercised end to end here, because that needs a qualified program and a live managed-delivery authority. The connector suites pass (202 tests, 81 subtests), along with the sealed-at-rest tests, mypy and ruff. Before the fix, three of the four new tests fail.