Skip to content

Commit 0bc10d0

Browse files
salma-remyxclaude
andcommitted
fix: repo-sourced interest create/regenerate payload handling
Two bugs hit during the 'remyxai interests create --repo ...' flow: 1. log_api_response treated HTTP 202 as an error. Async-kickoff endpoints (analyze-repo, regenerate) return 202 Accepted, which is success. Broaden the success check to 2xx so those calls stop dumping bogus ERROR logs. 2. _wait_for_repo_analysis returned the raw task envelope from Redis, but the actual analysis payload (report_markdown, repo_analysis, source_repo_metadata, full_name, ...) lives under `result`. Callers were reading top-level keys that were always None, so after a successful analysis the CLI still prompted the user for name and context. Unwrap `result` inside the helper so callers get the payload directly, and also consult `full_name` at the top of `result` when auto-naming. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 9d579b7 commit 0bc10d0

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

remyxai/api/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ def get_headers(api_key=None):
6767

6868
def log_api_response(response):
6969
"""Log the response from the API based on the status code."""
70-
if response.status_code in [200, 201]:
70+
# 2xx responses are all success — async-kickoff endpoints return 202.
71+
if 200 <= response.status_code < 300:
7172
logging.debug(
7273
f"API call successful: {response.url}, Status: {response.status_code}"
7374
)

remyxai/cli/interest_actions.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ def _wait_for_repo_analysis(
3737
) -> dict:
3838
"""Block until a repo-analysis task completes or fails.
3939
40-
Surfaces progress messages inline so the user sees what's happening.
40+
Returns the inner `result` payload (report_markdown, repo_analysis,
41+
source_repo_metadata, ...) — the Redis-backed task envelope wraps
42+
that payload, which callers shouldn't have to unwrap themselves.
4143
"""
4244
click.echo(f" task_id: {task_id}")
4345
click.echo(" Waiting for analysis to complete (up to {}s)...".format(timeout_s))
@@ -54,7 +56,7 @@ def _wait_for_repo_analysis(
5456
last_message = message
5557

5658
if status in ("complete", "completed", "done"):
57-
return task
59+
return task.get("result") or {}
5860
if status in ("failed", "error"):
5961
click.echo(
6062
f"❌ Analysis failed: {task.get('error') or message or 'unknown error'}",
@@ -215,7 +217,11 @@ def handle_interests_create(
215217
# Auto-name from repo "owner/name" if not provided.
216218
if not name:
217219
meta = repo_payload.get("source_repo_metadata") or {}
218-
auto = meta.get("name") or meta.get("full_name")
220+
auto = (
221+
repo_payload.get("full_name")
222+
or meta.get("full_name")
223+
or meta.get("name")
224+
)
219225
if auto:
220226
name = auto
221227
click.echo(f" Using auto-generated name: {name}\n")

0 commit comments

Comments
 (0)