open-code-review icon indicating copy to clipboard operation
open-code-review copied to clipboard

feat(telemetry): display session ID in terminal summary output

Open lizhengfeng101 opened this issue 3 months ago • 3 comments

Description

After a review completes, the CLI prints a one-line summary to the terminal:

[ocr] Summary: 8 file(s) reviewed, 2 comment(s), ~1930609 token(s) used (input: ~1910202, output: ~20407), 4m32s elapsed

The session ID is not shown in this text output (it is included in --format json output). Users who want to ocr resume <session-id> or reference a specific session for debugging must manually look up the ID from ~/.ocr/sessions/.

We should print the full session UUID on a separate line below the summary:

[ocr] Summary: 8 file(s) reviewed, 2 comment(s), ~1930609 token(s) used (input: ~1910202, output: ~20407), 4m32s elapsed
[ocr] Session: 3a7f2b1c-9d4e-4f8a-b2c1-6e7f8a9b0c1d

Scope

  • File(s): internal/telemetry/events.go, cmd/opencodereview/shared.go
  • Function: PrintTraceSummary
  • The session ID is already available at the call site via ag.SessionID() (see cmd/opencodereview/shared.go:378)

Implementation Hints

  1. Add a sessionID string parameter to PrintTraceSummary (or create a new PrintSessionID helper).
  2. Print [ocr] Session: <id>\n immediately after the summary line when sessionID != "".
  3. Update the call site in cmd/opencodereview/shared.go:365 to pass ag.SessionID().
  4. Update the existing tests in internal/telemetry/events_test.go.

Acceptance Criteria

  • [ ] Terminal (non-JSON) output shows [ocr] Session: <uuid> on the line after the summary
  • [ ] The session line is omitted when session ID is empty (e.g. dry-run / preview modes)
  • [ ] JSON output is unchanged
  • [ ] Tests pass (make test)
  • [ ] Code check passes (make check)

Context

Discussed in the context of improving CLI ergonomics — making it easy to copy the session ID for ocr resume without needing --format json or filesystem browsing.

lizhengfeng101 avatar Aug 12 '26 08:08 lizhengfeng101

would like to work on this issue

amh1k avatar Aug 12 '26 09:08 amh1k

Opened #870 implementing this. @amh1k FYI in case you have already started — happy to collaborate if you are taking a different approach.

AllenMuu avatar Aug 12 '26 09:08 AllenMuu

Opened #870 implementing this. @amh1k FYI in case you have already started — happy to collaborate if you are taking a different approach.

Haven't started. Sure go ahead!

amh1k avatar Aug 12 '26 09:08 amh1k