Class GitHubBotIdentityResolver

java.lang.Object
io.agentscope.extensions.channel.github.GitHubBotIdentityResolver

public final class GitHubBotIdentityResolver extends Object
Resolves the bot's GitHub user id (and login) for the configured PAT by calling GET /user. Used for bot-loop self-detection in the webhook handler — when a webhook delivers a comment authored by the bot itself, the channel must drop it instead of looping forever.

The lookup is best-effort: a network failure does not block startup. The resolved id is cached for the lifetime of the channel and accessed via botUserId().

  • Constructor Details

    • GitHubBotIdentityResolver

      public GitHubBotIdentityResolver(String apiBase, String token, String botLoginOverride)
  • Method Details

    • refresh

      public void refresh()
      Synchronously attempts to resolve GET /user and cache the response. Errors are logged at WARN; startup continues.
    • botUserId

      public long botUserId()
      Returns the bot's numeric user id, or -1 if unresolved.
    • botLogin

      public String botLogin()
      Returns the bot's login (handle), or null if unresolved.