Skip to content

chore: sync workflow templates - #1439

Merged
stranske merged 1 commit into
mainfrom
sync/workflows-591316374281
Jun 22, 2026
Merged

stranske merged 1 commit into
mainfrom
sync/workflows-591316374281

Conversation

@stranske

@stranske stranske commented Jun 22, 2026

Copy link
Copy Markdown
Owner

Sync Summary

Files Updated

  • agents-guard.yml: Agents guard - enforces agents workflow protections (Health 45)
  • check_agents_md_freshness.py: Warns when the generated Orchestrator AGENTS.md playbook section cites stale repo paths or commands
  • runner_lib/ (1 files): Shared runner prompt assembly, output parsing, and dispatch debounce helpers
  • langchain_client.py: LangChain client builder - multi-provider client with slot-based fallback and configuration
  • llm_registry.py: LLM model registry helper - shared slot/model selection and blocked-model enforcement

Files Skipped

  • pr-00-gate.yml: File exists and sync_mode is create_only
  • ci.yml: File exists and sync_mode is create_only
  • renovate.json: File exists and sync_mode is create_only
  • cross-repo-smoke.yml: File exists and sync_mode is create_only
  • .github/scripts/package.json: Repo installs .github/scripts dependencies from package-lock.json and forbids tracked node_modules
  • .github/scripts/node_modules/minimatch: Repo installs .github/scripts dependencies from package-lock.json and forbids tracked node_modules
  • .github/scripts/node_modules/brace-expansion: Repo installs .github/scripts dependencies from package-lock.json and forbids tracked node_modules
  • .github/scripts/node_modules/balanced-match: Repo installs .github/scripts dependencies from package-lock.json and forbids tracked node_modules
  • llm_slots.json: None

Review Checklist

  • CI passes with updated workflows
  • No repo-specific customizations were overwritten

Source: stranske/Workflows
Source SHA: 821168725d0568cade5bb9a18fc58cab97657975
Template hash: 591316374281
Sync branch: sync/workflows-591316374281
Consumer repo: stranske/trip-planner
Manifest: .github/sync-manifest.yml

Summary by CodeRabbit

  • Bug Fixes

    • Improved error extraction and reporting from runner output, ensuring clearer error messages when operations fail
    • Enhanced model selection fallback logic to better handle blocked overrides and provide more reliable provider selection
  • Refactor

    • Strengthened path validation and resolution across internal components to improve security and reliability

Automated sync from stranske/Workflows
Template hash: 591316374281

Changes synced from sync-manifest.yml
@stranske stranske added sync Automated sync from Workflows automated Automated sync from Workflows labels Jun 22, 2026
@netlify

netlify Bot commented Jun 22, 2026

Copy link
Copy Markdown

Deploy Preview for stranske-trip-planner canceled.

Name Link
🔨 Latest commit 5900bff
🔍 Latest deploy log https://app.netlify.com/projects/stranske-trip-planner/deploys/6a38ca165f5ac700083320cb

@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: c339016e-34cf-4e18-adc2-e59284e75815

📥 Commits

Reviewing files that changed from the base of the PR and between 615d0c6 and 5900bff.

📒 Files selected for processing (5)
  • .github/workflows/agents-guard.yml
  • scripts/check_agents_md_freshness.py
  • scripts/runner_lib/core.py
  • tools/langchain_client.py
  • tools/llm_registry.py
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • stranske/Workflows (auto-detected)
  • stranske/Template (auto-detected)
📜 Recent review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: guard
  • GitHub Check: cross-repo-full-product
🧰 Additional context used
📓 Path-based instructions (7)
{pyproject.toml,.github/workflows/**/*.{yml,yaml}}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Check both pyproject.toml ([tool.coverage.report] fail_under) AND workflow files for coverage-min settings; ensure these match or the lower value will be the effective threshold

Files:

  • .github/workflows/agents-guard.yml
.github/workflows/**/*.{yml,yaml}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

For GitHub Actions workflow startup_failure errors with zero jobs, check for invalid YAML syntax, top-level permissions: block on workflow_call reusable workflows (which conflicts with caller permissions), invalid permission scopes, or circular workflow references

Files:

  • .github/workflows/agents-guard.yml
