Skip to content

fix(agentrx-optimizer): add logs precondition rules and retry cap - #49315

Merged
pelikhan merged 3 commits into
mainfrom
copilot/agentrx-optimizer-daily-workflow-optimization
Jul 31, 2026
Merged

fix(agentrx-optimizer): add logs precondition rules and retry cap#49315
pelikhan merged 3 commits into
mainfrom
copilot/agentrx-optimizer-daily-workflow-optimization

Conversation

Copilot AI commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

The logs MCP tool was being called without a workflow_name filter (causing 60s timeouts) and retried unboundedly on empty results — driving 96 of ~103 tool calls in the audited baseline run and the resource_heavy_for_domain/partially_reducible findings.

Changes

  • daily-agentrx-trace-optimizer.md — Data and Tooling Requirements
    • Require workflow_name in every logs call; unfiltered scans time out
    • Cap logs retries at 2 attempts per workflow; fall back to audit (using any known run_id) on empty or timeout
    • Treat total_runs=0 for a confirmed workflow as a tool-health signal: surface via missing_tool and switch to audit-only — do not vary parameters and retry
{
  "workflow_name": "<workflow-id>",
  "count": 50,
  "start_date": "-2d",
  "artifacts": ["agent"]
}
  • daily-agentrx-trace-optimizer.lock.yml — recompiled to keep lock file in sync (body-only change; no frontmatter modified)

…-optimizer

Add three explicit guardrails to the Data and Tooling Requirements section:
1. Always include workflow_name filter in logs calls (unfiltered scans time out)
2. Cap logs retries at 2; fall back to audit on empty/timeout
3. Treat total_runs=0 for known-good workflows as a tool-health signal
   to surface via missing_tool, not a reason to keep retrying

Closes #49289

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Optimize daily workflow for AgentRx pipeline fix(agentrx-optimizer): add logs precondition rules and retry cap Jul 31, 2026
Copilot AI requested a review from pelikhan July 31, 2026 10:42
@pelikhan
pelikhan marked this pull request as ready for review July 31, 2026 11:37
Copilot AI review requested due to automatic review settings July 31, 2026 11:37
@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot import logs cache shared agentic workflow

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds guardrails to prevent excessive logs MCP calls and provide an audit fallback.

Changes:

  • Requires filtered logs calls and caps retries.
  • Handles empty results as tool-health failures.
  • Updates the compiled workflow hash.
Show a summary per file
File Description
.github/workflows/daily-agentrx-trace-optimizer.md Adds log-query preconditions and fallback guidance.
.github/workflows/daily-agentrx-trace-optimizer.lock.yml Synchronizes the generated body hash.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Balanced

- Use `logs` to download parsed logs for recent runs, specifying `artifacts: ["agent"]` to include agent telemetry (turns, token usage, stdout) needed for AgentRx trajectory analysis.
**`logs` precondition rules (follow strictly):**
- Always include `workflow_name` — never call `logs` without it; an unfiltered scan will time out.
- Cap retries at **2 attempts** per workflow. If both return empty or time out, stop retrying and fall back to `audit` using any known `run_id` (from `status` or prior context).
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Jul 31, 2026

Copy link
Copy Markdown
Contributor Author

@copilot import logs cache shared agentic workflow

Implemented in 08e171d. The optimizer now imports the shared 24-hour logs-cache setup and prompt, and uses the pre-downloaded bundle before selective MCP queries.

@pelikhan
pelikhan merged commit 22556a7 into main Jul 31, 2026
@pelikhan
pelikhan deleted the copilot/agentrx-optimizer-daily-workflow-optimization branch July 31, 2026 12:15
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.84.1

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[agentrx-optimizer] Daily Workflow Optimization - 2026-07-31

3 participants