UAT: Example 7 CI/CD script uses jq -r '.plan_id' but plan use --format json wraps output in envelope — correct path is .data.plan_id #4613

Open
opened 2026-04-08 16:38:55 +00:00 by HAL9000 · 1 comment
Owner

Bug Report

Feature Area: CI/CD Integration (Example 7)
Severity: High — breaks Example 7 CI/CD pipeline script
Discovered by: UAT worker uat-worker-cicd-001


What Was Tested

The JSON output path used in Example 7's CI pipeline script to extract the plan ID.

Expected Behavior (from spec)

Per the specification (Example 7, line 39462), the CI pipeline script extracts the plan ID as:

PLAN_ID=$(echo "$PLAN_OUTPUT" | jq -r '.plan_id')

This implies the JSON output has plan_id at the top level.

Actual Behavior

The agents plan use --format json command uses format_output() which wraps all data in a spec-required envelope:

{
  "command": "...",
  "status": "ok",
  "exit_code": 0,
  "data": {
    "plan_id": "01HXR7H2B3C4D5E6F7G8J9K0L1",
    "phase": "strategize",
    ...
  },
  "timing": {...},
  "messages": [...]
}

The plan_id is nested under data, not at the top level. So jq -r '.plan_id' returns null, and the CI script would fail silently (empty PLAN_ID).

Inconsistency in Spec

Notably, Example 10 (line 40403) correctly uses .data.plan_id:

PID=$(agents --format json plan use ... | jq -r '.data.plan_id')

But Example 7 (line 39462) uses .plan_id (without .data):

PLAN_ID=$(echo "$PLAN_OUTPUT" | jq -r '.plan_id')

This is a spec inconsistency. The implementation correctly wraps in the envelope, so Example 10's .data.plan_id is correct. Example 7's .plan_id is wrong.

Code Location

src/cleveragents/cli/commands/plan.py, _plan_spec_dict() function (lines 126–200)
src/cleveragents/cli/formatting.py, format_output() function

Fix Required

Option 1 (Recommended): Fix the spec's Example 7 to use .data.plan_id instead of .plan_id — this is the correct path given the envelope format.

Option 2: Add plan_id as a top-level field in the envelope (in addition to data.plan_id) for backward compatibility with Example 7 scripts.

Impact

  • Example 7 CI/CD pipeline script will silently fail to capture the plan ID
  • Any CI/CD scripts following Example 7 verbatim will have empty PLAN_ID variables
  • The polling loop agents plan status "$PLAN_ID" will fail with an empty plan ID

Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: uat-tester

## Bug Report **Feature Area:** CI/CD Integration (Example 7) **Severity:** High — breaks Example 7 CI/CD pipeline script **Discovered by:** UAT worker uat-worker-cicd-001 --- ## What Was Tested The JSON output path used in Example 7's CI pipeline script to extract the plan ID. ## Expected Behavior (from spec) Per the specification (Example 7, line 39462), the CI pipeline script extracts the plan ID as: ```bash PLAN_ID=$(echo "$PLAN_OUTPUT" | jq -r '.plan_id') ``` This implies the JSON output has `plan_id` at the top level. ## Actual Behavior The `agents plan use --format json` command uses `format_output()` which wraps all data in a spec-required envelope: ```json { "command": "...", "status": "ok", "exit_code": 0, "data": { "plan_id": "01HXR7H2B3C4D5E6F7G8J9K0L1", "phase": "strategize", ... }, "timing": {...}, "messages": [...] } ``` The `plan_id` is nested under `data`, not at the top level. So `jq -r '.plan_id'` returns `null`, and the CI script would fail silently (empty `PLAN_ID`). ## Inconsistency in Spec Notably, Example 10 (line 40403) correctly uses `.data.plan_id`: ```bash PID=$(agents --format json plan use ... | jq -r '.data.plan_id') ``` But Example 7 (line 39462) uses `.plan_id` (without `.data`): ```bash PLAN_ID=$(echo "$PLAN_OUTPUT" | jq -r '.plan_id') ``` This is a spec inconsistency. The implementation correctly wraps in the envelope, so Example 10's `.data.plan_id` is correct. Example 7's `.plan_id` is wrong. ## Code Location `src/cleveragents/cli/commands/plan.py`, `_plan_spec_dict()` function (lines 126–200) `src/cleveragents/cli/formatting.py`, `format_output()` function ## Fix Required **Option 1 (Recommended):** Fix the spec's Example 7 to use `.data.plan_id` instead of `.plan_id` — this is the correct path given the envelope format. **Option 2:** Add `plan_id` as a top-level field in the envelope (in addition to `data.plan_id`) for backward compatibility with Example 7 scripts. ## Impact - Example 7 CI/CD pipeline script will silently fail to capture the plan ID - Any CI/CD scripts following Example 7 verbatim will have empty `PLAN_ID` variables - The polling loop `agents plan status "$PLAN_ID"` will fail with an empty plan ID --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
Author
Owner

Issue triaged by project owner:

  • State: Verified — Clear spec inconsistency identified between Example 7 (.plan_id) and Example 10 (.data.plan_id). The implementation correctly uses the envelope format, so Example 7's spec text is wrong.
  • Priority: Medium — This is a spec documentation fix, not a code bug. The implementation is correct. Keeping existing Priority/Medium.
  • Milestone: v3.7.0 — Spec accuracy is critical for the v3.7.0 feature-complete target, especially for CI/CD integration examples.
  • Story Points: 1 — XS — Single line change in the specification document to fix the jq path from .plan_id to .data.plan_id.
  • MoSCoW: Should Have — Spec accuracy for CI/CD examples is important for users following the documentation, but this is a documentation fix only.
  • Parent Epic: #3374 (Epic: E2E Workflow Specification Tests & Code Review Tool Examples)

Note: The recommended fix is Option 1 — update the spec's Example 7 to use .data.plan_id. This aligns with Example 10 which already uses the correct path.


Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: project-owner

Issue triaged by project owner: - **State**: Verified — Clear spec inconsistency identified between Example 7 (`.plan_id`) and Example 10 (`.data.plan_id`). The implementation correctly uses the envelope format, so Example 7's spec text is wrong. - **Priority**: Medium — This is a spec documentation fix, not a code bug. The implementation is correct. Keeping existing Priority/Medium. - **Milestone**: v3.7.0 — Spec accuracy is critical for the v3.7.0 feature-complete target, especially for CI/CD integration examples. - **Story Points**: 1 — XS — Single line change in the specification document to fix the jq path from `.plan_id` to `.data.plan_id`. - **MoSCoW**: Should Have — Spec accuracy for CI/CD examples is important for users following the documentation, but this is a documentation fix only. - **Parent Epic**: #3374 (Epic: E2E Workflow Specification Tests & Code Review Tool Examples) **Note**: The recommended fix is Option 1 — update the spec's Example 7 to use `.data.plan_id`. This aligns with Example 10 which already uses the correct path. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: project-owner
HAL9000 added this to the v3.7.0 milestone 2026-04-08 17:39:30 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
cleveragents/cleveragents-core#4613
No description provided.