Skip to content

Commit 6291fa6

Browse files
nik13claude
andcommitted
feat(coding-agents): Kiro IDE string tool errors, how others support Kiro, live-agent verification (TH-8286)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent e134c66 commit 6291fa6

3 files changed

Lines changed: 32 additions & 2 deletions

File tree

‎examples/coding-agents/hook-to-otlp/adapters/kiro_ide.py‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,11 @@ def _enum(value: Any) -> Any:
6363

6464

6565
def _tool_failed(response: Any) -> bool:
66-
return isinstance(response, dict) and response.get("success") is False
66+
if isinstance(response, dict):
67+
return response.get("success") is False
68+
# A real Kiro agent (kiro-cli 2.31.1, same hook engine) reports a failed
69+
# built-in tool as a plain string, e.g. "Caught error reading: ENOENT: ...".
70+
return isinstance(response, str) and response.startswith("Caught error")
6771

6872

6973
def parse(event: str, payload: Dict[str, Any]) -> List[SpanEvent]:

‎examples/coding-agents/hook-to-otlp/tests/test_kiro_ide_adapter.py‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,19 @@ def test_error_text_with_paths_is_not_exported_by_default(self):
159159
self.assertNotIn("/Users/", encoded)
160160
self.assertIn("tool reported failure", encoded)
161161

162+
def test_string_error_response_from_real_agent_is_an_error_span(self):
163+
# Shape captured from a real kiro-cli 2.31.1 session (read_file on a missing file).
164+
err = "Caught error reading: ENOENT: no such file or directory, stat '/Users/alice.smith/p/missing.txt'"
165+
records = self.records[:2] + [{"event": "PostToolUse", "payload": {
166+
"session_id": SID, "tool_name": "read_file", "tool_input": {"path": "/Users/alice.smith/p/missing.txt"},
167+
"tool_response": err}}]
168+
spans = replay(kiro_ide, config("kiro_ide", self.tmp.name), records)
169+
tool, = by_name(spans, "read_file")
170+
self.assertEqual(tool["status"], {"code": 2, "message": "tool reported failure"})
171+
encoded = json.dumps(spans)
172+
self.assertNotIn("alice.smith", encoded)
173+
self.assertNotIn("ENOENT", encoded)
174+
162175
def test_shipped_commands_fail_open_when_emitter_is_missing(self):
163176
root = pathlib.Path(__file__).resolve().parents[2] / "kiro-ide"
164177
for path in (root / "fi-hook-to-otlp.json", root / "fi-hook-to-otlp.user.json"):

‎src/pages/docs/integrations/coding-agents/kiro-ide.mdx‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ This is not the same as:
2525

2626
| | |
2727
| --- | --- |
28-
| Checked with | Kiro IDE 1.2.37 (macOS, Apple silicon): payload contract and hook-file schema checked against the shipped `kiro.kiro-agent` extension; live session pending sign-in |
28+
| Checked with | Kiro IDE 1.2.37 (macOS, Apple silicon): payload contract and hook-file schema checked against the shipped `kiro.kiro-agent` extension. Live sessions were run on Kiro CLI 2.31.1, which uses the same hook file schema and payloads (see [Verification status](#verification-status)). The Kiro IDE app itself was not signed in. |
2929
| Kiro docs used | [Hooks](https://kiro.dev/docs/hooks/), [Hook types](https://kiro.dev/docs/hooks/types/), [Hook actions](https://kiro.dev/docs/hooks/actions/), read 2026-10-14 |
3030
| Requires | Kiro IDE 1.0 or later (`.kiro/hooks/*.json` format), Python 3.9+ on the `PATH` Kiro uses. No packages. |
3131
| Source | [examples/coding-agents/kiro-ide](https://github.com/future-agi/docs/tree/main/examples/coding-agents/kiro-ide) and [hook-to-otlp](https://github.com/future-agi/docs/tree/main/examples/coding-agents/hook-to-otlp) |
@@ -107,6 +107,11 @@ Open **Observe** in Future AGI and select the project (`kiro-ide-sessions` above
107107

108108
Kiro sends no turn id and no tool call id. A `Stop` closes the open turn, and each `PostToolUse`, `PostTaskExec`, and file event becomes its own span under that turn, marked `coding_agent.turn.inferred=true` because the turn was matched by time rather than by an id. Because only completed hooks are observed, a tool that Kiro blocked or that you denied does not appear.
109109

110+
## How other tools support Kiro
111+
112+
- **Hooks.** Langfuse traces Kiro IDE through the same `.kiro/hooks` triggers ([Kiro IDE](https://langfuse.com/integrations/developer-tools/kiro), [Kiro CLI](https://langfuse.com/integrations/developer-tools/kiro-cli)). Arize Phoenix traces Kiro CLI through hooks on a Kiro agent ([Phoenix: Kiro](https://www.arize.com/docs/phoenix/integrations/coding-agents/kiro)). This recipe uses the same mechanism.
113+
- **Not found.** No Kiro page was found for LangSmith, Datadog, Honeycomb, SigNoz, Braintrust, Laminar, Opik, Helicone, PostHog or AgentOps. Kiro's own enterprise OpenTelemetry feed carries daily usage metrics only.
114+
110115
## What is not available
111116

112117
- **Model, token counts, and cost.** Kiro hook payloads do not include them.
@@ -152,3 +157,11 @@ rm -r /path/to/your/project/.kiro/fi-hook-to-otlp
152157
```
153158

154159
For a `--user` install, remove `~/.kiro/hooks/fi-hook-to-otlp.json` and then `~/.kiro/fi-hook-to-otlp`. The guarded commands make the reverse order safe too: a hook whose emitter is missing exits `0` and does nothing.
160+
161+
## Verification status
162+
163+
Verified 2026-10-20 against a local Future AGI.
164+
165+
- **Real:** the hook file schema and trigger names (Kiro docs and the shipped `kiro.kiro-agent` extension); the hook engine and payloads of a real signed-in Kiro CLI 2.31.1 agent session, which loads the same `.kiro/hooks/*.json` file and ran this recipe's commands (`SessionStart`, `UserPromptSubmit`, `PostToolUse`, `PostFileCreate`, `PostFileSave`, `Stop`). Spans were stored and shown in Observe. The CLI session was labelled Kiro IDE because the CLI also loads this file.
166+
- **Real payload facts:** a failed built-in tool is reported as a plain string (`Caught error reading: ENOENT ...`), not as `{"success": false}`. The adapter treats both as errors. The CLI sends no `SessionEnd` in non-interactive runs.
167+
- **Not tested:** the Kiro IDE app (Electron) running the hooks. It needs a Kiro sign-in, which was not done. The IDE-only parts are still the documented and extension-derived ones: `PostTaskExec`, `SessionEnd` on runtime teardown, and `/bin/sh -c` execution from the first workspace folder.

0 commit comments

Comments
 (0)