Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[Bug]: Polyscope API reporting 0 repositories

未关闭
#150 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
44/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清

调研方向

首先跟踪 GET /api/v1/repositories,并将其结果与 GET /api/v1/servers 以及日志中描述的 relay 注册状态进行比较。使用列出的 repository ID 重现间歇性的空响应、部分响应和完整响应;完成标准是该端点始终返回已为经过身份验证的账户注册的所有 repository。

由索引模型根据 Issue 内容生成。

描述

Platform

macOS

Operating system version

Mac OS Tahoe 26.3

System architecture

ARM64 (M1, M2, etc)

PolyScope Version

0.17.0

Bug description

Authenticated calls to GET /api/v1/repositories return an empty list for my account, but the local Polyscope server (desktop app) has six repositories registered for that same account. They show up in the UI, and the local server logs show worktree.list requests for each of them at startup.

The behaviour is intermittent. Sometimes /repositories returns the expected list, sometimes it returns {"data": []} with no change on my side. Same token, same account, same local server running. Earlier the same day I successfully POSTed workspaces against IDs returned by this endpoint, so it was working; a few hours later it started returning empty and stayed empty for a stretch; then it returned a partial list (just 1 of 6 repos); then empty again. No API-side mutations from me between the state changes.

Auth isn't the issue. GET /api/v1/servers with the same token consistently returns both of my connected servers as online: true, including the Mac server whose local log lists the six repo IDs. I also regenerated the token in the UI and the intermittent behaviour is identical with the new token.

Impact: any API client that has to discover a repo by listing first is unreliable. Hard-coded repo IDs still work for POST /api/v1/workspaces when they're remembered from a previous successful list call, but fresh setups hit a coin flip on whether the API will return anything.

The six repo IDs the local server tracks (and which /repositories should be returning):
7e7c4fd4, 8a23f2e1, 58dc1e37, b8f1a2ac, 813d41ae, 08a13118

Steps to reproduce
  1. Have a Polyscope account with at least one repo registered (visible in the UI, desktop app running and connected to the relay).
  2. Generate or regenerate an API token from the Polyscope UI for that account.
  3. Hit the endpoint:
    curl -H "Authorization: Bearer $TOKEN" https://getpolyscope.com/api/v1/repositories
  4. Response is {"data": []}.
  5. Sanity check the same token against a different endpoint:
    curl -H "Authorization: Bearer $TOKEN" https://getpolyscope.com/api/v1/servers
    This returns the account's servers correctly, including online status. So the token and auth layer are fine.

Additional checks that didn't change the outcome:

  • ?all=true, ?status=all, ?state=all, ?include=disconnected, ?include_unregistered=true all returned {"data": []}.
  • /api/v1/servers/<server_id>/repositories returns 404.
  • Regenerated the token, same result.
  • /api/v1/workspaces also returns {"data": []} for this account, probably correct but worth noting for consistency.

Rough timeline on the same day (2026-04-22):

  • Around 00:50 local: /repositories returned 2 repos.
  • Around 10:00 local: returned 1 repo.
  • From about 11:30 local onward: returns 0.

No deletions were made through the API between those checks.

Relevant log output
[electron] Starting prod server: /Applications/Polyscope.app/Contents/Resources/polyscope-server
[server] [relay-client] Connecting to relay at wss://relay-edge.getpolyscope.com...
[server] [polyscope] Server running on ws://0.0.0.0:4321/ws
[server] [polyscope] REST API: http://0.0.0.0:4321/api
[server] [polyscope] WS upgrade request from 127.0.0.1 localhost: true
[server] [polyscope] Client connected
[server] [ws] received: repo.list {"type":"repo.list"}
[server] [polyscope] Hydrated auth user from stored token
[server] [ws] received: auth.set {"type":"auth.set","user":{"id":<REDACTED>,"name":"<REDACTED>","email":"<REDACTED>","avatar":"<REDACTED>","subscribed":true,"on_trial":false,"expose_token":"<REDACTED>
[server] [ws] broadcast: auth.status {"type":"auth.status","user":{"id":<REDACTED>,"name":"<REDACTED>","email":"<REDACTED>","avatar":"<REDACTED>
[server] [ws] received: worktree.list {"type":"worktree.list","repoId":"7e7c4fd4"}
[server] [ws] received: repo.detect_integrations {"type":"repo.detect_integrations","repoId":"7e7c4fd4"}
[server] [ws] received: worktree.list {"type":"worktree.list","repoId":"8a23f2e1"}
[server] [ws] received: repo.detect_integrations {"type":"repo.detect_integrations","repoId":"8a23f2e1"}
[server] [ws] received: worktree.list {"type":"worktree.list","repoId":"58dc1e37"}
[server] [ws] received: repo.detect_integrations {"type":"repo.detect_integrations","repoId":"58dc1e37"}
[server] [ws] received: worktree.list {"type":"worktree.list","repoId":"b8f1a2ac"}
[server] [ws] received: repo.detect_integrations {"type":"repo.detect_integrations","repoId":"b8f1a2ac"}
[server] [ws] received: worktree.list {"type":"worktree.list","repoId":"813d41ae"}
[server] [ws] received: repo.detect_integrations {"type":"repo.detect_integrations","repoId":"813d41ae"}
[server] [ws] received: worktree.list {"type":"worktree.list","repoId":"08a13118"}
[server] [ws] received: repo.detect_integrations {"type":"repo.detect_integrations","repoId":"08a13118"}
[server] [relay-client] Connected to relay
[server] [relay-client] Registered as server 46b12b9c-30b

Meanwhile, same token, same moment, cloud REST API:
$ curl -H "Authorization: Bearer $POLYSCOPE_TOKEN" https://getpolyscope.com/api/v1/repositories
{"data":[]}

$ curl -H "Authorization: Bearer $POLYSCOPE_TOKEN" https://getpolyscope.com/api/v1/servers
{"data":[
  {"id":"46b12b9c-30b","online":true,"platform":"darwin","version":"0.17.0","name":"<REDACTED>"},
  {"id":"a574620f-013","online":true,"platform":"linux","version":"0.17.0","name":"<REDACTED>"}
]}
主要语言
没有语言数据
星标
20
派生
0
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

beyondcode/polyscope-community 的其他 Issue

查看 beyondcode/polyscope-community 的全部 Issue

相似的 Issue

更多 Backend & API Design Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。