.github/workflows/*.yml

📄 CodeRabbit inference engine (CLAUDE.md)

First-party consumers should reference reusable workflows with @main unless intentionally pinning to an exact commit SHA for a controlled reason

Files:

  • .github/workflows/agents-guard.yml
.github/workflows/agents-*.yml

📄 CodeRabbit inference engine (CLAUDE.md)

agents-*.yml, autofix.yml, .github/codex/ prompts, and synced scripts/docs should be fixed in stranske/Workflows, not in the consumer repo

Files:

  • .github/workflows/agents-guard.yml
**/.github/workflows/*.yml

📄 CodeRabbit inference engine (AGENTS.md)

First-party consumers should reference reusable workflows with @main unless intentionally pinning to an exact commit SHA for a documented controlled reason

Files:

  • .github/workflows/agents-guard.yml
{.github/workflows/agents-*.yml,.github/workflows/autofix.yml,.github/codex/**,docs/**}

📄 CodeRabbit inference engine (AGENTS.md)

Synced workflows (agents-*.yml, autofix.yml), prompts in .github/codex/, and synced scripts/docs should be fixed in stranske/Workflows, not locally; do not edit them locally

Files:

  • .github/workflows/agents-guard.yml
**/*.py

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

In the Manager-Database repository (stranske/Manager-Database), use Prefect 2.x and import schedules from prefect.client.schemas.schedules

Files:

  • tools/langchain_client.py
  • scripts/runner_lib/core.py
  • tools/llm_registry.py
  • scripts/check_agents_md_freshness.py
🪛 ast-grep (0.43.0)
scripts/runner_lib/core.py

[info] 557-557: use jsonify instead of json.dumps for JSON output
Context: json.dumps(event, sort_keys=True)
Note: Security best practice.

(use-jsonify)

🔀 Multi-repo context stranske/Workflows, stranske/Template

Perfect. I have completed my cross-repository exploration and have sufficient information to conclude.

Linked repositories findings

stranske/Workflows (Source Template Repository)

Key Consumers of Changed APIs:

  • [::stranske/Workflows::] scripts/langchain/_llm_client.py:35-41 — Wraps build_chat_client() to provide import-guarded construction for agent scripts (progress_reviewer, followup_issue_generator, pr_verifier, etc.). This wrapper transparently inherits the new "skip + fallback" override behavior.
  • [::stranske/Workflows::] scripts/langchain/followup_issue_generator.py:24-40 — Uses build_chat_client with reasoning-model selection
  • [::stranske/Workflows::] scripts/langchain/progress_reviewer.py:18-22 — Uses build_chat_client for LLM-powered review

Critical Behavioral Change: Model Override Fallback Strategy

  • [::stranske/Workflows::] tools/langchain_client.pyChanged from pre-loop early refusal to in-loop per-slot fallback. Old behavior: if a user-requested model override is blocked, return None immediately. New behavior: skip that slot and continue to next slot; if override was requested but the original slot's model is safe, keep the original instead of dropping it.
  • [::stranske/Workflows::] tools/llm_registry.py:85-104apply_slot_env_overrides() now distinguishes "override explicitly requested" from "override was blocked." If override requested and blocked, but original slot is safe: keeps original. If override blocked and original also blocked: skips the slot entirely.

Comprehensive Test Coverage for Behavior Changes:

  • [::stranske/Workflows::] tests/tools/test_langchain_client.py:124-145 — Test test_build_chat_client_blocked_model_override_does_not_shift_provider validates the new behavior: blocked global overrides are NOT retried against other provider slots
  • [::stranske/Workflows::] tests/tools/test_langchain_client.py:200-230 — Test test_apply_slot_env_overrides_keeps_original_when_override_blocked_but_original_safe validates slot-level: keeps original when override blocked but original safe

Enhanced Path Safety in Runner Library:

  • [::stranske/Workflows::] scripts/runner_lib/core.py — Added safe path-resolution helpers to prevent directory traversal during orchestrator-skill materialization. Validates destination_root and checkout_path resolve within workspace boundaries, rejecting .. patterns.
  • [::stranske/Workflows::] tests/scripts/test_runner_lib.py:170-185 — Test test_materialize_orchestrator_skill_rejects_unsafe_pack_checkout with parametrized paths .reference/. and .reference/.. confirms unsafe paths are rejected

Safer Command Ref Parsing:

  • [::stranske/Workflows::] scripts/check_agents_md_freshness.py — Enhanced with shlex.split() for shell-like quoting support (vs. naive whitespace split). New _clean_ref() strips only matched paired quotes. New _resolve_repo_path() validates paths stay within repo_root.

Sync Manifest Confirms Delivery:

  • [::stranske/Workflows::] .github/sync-manifest.yml:285-305 — Confirms all changed modules are marked delivery: copy (copy-synced to consumer repos):
    • tools/langchain_client.py — "LangChain client builder - multi-provider client with slot-based fallback and configuration"
    • tools/llm_registry.py — "LLM model registry helper - shared slot/model selection and blocked-model enforcement"
    • scripts/runner_lib/ — "Shared runner prompt assembly, output parsing, and dispatch debounce helpers"
    • scripts/check_agents_md_freshness.py — "Warns when the generated Orchestrator AGENTS.md playbook section cites stale repo paths or commands"

