Repository navigation
Conversation
Adds two opt-in, related config options for attributing traces to external work items, both empty by default (no behavior change for existing users): - CC_LANGFUSE_TAG_COMMAND: run once per hook run; each non-empty stdout line is merged into the trace tags (de-duped, order-preserving). - CC_LANGFUSE_SESSION_LABEL_COMMAND + CC_LANGFUSE_SESSION_LABEL_MODE: use the first stdout line as a label to group the session's traces (prefix / collapse / off). One script can drive both -- tags use every line, the label uses the first. Session labeling changes only the trace grouping id; the incremental-read state key stays on the raw session id, so relabeling never re-emits past turns and needs no state migration. Both paths are fail-open and bounded (timeout, tag count/length, 199-char session id cap). Adds tests/unit/test_custom_tags.py (15 cases). Full suite green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This is #27 by @zerafachris, rebased onto current
main(b5b7cc3, v1.2.1). It is the same single commit, with the original authorship kept.It is an alternative to #27, not an addition. Merge one and close the other:
What the feature does
See #27 for the full description. In short, it adds two opt-in options, both empty by default:
CC_LANGFUSE_TAG_COMMAND: runs a command once per hook run. Each non-empty stdout line becomes a trace tag.CC_LANGFUSE_SESSION_LABEL_COMMAND+CC_LANGFUSE_SESSION_LABEL_MODE: the first stdout line becomes a label that groups the session's traces (prefix/collapse/off).It composes with
CC_LANGFUSE_TRACE_TAGSfrom #87. That one covers tags the launching process already knows. This one covers tags computed at run time.What changed in the rebase
get_trace_tags(): the operator tags from feat(hook): accept caller trace tags via CC_LANGFUSE_TRACE_TAGS #87 come first, then the command tags. Both are de-duped against the tags already in the list.emit_new_turns_from_transcript(): keeps the per-session lock from fix(hook): narrow the state lock so concurrent sessions keep their turns #89. Thetrace_session_iddefault sits in front of it.mainnow emits through two calls:emit_and_close_ready_turns()andemit_ready_observations_of_open_turn(). Git movedtrace_session_idonto the open-turn call only, so closed turns lost the label. Both calls get it now.userConfigdescriptions inplugin.json. The README sections are dropped; the fouruserConfigentries stay.Testing
uv run --with pytest pytest -q: 293 pass. One fails:tests/integration/test_state_lock_contention.py::test_entry_of_another_session_survives_the_emit. It fails onmaintoo, so this change does not cause it.Refs #27, #62.
🤖 Generated with Claude Code