8000
  • feat: add client session tracking by dannykopping · Pull Request #198 · coder/aibridge · GitHub
    [go: up one dir, main page]

    Skip to content

    feat: add client session tracking#198

    Merged
    dannykopping merged 10 commits intomainfrom
    dk/session-id-tracking
    Mar 6, 2026
    Merged

    feat: add client session tracking#198
    dannykopping merged 10 commits intomainfrom
    dk/session-id-tracking

    Conversation

    @dannykopping
    Copy link
    Collaborator
    @dannykopping dannykopping commented Mar 2, 2026

    Refactor client detection and add session tracking

    This change extracts client detection logic into a dedicated module and introduces session tracking capabilities for AI bridge interceptions.

    Closes #166
    Required for coder/internal#1336

    Changes

    • Extract client detection: Move guessClient function and client constants from bridge.go to new client.go file
    • Add Client type: Introduce Client type alias for better type safety and rename ClientClaude to ClientClaudeCode
    • Implement session tracking: Add guessSessionID function in session.go to extract session identifiers from requests
    • Update interception records: Add ClientSessionID field to InterceptionRecord and call session detection before creating interceptors
    • Add comprehensive tests: Include test coverage for both client detection and session ID extraction

    The session detection supports as many of our supported clients as possible.

    Copy link
    Collaborator Author
    dannykopping commented Mar 2, 2026

    @dannykopping dannykopping changed the title chore: refactoring client guessing functionality into separate file feat: Mar 2, 2026
    @dannykopping dannykopping changed the title feat: feat: add client session tracking Mar 2, 2026
    @dannykopping dannykopping changed the base branch from dk/tool-call-id-correlation to graphite-base/198 March 2, 2026 10:28
    @dannykopping dannykopping force-pushed the dk/session-id-tracking branch from 3db08de to e86601f Compare March 4, 2026 08:58
    @dannykopping dannykopping changed the base branch from graphite-base/198 to main March 4, 2026 08:58
    Signed-off-by: Danny Kopping <danny@coder.com>
    Signed-off-by: Danny Kopping <danny@coder.com>
    Signed-off-by: Danny Kopping <danny@coder.com>
    Signed-off-by: Danny Kopping <danny@coder.com>
    Signed-off-by: Danny Kopping <danny@coder.com>
    Signed-off-by: Danny Kopping <danny@coder.com>
    Signed-off-by: Danny Kopping <danny@coder.com>
    Signed-off-by: Danny Kopping <danny@coder.com>
    Signed-off-by: Danny Kopping <danny@coder.com>
    @dannykopping dannykopping force-pushed the dk/session-id-tracking branch from bff1cbf to f91aa3a Compare March 4, 2026 13:55
    @dannykopping dannykopping marked this pull request as ready for review March 4, 2026 13:59
    @dannykopping dannykopping self-assigned this Mar 4, 2026
    Copy link
    Contributor
    @ssncferreira ssncferreira left a comment

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    LGTM 👍 just a few comments

    8000
    Signed-off-by: Danny Kopping <danny@coder.com>
    Copy link
    Contributor
    @ssncferreira ssncferreira left a comment

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    LGTM 🥇 Thanks for addressing the comments

    Copy link
    Collaborator Author
    dannykopping commented Mar 6, 2026

    Merge activity

    • Mar 6, 11:52 AM UTC: A user started a stack merge that includes this pull request via Graphite.
    • Mar 6, 11:52 AM UTC: @dannykopping merged this pull request with Graphite.

    @dannykopping dannykopping merged commit e559e5e into main Mar 6, 2026
    5 checks passed
    dannykopping added a commit to coder/coder that referenced this pull request Mar 6, 2026
    This change adds support for tracking client session IDs in AI Bridge interceptions to enable better session-based auditing.
    
    Depends on coder/aibridge#198  
    Fixes coder/internal#1337
    
    The session ID field is optional and not universally supported by all clients.
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Labels

    None yet

    Projects

    None yet

    Development

    Successfully merging this pull request may close these issues.

    Record session ID

    2 participants

    0