stranske/Template (Secondary Template Reference)

  • [::stranske/Template::] Same modules present and used identically by consumer scripts (scripts/langchain/followup_issue_generator.py, scripts/langchain/_llm_client.py)

Impact Assessment

Backwards Compatibility: The changes are backwards-compatible. Consumers that relied on early refusal of blocked overrides will now gracefully fall back to safe alternatives or original slots, which is a strict improvement.

Safety Hardening: All three enhancement areas (override fallback logic, path resolution validation, ref parsing) are validated with comprehensive test coverage in the source repository.

🔇 Additional comments (14)
tools/llm_registry.py (1)

82-88: LGTM!

Also applies to: 97-104, 268-272

tools/langchain_client.py (1)

283-301: LGTM!

scripts/check_agents_md_freshness.py (5)

9-9: LGTM!


50-55: LGTM!


65-97: LGTM!


100-111: LGTM!


167-172: LGTM!

scripts/runner_lib/core.py (6)

87-112: LGTM!


346-346: LGTM!


397-400: LGTM!


461-466: LGTM!


551-558: LGTM!


576-576: LGTM!

.github/workflows/agents-guard.yml (1)

114-114: LGTM!

Also applies to: 183-183


📝 Walkthrough

Walkthrough

The PR hardens path resolution in runner_lib/core.py and check_agents_md_freshness.py against path traversal, improves shell-ref parsing with shlex, fixes LLM model-override blocking in langchain_client.py to fall back per-slot instead of aborting, adds defensive validation to llm_registry.py's payload parsing, and bumps a pinned CI action SHA.

Changes

Safe path resolution and shell-ref hardening

Layer / File(s) Summary
check_agents_md_freshness.py: shlex parsing and root-validated path checks
scripts/check_agents_md_freshness.py
Adds shlex import; tightens _clean_ref() to strip only matching surrounding quotes; introduces _command_parts() and _resolve_repo_path() for shell-safe tokenization and root-confined path resolution; updates _command_exists() and _check_command_ref() to use these helpers; resolves --agents-md against repo_root in main().
runner_lib/core.py: safe child-path helpers and checkout materialization
scripts/runner_lib/core.py
Introduces _resolve_child_path and _resolve_reference_checkout_path to enforce paths remain within directory roots; updates _materialize_single_checkout_plan, materialize_orchestrator_skill, and assemble_prompt to route path computations through these validators.
runner_lib/core.py: JSONL error extraction and final-message selection
scripts/runner_lib/core.py
_parse_jsonl_output now handles dict-shaped and string-shaped event["error"] payloads, appending the most specific error text; parse_runner_output prefers the first parsed error as final_message when errors are present.

LLM registry validation and model-override fallback

Layer / File(s) Summary
Registry payload validation and blocked-override slot retention
tools/llm_registry.py
load_model_registry() verifies payload["models"] is a list and each entry's quality field is a dict before parsing, logging warnings on malformed data. apply_slot_env_overrides() appends the original slot when an override was requested but blocked and the original slot is not blocked.
Per-slot override blocking and fallback in build_chat_client
tools/langchain_client.py
Moves model-override handling into the slot iteration loop; adds per-slot provider availability checks; uses a used_override flag to apply the override once, logs a warning on a blocked override, and falls back to the slot's default model rather than returning None.

CI workflow SHA bump

Layer / File(s) Summary
agents-guard.yml: bump setup-api-client SHA
.github/workflows/agents-guard.yml
Replaces the old commit SHA with c2537cc959f2ce05926c4639d25b90678abc97bc for the stranske/Workflows/.github/actions/setup-api-client reference in both the pull_request_target and pull_request fallback steps.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • stranske/trip-planner#1430: Also updates the pinned stranske/Workflows/.github/actions/setup-api-client SHA in the same two fallback steps of agents-guard.yml.
  • stranske/trip-planner#1431: Also modifies scripts/runner_lib/core.py for orchestrator-skill materialization and orchestrator-skill context incorporation into prompt assembly, directly overlapping with the path-handling changes in this PR.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 15.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'chore: sync workflow templates' accurately reflects the main objective of the pull request, which is to synchronize workflow templates and related configuration files from the source repository.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sync/workflows-591316374281

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automated Automated sync from Workflows sync Automated sync from Workflows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant