@polygraph/codex-plugin 0.4.38 → 0.4.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -20,6 +20,8 @@ show_session(sessionId: "<session-id>")
|
|
|
20
20
|
|
|
21
21
|
It returns the full session, including `repositories[]` (for repo display names) and `pullRequests[]`. Each `pullRequests[]` entry has `id`, `repositoryId`, `url`, `branch`, `status` (PR status: `DRAFT` / `OPEN` / `MERGED` / `CLOSED`), and a `ci` object — **`ci` may be absent if the PR has no CI**. When present, `ci` has `status`, `cipeUrl` (non-null ⇒ CIPE; null + `externalCIRuns` ⇒ external CI), `completedAt`, `selfHealingStatus`, and `externalCIRuns[]` (each with `runId`, `name`, `status`, `conclusion`, `url`, and `jobs[]`). Always read `ci` defensively (`pr.ci?.…`).
|
|
22
22
|
|
|
23
|
+
**`cipeUrl` is a human-facing web link, NOT a data source.** It points at the Nx Cloud web app, which requires browser authentication and returns no machine-readable data. Never fetch, curl, WebFetch, or poll `cipeUrl` (or any other Nx Cloud URL) directly. CI *status* comes only from polling `show_session`; CIPE *details* (failed tasks, logs, self-healing) come only from the Nx MCP `ci_information` tool. The only thing to do with `cipeUrl` is display it to the user so they can open it in a browser.
|
|
24
|
+
|
|
23
25
|
## Prerequisite: Nx MCP server (CIPE deep-dive + self-healing)
|
|
24
26
|
|
|
25
27
|
CIPE failure investigation (`ci_information`) and applying/rejecting self-healing fixes (`update_self_healing_fix`) are **not** polygraph-mcp tools — they are provided by the **Nx MCP server** (`mcp__plugin_nx_nx-mcp`). Before relying on the Phase 4 CIPE deep-dive or the Phase 5 self-healing actions, install the Nx MCP server and verify it is available.
|
|
@@ -29,7 +31,14 @@ If the Nx MCP server is **not** available, this skill can still:
|
|
|
29
31
|
- Monitor CI to a terminal state (Phases 1–3) via `show_session`, and
|
|
30
32
|
- Download and inspect **external-CI** job logs via `get_ci_logs` (a polygraph-mcp tool).
|
|
31
33
|
|
|
32
|
-
But it **cannot** perform CIPE deep-dives (`ci_information`) or apply self-healing fixes (`update_self_healing_fix`) without the Nx MCP server.
|
|
34
|
+
But it **cannot** perform CIPE deep-dives (`ci_information`) or apply self-healing fixes (`update_self_healing_fix`) without the Nx MCP server. Do NOT compensate by fetching or scraping `cipeUrl` — there is no HTTP fallback for CIPE data; the Nx MCP server is the only programmatic access.
|
|
35
|
+
|
|
36
|
+
If nx-mcp is missing, don't just report the limitation — tell the user how to install it:
|
|
37
|
+
|
|
38
|
+
- In an Nx workspace, run `nx configure-ai-agents` — it sets up the Nx MCP server (and Nx agent skills) for their AI tools, or
|
|
39
|
+
- Add the server manually as a stdio MCP server: `npx nx-mcp@latest` (see https://github.com/nrwl/nx-ai-agents-config for details).
|
|
40
|
+
|
|
41
|
+
MCP servers load at session start, so the user must restart the agent session after installing before the deep-dive and self-healing actions become available.
|
|
33
42
|
|
|
34
43
|
## Phase 1: Session Setup
|
|
35
44
|
|
|
@@ -125,7 +134,7 @@ Include self-healing status for any repo that has one.
|
|
|
125
134
|
|
|
126
135
|
For each repo with `ciStatus: FAILED`, branch on the PR's `ci` object from `show_session` (`pullRequests[]`):
|
|
127
136
|
|
|
128
|
-
- **If `pr.ci.cipeUrl` is non-null** → CIPE is authoritative. Delegate investigation using the Nx MCP `ci_information` tool (requires the Nx MCP server — see the prerequisite note above; if nx-mcp is unavailable, report the CIPE URL
|
|
137
|
+
- **If `pr.ci.cipeUrl` is non-null** → CIPE is authoritative. Delegate investigation using the Nx MCP `ci_information` tool (requires the Nx MCP server — see the prerequisite note above; if nx-mcp is unavailable, report the CIPE URL to the user, offer the install steps from the prerequisite section, and do NOT fetch the URL as a substitute).
|
|
129
138
|
- **If `pr.ci.cipeUrl` is null but `pr.ci.externalCIRuns` exists** → external CI only. Examine failed jobs from `pr.ci.externalCIRuns[].jobs` and use `get_ci_logs(sessionId, repositoryId, jobId)` (a polygraph-mcp tool) for log retrieval, passing `pr.repositoryId` and the failed job's `jobId` straight from the same PR object.
|
|
130
139
|
|
|
131
140
|
**Codex subagent wrapper:** Use `polygraph-delegate-subagent` to keep the Polygraph MCP `spawn_agent` / `show_agent` polling loop out of the main conversation. For each failed repo, launch a Codex `spawn_agent` with `agent_type: "polygraph-delegate-subagent"` and instructions to perform steps 2-4 below for that repo, then collect completed summaries with `wait_agent` when the main flow needs them. In the steps below, `spawn_agent` and `show_agent` refer to the Polygraph MCP tools that belong inside the Codex subagent.
|
|
@@ -181,7 +190,7 @@ For each repo with `ciStatus: FAILED`, branch on the PR's `ci` object from `show
|
|
|
181
190
|
2. Identify cross-repo dependency issues (e.g., shared-lib build failure blocking frontend)
|
|
182
191
|
3. Suggest fix order based on dependency graph (upstream repos first)
|
|
183
192
|
4. Present next actions to the user based on self-healing status:
|
|
184
|
-
- If any repo has `selfHealingStatus` with an available fix → offer to **apply self-healing** via `update_self_healing_fix(action: "APPLY")` or **reject** it. `update_self_healing_fix` is an **Nx MCP** tool (`mcp__plugin_nx_nx-mcp`) — it requires the Nx MCP server. If nx-mcp is unavailable, report that a fix is available but cannot be applied from here.
|
|
193
|
+
- If any repo has `selfHealingStatus` with an available fix → offer to **apply self-healing** via `update_self_healing_fix(action: "APPLY")` or **reject** it. `update_self_healing_fix` is an **Nx MCP** tool (`mcp__plugin_nx_nx-mcp`) — it requires the Nx MCP server. If nx-mcp is unavailable, report that a fix is available but cannot be applied from here, and offer the install steps from the prerequisite section.
|
|
185
194
|
- If self-healing was already applied → offer to **resume monitoring** to watch the re-triggered CI
|
|
186
195
|
- **Delegate fixes**: use Polygraph to send fix instructions to child agents (for repos without self-healing or where self-healing was rejected/failed)
|
|
187
196
|
- **Get more details**: drill into a specific repo's failure
|
|
@@ -191,6 +200,7 @@ For each repo with `ciStatus: FAILED`, branch on the PR's `ci` object from `show
|
|
|
191
200
|
|
|
192
201
|
- This skill does NOT push code directly. The only write action it may take is applying/rejecting a self-healing fix via `update_self_healing_fix`, an **Nx MCP** tool that performs an Nx Cloud operation (not a local code change) and requires the Nx MCP server.
|
|
193
202
|
- Both `ci_information` and `update_self_healing_fix` are **Nx MCP** tools (`mcp__plugin_nx_nx-mcp`), not polygraph-mcp tools. Their responses include a `hints` array with contextual guidance (e.g., disclaimers about which CI Attempt was retrieved). Always check and surface non-empty hints.
|
|
203
|
+
- `cipeUrl` is a browser link for the user — never fetch, curl, WebFetch, or poll it (in the main agent or in child agents). CIPE data is only available via the Nx MCP `ci_information` tool.
|
|
194
204
|
- All heavy CI data inspection happens in child agents via `spawn_agent` to keep this context window clean.
|
|
195
205
|
|
|
196
206
|
- On Codex, the delegate-and-poll loop should run inside `polygraph-delegate-subagent`, and the main conversation should use `wait_agent` only when it needs to collect results.
|
|
@@ -151,6 +151,7 @@ When `cipeStatus == 'FAILED'` AND `failedTaskIds` is empty AND `selfHealingStatu
|
|
|
151
151
|
## Important
|
|
152
152
|
|
|
153
153
|
- This skill is **read-only**. Do NOT apply fixes, push code, or modify anything.
|
|
154
|
+
- `cipeUrl` and `shortLink` are human-facing web links — include them in the output for the user to open in a browser, but never fetch, curl, or poll them yourself. All CIPE data comes from the Nx MCP `ci_information` tool.
|
|
154
155
|
|
|
155
156
|
- Always delegate the MCP call to a Codex built-in subagent. Do NOT call ci_information yourself in the main conversation.
|
|
156
157
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: polygraph
|
|
3
|
-
description: Guidance for working with Polygraph sessions, shared/resumable agent context, repository graph visibility, linked PR/CI state, and cross-repo expansion when needed. Use when starting, joining, resuming, inspecting, or sharing a Polygraph session; handing off progress; discovering related repositories; coordinating changes/branches/PRs across repos; delegating tasks to child agents in different repos;
|
|
3
|
+
description: Guidance for working with Polygraph sessions, shared/resumable agent context, repository graph visibility, linked PR/CI state, and cross-repo expansion when needed. Use when starting, joining, resuming, inspecting, or sharing a Polygraph session; handing off progress; discovering related repositories; coordinating changes/branches/PRs across repos; delegating tasks to child agents in different repos; checking CI status and logs; or tracing a commit or line of code back to the session that produced it. TRIGGER when user mentions "polygraph", resuming or sharing a session, "other repos", "other repositories", "who uses this", "what uses this", "cross-repo", "multi-repo", "consuming this API/endpoint", "dependent repositories", asks about what other repos are doing with shared code/APIs/endpoints, or asks about a "commit sha", "session behind this commit", "which session changed this line", "find session by sha", "git blame".
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -71,6 +71,7 @@ Polygraph functionality is available via both MCP tools and CLI commands. Use wh
|
|
|
71
71
|
| `login` | `polygraph auth login [--token]` | Authenticate with Polygraph (use `--token` for headless/CI) |
|
|
72
72
|
| `logout` | `polygraph auth logout` | Log out of Polygraph |
|
|
73
73
|
| `list_sessions` | `polygraph session list` | List sessions. By default only active sessions created by the current git user; pass `recommendedFilters: false` for all sessions. |
|
|
74
|
+
| `search_sessions` | `polygraph session search` | Find sessions by free-text `query` OR by commit `sha` — pass EXACTLY ONE of the two (they are mutually exclusive). `sha` (CLI: `--sha <sha>`) is an exact lookup of the session(s) linked to a commit, full or partial, 7-40 hex chars; it returns matching sessions newest first, org-scoped, and explicit sessions only (implicit sessions are never returned). Supports `--json` and `--limit` (1-50). See "Finding the Session Behind a Commit or Line". |
|
|
74
75
|
| `list_accounts` | `polygraph account list` | List available organizations |
|
|
75
76
|
| `select_account` | `polygraph account select` | Select the organization that future commands run against |
|
|
76
77
|
| `whoami` | `polygraph whoami` | Show current auth status and org |
|
|
@@ -224,6 +225,32 @@ Description:
|
|
|
224
225
|
Inspect the PR commits/diff and investigate the requested behavior. Report findings with file paths and concrete evidence.
|
|
225
226
|
```
|
|
226
227
|
|
|
228
|
+
### Finding the Session Behind a Commit or Line
|
|
229
|
+
|
|
230
|
+
Use this workflow when the user asks which Polygraph session produced, is behind, or changed a particular commit — or a particular line of code.
|
|
231
|
+
|
|
232
|
+
**Given a commit sha.** When the user names a sha, or asks what session is behind a commit, resolve it with `search_sessions` using the `sha` parameter (CLI: `polygraph session search --sha <sha>`):
|
|
233
|
+
|
|
234
|
+
- Pass **exactly one** of `query` or `sha` — they are mutually exclusive.
|
|
235
|
+
- `sha` accepts a full or partial sha, 7-40 hex chars.
|
|
236
|
+
- The lookup is exact and one-shot: it returns the session(s) linked to that commit, newest first, scoped to the current org, and only explicit sessions.
|
|
237
|
+
|
|
238
|
+
```
|
|
239
|
+
search_sessions(sha: "a1b2c3d")
|
|
240
|
+
# CLI equivalent:
|
|
241
|
+
polygraph session search --sha a1b2c3d
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
**Given a line number.** There is no line-number lookup — a line MUST first be resolved to a commit sha with `git blame`, then that sha is fed into the sha lookup:
|
|
245
|
+
|
|
246
|
+
1. `git blame -L <line>,<line> -- <file>` to get the commit that last touched the line.
|
|
247
|
+
2. Pass that sha to `search_sessions(sha: ...)` (or `polygraph session search --sha <sha>`).
|
|
248
|
+
|
|
249
|
+
**Reading the results.**
|
|
250
|
+
|
|
251
|
+
- Multiple sessions may match a sha. They come back newest first — pick the most relevant one and report the others if they matter.
|
|
252
|
+
- **A "no match" result does NOT prove the commit had no work behind it.** Not every commit is linked to an explicit session: commits pushed directly (rather than via an ingested PR) and gaps in ingestion metadata mean the sha may simply not be recorded, and implicit sessions are never returned. Report "no linked session found for that sha" — never assert that no work exists behind the commit.
|
|
253
|
+
|
|
227
254
|
## Simple tasks (fire-and-forget)
|
|
228
255
|
|
|
229
256
|
Use this pattern when the task is well-defined and the child is not expected to need clarification. It is a single-round delegation: kick it off, poll until terminal, then push branch + create PR.
|
|
@@ -440,7 +467,7 @@ Check the details of a session using `show_session` or `polygraph session show -
|
|
|
440
467
|
- `relatedPRs`: Array of related PR URLs across repos
|
|
441
468
|
- `session.ciStatus`: CI pipeline status keyed by PR ID, each containing:
|
|
442
469
|
- `status`: One of `SUCCEEDED`, `FAILED`, `IN_PROGRESS`, `NOT_STARTED` (null if no CIPE and no external CI)
|
|
443
|
-
- `cipeUrl`: URL to the CI pipeline execution details (null if no CIPE)
|
|
470
|
+
- `cipeUrl`: URL to the CI pipeline execution details (null if no CIPE). This is a human-facing Nx Cloud web link — display it to the user, but never fetch, curl, or poll it directly; CIPE data is only accessible programmatically via the Nx MCP `ci_information` tool
|
|
444
471
|
- `completedAt`: Epoch millis timestamp, set only when the CIPE has completed (null otherwise)
|
|
445
472
|
- `selfHealingStatus`: The self-healing fix status string from Nx Cloud's AI fix feature (null if no AI fix exists)
|
|
446
473
|
- `externalCIRuns`: Array of external CI runs (present when no CIPE but external CI data exists, e.g., GitHub Actions). Each run contains:
|
|
@@ -610,7 +637,7 @@ archive_session(
|
|
|
610
637
|
|
|
611
638
|
Use `get_ci_logs` to retrieve the full plain-text log for a specific CI job. This is the drill-in tool for investigating CI failures after identifying a failed job from the session's CI status.
|
|
612
639
|
|
|
613
|
-
**ONLY use this tool when NO CIPE (CI Pipeline Execution) exists for the PR.** When a CIPE exists (`ciStatus[prId].cipeUrl` is non-null), logs and failure data are available through the CIPE system (Nx Cloud) via `ci_information` — do NOT call `get_ci_logs
|
|
640
|
+
**ONLY use this tool when NO CIPE (CI Pipeline Execution) exists for the PR.** When a CIPE exists (`ciStatus[prId].cipeUrl` is non-null), logs and failure data are available through the CIPE system (Nx Cloud) via the Nx MCP `ci_information` tool — do NOT call `get_ci_logs`, and do NOT fetch or poll the `cipeUrl` over HTTP (it is a browser link for the user, not an API). This tool is specifically for PRs where only external CI runs exist (e.g., GitHub Actions runs without an Nx Cloud CIPE).
|
|
614
641
|
|
|
615
642
|
**Parameters:**
|
|
616
643
|
|