[Bug] Projman diagnostic failure: get_labels 404 for user-owned repos #61
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
The
get_labelsMCP tool fails with a 404 error when the repository owner is a user account rather than an organization.Diagnostic Context
Repository tested:
lmiranda/personal-portfolioHost:
gitea.hotserv.cloudFailed Test
get_labels404 Client Error: Not Found for url: https://gitea.hotserv.cloud/api/v1/orgs/lmiranda/labelsRoot Cause
The tool attempts to fetch organization-level labels from
/api/v1/orgs/{owner}/labels, butlmirandais a user account, not an organization. Gitea's org labels endpoint returns 404 for user accounts.Expected Behavior
The tool should:
/api/v1/repos/{owner}/{repo}/labelsPassing Tests (for reference)
All other diagnostic tests passed:
list_issues✓list_milestones✓list_wiki_pages✓search_lessons✓get_branch_protection✓Labels
Fix Applied
Changes made:
mcp-servers/gitea/mcp_server/tools/labels.pyget_labels()to check if repo owner is org or user viais_org_repo()organizationarray)mcp-servers/gitea/mcp_server/gitea_client.py_resolve_label_ids()with same logicmcp-servers/gitea/tests/test_labels.pytest_get_labels_org_owned_repo()- verifies org labels are fetchedtest_get_labels_user_owned_repo()- verifies org labels are skippedowner/repoformatTest Results: 15/15 tests passing
The fix uses the existing
is_org_repo()method which queries/api/v1/repos/{owner}/{repo}and checksowner.typeto determine if the owner is an organization or user.