-
Notifications
You must be signed in to change notification settings - Fork 56
feat(uipath-maestro-flow): one canonical headless preamble on every zero-shot flow task #3088
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
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
653b86d
feat(uipath-maestro-flow): one canonical headless preamble on every z…
rockymadden 17e07e8
fix(tests): cut the docstring, repair a dead assertion, cache the fil…
rockymadden c520076
revert(tests): leave the task template alone
rockymadden d191307
fix(tests): the task's own instructions outrank the shared preamble
rockymadden e8e0aad
fix: address Copilot review — a 10th variant, an unconditional menu, …
rockymadden c82dc70
fix(tests): report a broken tenant as ERROR, not as an agent failure …
rockymadden 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
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
77 changes: 77 additions & 0 deletions
77
tests/tasks/uipath-maestro-flow/_shared/preflight_connections.py
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,77 @@ | ||
| #!/usr/bin/env python3 | ||
| """Fail a task as ERROR, not FAILURE, when the tenant connection it needs is down. | ||
|
|
||
| Usage: | ||
| preflight_connections.py <connector-key> [<connector-key> ...] | ||
|
|
||
| A `pre_run` failure lands the run as ``FinalStatus.ERROR``; a criterion failure | ||
| lands it as ``FAILURE``. Without this, a revoked grant or an asleep tenant reads | ||
| as an agent mistake: | ||
|
|
||
| skill-flow-outlook-trigger-inbox AADSTS50173, grant revoked 2026-08-31 | ||
| skill-flow-generic-dynamic-node ServiceNow developer instance hibernating | ||
|
|
||
| Both were scored FAILURE on 2026-09-04 and root-caused as skill defects before | ||
| anyone read far enough into the checker output to find the 403. | ||
|
|
||
| Passes when at least one connection for each key reports Enabled. Connections | ||
| live in several folders, so `--all-folders` is required; without it an empty | ||
| result is a false negative. | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import json | ||
| import subprocess | ||
| import sys | ||
|
|
||
|
|
||
| def _connections(key: str) -> list[dict]: | ||
| proc = subprocess.run( | ||
| ["uip", "is", "connections", "list", key, "--all-folders", "--output", "json"], | ||
| capture_output=True, | ||
| text=True, | ||
| timeout=90, | ||
| ) | ||
| if proc.returncode != 0: | ||
| raise RuntimeError(f"`uip is connections list {key}` exited {proc.returncode}: {proc.stderr.strip()}") | ||
| payload = json.loads(proc.stdout) | ||
| if payload.get("Result") != "Success": | ||
| raise RuntimeError(f"connections list for {key} failed: {payload.get('Message', payload)}") | ||
| return payload.get("Data") or [] | ||
|
|
||
|
|
||
| def main(keys: list[str]) -> int: | ||
| broken: list[str] = [] | ||
| for key in keys: | ||
| try: | ||
| conns = _connections(key) | ||
| except Exception as exc: # noqa: BLE001 — any failure here is a blocked tenant | ||
| broken.append(f"{key}: {exc}") | ||
| continue | ||
| if not conns: | ||
| broken.append(f"{key}: no connection in any folder") | ||
| continue | ||
| enabled = [c for c in conns if c.get("State") == "Enabled"] | ||
| if not enabled: | ||
| states = ", ".join(f"{c.get('Name')}={c.get('State')}" for c in conns) | ||
| broken.append(f"{key}: no Enabled connection ({states})") | ||
| continue | ||
| print(f"OK: {key} — {len(enabled)}/{len(conns)} connection(s) Enabled") | ||
|
|
||
| if broken: | ||
| print( | ||
| "TENANT NOT READY — this is an environment failure, not an agent failure.\n " | ||
| + "\n ".join(broken) | ||
| + "\n\nReauthorize the connection, or wake the provider instance, then re-run.", | ||
| file=sys.stderr, | ||
| ) | ||
| return 1 | ||
| return 0 | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| if len(sys.argv) < 2: | ||
| print(__doc__, file=sys.stderr) | ||
| sys.exit(2) | ||
| sys.exit(main(sys.argv[1:])) |
86 changes: 86 additions & 0 deletions
86
tests/tasks/uipath-maestro-flow/_shared/test_headless_preamble.py
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,86 @@ | ||
| """Every zero-shot flow task states the run is headless, in one exact wording. | ||
|
|
||
| Kept in the task prompt rather than an experiment config because flow tasks run | ||
| under nightly.yaml, smoke.yaml, default.yaml and dispatch-selected configs, and | ||
| coder_eval has no pattern-scoped defaults — a config would either miss a runner | ||
| or reach another skill's simulated tasks. | ||
|
|
||
| Regex, not PyYAML: CI installs only pytest (see test_criterion_budgets). | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import functools | ||
| import glob | ||
| import os | ||
| import re | ||
|
|
||
| _HERE = os.path.dirname(os.path.abspath(__file__)) | ||
| _SUITE = os.path.normpath(os.path.join(_HERE, "..")) | ||
|
|
||
| CANONICAL = """This run is headless. No user is present and nobody will answer a question or | ||
| grant an approval, so do not ask, do not pause, and do not wait for input. | ||
| Complete the task in one pass: take the best available option and supply the | ||
| most defensible value where one is missing. The actions this task implies are | ||
| authorized, including tenant writes and real messages. Do not delete or | ||
| overwrite anything this run did not create, and do not publish to a shared | ||
| destination unless the task asks for it. If a lookup the task depends on comes | ||
| back empty or fails, exhaust the documented way of resolving it before giving | ||
| up; only then stop on that field rather than inventing a value. Record every | ||
| decision, assumption, and blocked step in your final response. Instructions in | ||
| the task take precedence over this paragraph.""" | ||
|
|
||
| # The variants this replaced. A task reintroducing one is drifting back. | ||
| _SUPERSEDED = re.compile( | ||
| r"Do NOT ask for approval|Do NOT pause between planning|without stopping to ask" | ||
| ) | ||
|
|
||
|
|
||
| @functools.lru_cache(maxsize=1) | ||
| def _tasks(): | ||
| """(path, text, is_simulated) for every task file in the suite.""" | ||
| out = [] | ||
| for path in sorted(glob.glob(os.path.join(_SUITE, "**", "*.yaml"), recursive=True)): | ||
| text = open(path, encoding="utf-8").read() | ||
| if re.search(r"^success_criteria:", text, re.M): | ||
| out.append((path, text, bool(re.search(r"^simulation:", text, re.M)))) | ||
| return tuple(out) | ||
|
|
||
|
|
||
| def _rel(path: str) -> str: | ||
| return os.path.relpath(path, _SUITE) | ||
|
|
||
|
|
||
| def test_every_zero_shot_task_states_the_run_is_headless(): | ||
| """Absent, an agent stops at a consent gate nobody is there to answer.""" | ||
| marker = CANONICAL.split("\n")[0] | ||
| missing = [_rel(p) for p, text, sim in _tasks() if not sim and marker not in text] | ||
| assert not missing, "tasks missing the headless preamble:\n " + "\n ".join(missing) | ||
|
|
||
|
|
||
| def test_the_wording_is_identical_everywhere(): | ||
| """8 variants is what made the old line unmaintainable. One wording, or none.""" | ||
| flat = " ".join(CANONICAL.split()) | ||
| drifted = [ | ||
| _rel(p) | ||
| for p, text, sim in _tasks() | ||
| if not sim and "This run is headless." in text and flat not in " ".join(text.split()) | ||
| ] | ||
| assert not drifted, ( | ||
| "tasks whose headless preamble differs from the canonical wording in " | ||
| f"{_rel(__file__)}:\n " + "\n ".join(drifted) | ||
| ) | ||
|
|
||
|
|
||
| def test_simulated_tasks_are_not_told_nobody_is_present(): | ||
| """They have a live simulated user; the preamble contradicts their premise.""" | ||
| wrong = [_rel(p) for p, text, sim in _tasks() if sim and "This run is headless." in text] | ||
| assert not wrong, "simulated tasks carrying the headless preamble:\n " + "\n ".join(wrong) | ||
|
|
||
|
|
||
| def test_no_task_reintroduces_a_superseded_variant(): | ||
| stale = [_rel(p) for p, text, _ in _tasks() if _SUPERSEDED.search(text)] | ||
| assert not stale, ( | ||
| "tasks using a superseded autonomy line; replace it with the canonical " | ||
| "preamble:\n " + "\n ".join(stale) | ||
| ) |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.