Skip to content

Add failure mode taxonomy vocabulary and synthesize_traces focus guidance to SYSTEM_PROMPT#72

Open
VjayRam wants to merge 5 commits into
context-labs:mainfrom
VjayRam:feat/failure-taxonomy-vocabulary
Open

Add failure mode taxonomy vocabulary and synthesize_traces focus guidance to SYSTEM_PROMPT#72
VjayRam wants to merge 5 commits into
context-labs:mainfrom
VjayRam:feat/failure-taxonomy-vocabulary

Conversation

@VjayRam

@VjayRam VjayRam commented Jun 19, 2026

Copy link
Copy Markdown

This was generated by AI during triage.

Summary

  • Adds Rule 13 to SYSTEM_PROMPT in engine/agents/prompt_templates.py: a 30-category failure vocabulary across 6 groups (Tool Execution, Planning & Reasoning, Context & Memory, Output Quality, Resource & Budget, Multi-Agent). Labels are applied by the LLM at report time, not used as a detection checklist.
  • Adds Rule 12: documents the undocumented focus parameter on synthesize_traces, explaining when and how to use it for narrowing cross-trace synthesis.
  • Closes RFC: Failure Mode Taxonomy - controlled vocabulary for labeling HALO findings #70

Motivation

Issue #70 (RFC: Failure Mode Taxonomy) identified that HALO's findings lack consistent naming across runs. Without a shared vocabulary, the same failure (e.g. a context-flooding tool call) gets described differently each time, making cross-run comparison hard. This PR gives the LLM a controlled set of labels to apply when they fit, while leaving it free to describe failures in plain language when none apply.

Demo verification

Ran HALO against demo/openai-agents-sdk-demo/sample-traces/traces.jsonl with the prompt "Analyze these traces for failure patterns. For each issue you find, label it with the appropriate failure category from the vocabulary."

HALO correctly identified and labeled C1 · Context Flooding:

Turn 1: Agent calls list_files("*") on root directory → returns 422KB of .venv data. Turn 2: next LLM call receives 125,007 input tokens — a massive context inflation. The agent should have used a more targeted approach (e.g., list_files on ./sample-traces).

The label C1 · Context Flooding matches exactly the vocabulary entry. Additional observations outside the vocabulary were described in plain language, as Rule 13 instructs.

Test plan

  • render_root_system_prompt() produces 8327 chars with all 30 categories present (verified via python -c in the fork venv)
  • Unit tests pass (pytest tests/unit)
  • Demo run on sample traces produces taxonomy-labeled findings
  • No lint or format errors (ruff clean)

🧙 Built with WOZCODE


Note

Medium Risk
Session list SQL is a behavioral/performance change on a core telemetry path; onboarding now completes on import success, which changes first-run navigation.

Overview
This PR bundles onboarding and import UX, a session-list query optimization, HALO agent prompt updates, and a patch version bump.

Onboarding drops the video step and header Skip Onboarding, leaving Welcome → Import. Welcome copy explains the trace → HALO → fix → re-collect loop and links to inference.net; the primary CTA is Get Started. On import, a successful trace import (demo, file, Langfuse, or Phoenix) auto-completes onboarding and routes to the dashboard once, guarded by a ref so duplicate callbacks do not double-finish.

Import dialogs simplify post-job footers: successful runs show Close only (no “start another import” / “load again”); Retry remains when the job failed.

Telemetry: listSessions now uses pagedSessionAggregateSql so pagination applies to aggregated session rows first; span-backed fields (e.g. llm_model_names, previews) are computed only for the current page instead of every session in the filtered set.

Engine prompts add rule 12 (synthesize_traces + optional focus) and rule 13 (30-label failure vocabulary across six groups for consistent finding names).

app/package.json version 0.1.16 → 0.1.17.

Reviewed by Cursor Bugbot for commit cd27a4c. Bugbot is set up for automated code reviews on this repo. Configure here.

@VjayRam

VjayRam commented Jun 19, 2026

Copy link
Copy Markdown
Author

@samheutmaker could you review this PR?

…ance to SYSTEM_PROMPT

Adds two new rules to SYSTEM_PROMPT in engine/agents/prompt_templates.py:

Rule 12: Documents the `focus` parameter on `synthesize_traces` so the LLM
uses it for targeted multi-trace comparisons (previously undocumented, so
never used despite being wired up in synthesis_tool.py).

Rule 13: Adds 30 named failure categories across 6 groups (Tool Execution,
Planning & Reasoning, Context & Memory, Output Quality, Resource & Budget,
Multi-Agent) as a labeling vocabulary. HALO still discovers findings freely
by navigating traces — the vocabulary only ensures findings are named
consistently so output is comparable across runs and agent versions.

Closes context-labs#70.

Co-Authored-By: WOZCODE <contact@withwoz.com>
@VjayRam
VjayRam force-pushed the feat/failure-taxonomy-vocabulary branch from e69618a to 3b73a79 Compare June 23, 2026 04:53
samheutmaker and others added 4 commits June 23, 2026 22:15
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…ance to SYSTEM_PROMPT

Adds two new rules to SYSTEM_PROMPT in engine/agents/prompt_templates.py:

Rule 12: Documents the `focus` parameter on `synthesize_traces` so the LLM
uses it for targeted multi-trace comparisons (previously undocumented, so
never used despite being wired up in synthesis_tool.py).

Rule 13: Adds 30 named failure categories across 6 groups (Tool Execution,
Planning & Reasoning, Context & Memory, Output Quality, Resource & Budget,
Multi-Agent) as a labeling vocabulary. HALO still discovers findings freely
by navigating traces — the vocabulary only ensures findings are named
consistently so output is comparable across runs and agent versions.

Closes context-labs#70.

Co-Authored-By: WOZCODE <contact@withwoz.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit cd27a4c. Configure here.

</>
) : (
<Button onClick={() => onOpenChange(false)}>Close</Button>
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Success import loses repeat action

Medium Severity

After a successful import, the dialog footer now only shows Close. The previous Start another import / Load again controls that reset the wizard were removed. Those dialogs are shared by ImportDataRoutePage and TraceMonitorPage, so users must close and reopen the dialog to run another import.

Additional Locations (3)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit cd27a4c. Configure here.

setDemoDialogOpen(false);
refreshTelemetry();
await onFinish();
}, [onFinish, refreshTelemetry]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Import guard blocks retry finish

Low Severity

handleImported sets completedImportRef to true before await onFinish(). If onboarding.complete or navigation fails after a successful import, later import completions skip handleImported and no longer auto-complete onboarding, even though dialogs were already closed on the first attempt.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit cd27a4c. Configure here.

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.

RFC: Failure Mode Taxonomy - controlled vocabulary for labeling HALO findings

2 participants