You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 6513a26
Browse filesBrowse the repository at this point in the historyBrowse files
Hooks never block the host:
- Cursor hooks.json / hooks.user.json use the canonical guarded command
`python3 -B <emit.py> cursor <Event> 2>/dev/null || true`; new
test_cursor_hooks_config runs every shipped command through sh/zsh/bash
with the emitter missing, python3 missing, and installed (exit 0, empty
or expected stdout, no __pycache__).
- A misregistered permission hook now prints nothing (Cursor fails open on
no output) instead of answering {"permission": "allow"}.
Privacy and doc truth:
- Opted-in content keeps paths but replaces the user name in home paths with
<user>; pages now say paths inside prompts/tool input/output are exported
with content on, never as metadata. Test: error text with a path and user
name is absent by default and scrubbed with content on.
- State file keeps content only for open spans and turns closed as
incomplete; a duplicate end of a completed turn is ignored.
- Windows: inline send uses a 3 s default timeout; pages say background send
and state locking are macOS/Linux only.
- Cursor page: cache tokens are captured (removed from "not available").
Tree:
- Tool/subagent/llm/event spans without a turn id go under the open turn and
get coding_agent.turn.inferred=true (pages corrected; PRD R-02 deviation).
- Children never start before the root once its start is fixed.
- Subagent span key includes the turn and duration (no cross-turn overwrite).
- Root model comes from session/turn/llm events only.
- transcript_path test uses an unreadable canary and spies on os.open too.
E2E tooling: replay --replace rewrites substrings (suffixed generation ids),
run_e2e.sh gives any fixture fresh UUID ids.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
`|| true` makes every failure exit 0 with empty stdout; `2>/dev/null` keeps Python's
42
+
own error text out of host logs (the emitter never writes to stderr); `-B` keeps
43
+
`__pycache__` out of the customer's repo. Pass the event name explicitly. Do not add
44
+
`echo` fallbacks (a second JSON object is invalid output). The form needs a POSIX shell;
45
+
document the equivalent on hosts whose hook runner is not one. Add a config test like
46
+
`tests/test_cursor_hooks_config.py`: run every shipped command through `sh -c` with the
47
+
emitter missing, with `python3` missing, and installed, and assert exit 0 plus the
48
+
expected (or empty) stdout.
29
49
30
50
| Variable | Default | Meaning |
31
51
| --- | --- | --- |
@@ -35,9 +55,9 @@ process so the host is not kept waiting.
35
55
|`FI_OTLP_ENDPOINT`| none | Full traces URL; overrides `FI_BASE_URL`. |
36
56
|`FI_HOOK_CAPTURE_CONTENT`| off |`1` exports prompts, tool input/output, model text, error text. |
37
57
|`FI_HOOK_MAX_CONTENT_CHARS`|`4096`| Per-field cap when content is on. |
38
-
|`FI_HOOK_TIMEOUT`|`10`| HTTP timeout in seconds (the send runs in a detached process, so the host never waits on it). |
58
+
|`FI_HOOK_TIMEOUT`|`10`(`3` without `fork`, i.e. Windows) | HTTP timeout in seconds. On macOS/Linux the send runs in a detached process, so the host never waits on it; on Windows it is inline. |
39
59
|`FI_HOOK_SYNC`| off |`1` sends inline instead of in a detached child (tests, debugging). |
40
-
|`FI_HOOK_STATE_DIR`|`$TMPDIR/fi-hook-to-otlp-<uid>`| Per-session state files (0600, removed at session end, swept after 24 h). |
60
+
|`FI_HOOK_STATE_DIR`|`$TMPDIR/fi-hook-to-otlp-<uid>`| Per-session state files (0600, removed at session end, swept after 24 h). With content on they also hold the content of spans that have not ended yet (for example the open turn's prompt) and of up to 8 turns closed as incomplete; completed turns keep no content. |
41
61
|`FI_HOOK_LOG_FILE`| none | One line per hook: event, span count, HTTP status. No content, no keys. |
42
62
|`FI_HOOK_DUMP_FILE`| none | Appends each OTLP/JSON body exactly as sent (privacy checks). |
43
63
|`FI_HOOK_DISABLED`| off |`1` turns the hook into a no-op. |
@@ -57,7 +77,10 @@ process so the host is not kept waiting.
57
77
- Trace id = `sha256("trace", app, session_id)[:32]`; span ids are derived from
58
78
`(app, session_id, scope, key)`, so retries of the same hook overwrite rather than duplicate.
59
79
- A span's start is the matching START hook if one was seen, else `end - duration_ms`
60
-
from the payload, else the hook time. A turn opens on the first event that names it.
80
+
from the payload, else the hook time, never earlier than the root's start once the
81
+
root has been sent. A turn opens on the first event that names it.
82
+
- A tool/subagent/llm/event span without `turn_id` goes under the open turn and gets
83
+
`coding_agent.turn.inferred=true`; with no open turn it goes under the session.
61
84
- A turn end closes still-open children of that turn (`coding_agent.incomplete=true`);
62
85
a session end closes everything and deletes the state file.
63
86
- One turn is open per session: a turn START closes any other open turn (and its
@@ -66,7 +89,10 @@ process so the host is not kept waiting.
66
89
- Every span carries `session.id`, `gen_ai.conversation.id`, `coding_agent.app`,
67
90
`coding_agent.scope`, `coding_agent.hook.event`, and `coding_agent.turn.id` when known.
68
91
Tool spans add `gen_ai.tool.name` and `gen_ai.tool.call.id`; session/turn/llm/subagent
69
-
spans add `llm.model_name` when the payload names a model.
92
+
spans add `llm.model_name` when the payload names a model (the root uses the last model
93
+
reported by a session, turn or llm event).
94
+
- Opted-in content keeps paths but replaces the user name in home-directory paths with
0 commit comments