Skip to content

fix: resolve lost websocket logs, missing agent loop cancellation, and webide port mismatch - #106

Open
archittmittal wants to merge 4 commits into
PxA-Labs:mainfrom
archittmittal:fix/issue-40
Open

fix: resolve lost websocket logs, missing agent loop cancellation, and webide port mismatch#106
archittmittal wants to merge 4 commits into
PxA-Labs:mainfrom
archittmittal:fix/issue-40

Conversation

@archittmittal

@archittmittal archittmittal commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Resolves #40. This PR fixes the three critical bugs from issue #40: lost WebSocket logs, missing agent loop cancellation, and WebIDE port mismatch. Under professionalism constraints, no emojis have been used in code, commit, or PR details.

Summary by CodeRabbit

  • Bug Fixes

    • Improved cancellation handling so stopped agent runs are recorded accurately and terminate cleanly.
    • Fixed local development connections to consistently use the backend on port 8000, regardless of the frontend port.
    • Preserved reliable WebSocket and backend connectivity across the dashboard and interactive development tools.
  • Documentation

    • Added a living issue tracker with categorized priorities, statuses, related references, and activity updates.

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@archittmittal, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 51 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 5557ee40-5f25-4ad5-ba73-357ba707a5c3

📥 Commits

Reviewing files that changed from the base of the PR and between 7541641 and de49d03.

📒 Files selected for processing (3)
  • .github/workflows/greetings.yml
  • .github/workflows/pr-size-labeler.yml
  • backend/agents.py
📝 Walkthrough

Walkthrough

Changes

The backend now handles agent-task cancellation and persists failed run status. Local frontend components now route localhost and loopback requests to backend port 8000. An issue tracker was added, and several Python scripts were reformatted without behavior changes.

Runtime fixes

Layer / File(s) Summary
Agent cancellation handling
backend/agents.py, backend/main.py
The agent loop records cancellation as a failed run and re-raises asyncio.CancelledError. stop_agents awaits the cancelled task and clears the active task.
Local backend URL routing
dashboard/src/app/page.tsx, dashboard/src/components/InteractiveTerminal.tsx, dashboard/src/components/WebIDE.tsx
Localhost and 127.0.0.1 now resolve to port 8000 whenever the current frontend port is not 8000.

Repository maintenance

Layer / File(s) Summary
Issue tracker documentation
ISSUES.md
Added categorized issue tables, status conventions, references, and a daily activity log.
Python script formatting
generate_ppt.py, patch_comments.py, test_groq.py
Reformatted statements, expanded calls, and standardized string quoting without changing execution behavior.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant StopEndpoint
  participant AgentTask
  participant AgentLoop
  participant Supabase

  StopEndpoint->>AgentTask: cancel()
  AgentTask->>AgentLoop: raise asyncio.CancelledError
  AgentLoop->>Supabase: mark run failed
  AgentLoop-->>StopEndpoint: propagate cancellation
  StopEndpoint-->>StopEndpoint: clear active_task
Loading

Possibly related PRs

Suggested labels: size/size/L

Suggested reviewers: purvanshjoshi

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning ISSUES.md and formatting-only changes in generate_ppt.py, patch_comments.py, and test_groq.py are unrelated to issue #40. Remove unrelated files and formatting-only changes, or document why each change is required for issue #40.
Linked Issues check ❓ Inconclusive The summaries support cancellation and port fixes but provide no evidence for log preservation, git pull, review checks, GitNexus cleanup, or token protection. Provide reviewable evidence that all remaining requirements in issue #40 are implemented, or link the work that addresses them.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the three primary fixes addressed by the pull request.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@dashboard/src/app/page.tsx`:
- Around line 35-36: Update getBackendUrl in dashboard/src/app/page.tsx at lines
35-36 to recognize ::1 and [::1] as local loopback hosts and retain brackets
when constructing the backend URL on port 8000. Apply the same IPv6 loopback
detection and bracket-preserving backend URL selection in
dashboard/src/components/InteractiveTerminal.tsx at line 50 and
dashboard/src/components/WebIDE.tsx at line 140.

In `@generate_ppt.py`:
- Line 81: Replace the Unicode emoji prefixes in the presentation label strings
near “THINKS (Context & Logic)” and the corresponding strings at the other
referenced locations with plain-text prefixes, preserving the existing labels
and formatting while ensuring no emoji characters remain.

In `@ISSUES.md`:
- Line 17: Move issue `#4`, “Log stream has no auto-scroll,” from its current
table into the `UX Enhancements` table in `ISSUES.md`, preserving the row’s
details and ensuring its `P1` priority remains only if that priority is
intentional.

In `@patch_comments.py`:
- Around line 22-26: Add the project-standard finite timeout to the
requests.patch call in patch_comments.py and the requests.get call in
test_groq.py, ensuring both external requests cannot block indefinitely.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d80617aa-a038-4da2-acfa-a2a6c9818d7e

📥 Commits

Reviewing files that changed from the base of the PR and between ed03cf7 and 7541641.

⛔ Files ignored due to path filters (1)
  • dashboard/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (9)
  • ISSUES.md
  • backend/agents.py
  • backend/main.py
  • dashboard/src/app/page.tsx
  • dashboard/src/components/InteractiveTerminal.tsx
  • dashboard/src/components/WebIDE.tsx
  • generate_ppt.py
  • patch_comments.py
  • test_groq.py

Comment on lines +35 to +36
// In local dev (Next.js can run on 3000, 3001, etc. but FastAPI runs on 8000)
if ((hostname === "localhost" || hostname === "127.0.0.1") && port !== "8000") {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Handle IPv6 loopback as local development.

The condition covers localhost and 127.0.0.1, but not IPv6 loopback (::1 or [::1]). When a user opens the dashboard through http://[::1]:3000, requests can target the frontend port instead of backend port 8000. Add IPv6 loopback detection and preserve bracket syntax when constructing the backend URL.

  • dashboard/src/app/page.tsx Lines 35-36: update getBackendUrl.
  • dashboard/src/components/InteractiveTerminal.tsx Line 50: update the WebSocket backend URL selection.
  • dashboard/src/components/WebIDE.tsx Line 140: update the file tree and content backend URL selection.
📍 Affects 3 files
  • dashboard/src/app/page.tsx#L35-L36 (this comment)
  • dashboard/src/components/InteractiveTerminal.tsx#L50-L50
  • dashboard/src/components/WebIDE.tsx#L140-L140
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@dashboard/src/app/page.tsx` around lines 35 - 36, Update getBackendUrl in
dashboard/src/app/page.tsx at lines 35-36 to recognize ::1 and [::1] as local
loopback hosts and retain brackets when constructing the backend URL on port
8000. Apply the same IPv6 loopback detection and bracket-preserving backend URL
selection in dashboard/src/components/InteractiveTerminal.tsx at line 50 and
dashboard/src/components/WebIDE.tsx at line 140.

Comment thread generate_ppt.py

add_bullet(
tf,
"🧠 THINKS (Context & Logic)",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Remove the Unicode emoji prefixes if the no-emoji requirement applies.

These strings still write emoji characters into the generated presentation. This conflicts with the stated objective that no emojis appear in the code. Replace the prefixes with plain text.

Also applies to: 98-98, 117-117, 141-141, 165-165, 188-188, 204-204

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@generate_ppt.py` at line 81, Replace the Unicode emoji prefixes in the
presentation label strings near “THINKS (Context & Logic)” and the corresponding
strings at the other referenced locations with plain-text prefixes, preserving
the existing labels and formatting while ensuring no emoji characters remain.

Comment thread ISSUES.md
| 1 | CORS misconfiguration blocks Hugging Face deployments | P0 | `[o]` | [#2](https://github.com/archittmittal/AutoMaintainer/issues/2) | [#51](https://github.com/PxA-Labs/AutoMaintainer/issues/51) |
| 2 | Implementer commits dummy code instead of real file changes | P0 | `[o]` | [#3](https://github.com/archittmittal/AutoMaintainer/issues/3) | [#52](https://github.com/PxA-Labs/AutoMaintainer/issues/52) |
| 3 | `/tmp` repo clones never cleaned up — disk exhaustion | P1 | `[ ]` | — | — |
| 4 | Log stream has no auto-scroll | P1 | `[ ]` | — | — |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Move issue #4 to UX Enhancements.

“Log stream has no auto-scroll” is a UX issue, not a critical bug. Move this row to the UX Enhancements table so category-based triage remains accurate. Keep priority P1 only if that priority is intentional.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ISSUES.md` at line 17, Move issue `#4`, “Log stream has no auto-scroll,” from
its current table into the `UX Enhancements` table in `ISSUES.md`, preserving
the row’s details and ensuring its `P1` priority remains only if that priority
is intentional.

Comment thread patch_comments.py
Comment on lines +22 to +26
res = requests.patch(
"https://api.github.com/repos/PxA-Labs/AutoMaintainer/issues/comments/4633057460",
json={"body": body_13},
headers=headers,
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== locate files =="
git ls-files | rg '(^|/)patch_comments\.py$|(^|/)test_groq\.py$|(^|/)requirements\.(txt|in)$|(^|/)pyproject\.toml$|(^|/)poetry\.lock$' || true

echo "== patch_comments.py context =="
if [ -f patch_comments.py ]; then
  nl -ba patch_comments.py | sed -n '1,80p'
fi

echo "== test_groq.py context =="
if [ -f test_groq.py ]; then
  nl -ba test_groq.py | sed -n '1,80p'
fi

echo "== timeout usages in repo =="
rg -n "requests\.(patch|get|post|put|delete|request)\([^)]*timeout|timeout\s*=" -S . || true

echo "== dependency files relevant =="
for f in $(git ls-files | rg 'requirements\.(txt|in)$|pyproject\.toml$|poetry\.lock$' || true); do
  echo "-- $f --"
  sed -n '1,200p' "$f"
done

Repository: PxA-Labs/AutoMaintainer

Length of output: 308


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== patch_comments.py context =="
if [ -f patch_comments.py ]; then
  cat -n patch_comments.py | sed -n '1,120p'
fi

echo "== test_groq.py context =="
if [ -f test_groq.py ]; then
  cat -n test_groq.py | sed -n '1,80p'
fi

echo "== requests calls without explicit timeout in target files =="
python3 - <<'PY'
import ast
from pathlib import Path

for path in [Path("patch_comments.py"), Path("test_groq.py")]:
    if not path.exists():
        continue
    tree = ast.parse(path.read_text())
    for node in ast.walk(tree):
        if isinstance(node, ast.Call):
            if isinstance(node.func, ast.Attribute) and node.func.attr in {"get", "post", "patch", "put", "delete", "request"}:
                kwargs = [kw.arg for kw in node.keywords if kw.arg]
                calls = []
                while isinstance(node.func, ast.Attribute):
                    calls.append(node.func.attr)
                    node = node.func.value
                if "timeout" in kwargs or ("__version__" in calls and "requests" in calls):
                    continue
                # identify module import to print qualified name
                pkg = None
                for n in tree.body:
                    if isinstance(n, ast.ImportFrom) and getattr(n, "module") == "requests":
                        alias = next((a.name for a in n.names if a.asname == getattr(node.func.value, "id", None)), None)
                        if alias:
                            pkg = alias
                            break
                    elif isinstance(n, ast.Import) and any(a.name == "requests" for a in n.names):
                        pkg = next((a.asname for a in n.names if a.name == "requests"), "requests")
                        break
                print(path, node.lineno, node.col_offset, pkg or "???" + "." + node.func.attr if isinstance(node.func, ast.Attribute) else node.func.id, "has_kwargs=", kwargs)
                for kw in node.keywords:
                    print("   kw:", kw.arg, kw.value)
PY

echo "== timeout usages in repo =="
rg -n "requests\.(patch|get|post|put|delete|request)\([^)]*timeout|timeout\s*=" -S . || true

echo "== dependency files relevant =="
for f in $(git ls-files | rg 'requirements\.(txt|in)$|pyproject\.toml$|poetry\.lock$' || true); do
  echo "-- $f --"
  sed -n '1,200p' "$f"
done

Repository: PxA-Labs/AutoMaintainer

Length of output: 3110


🌐 Web query:

requests library default timeout None documentation

💡 Result:

In the Requests library, the default value for the timeout parameter is None [1][2]. When timeout is set to None (which is the default behavior if not explicitly provided), requests will not time out, meaning the client will wait indefinitely for a response [1][3][2]. The documentation strongly advises that nearly all production code should explicitly set a timeout value to prevent programs from hanging indefinitely if a server fails to respond in a timely manner [3][2][4]. If you want to explicitly disable timeouts, you can pass None as the value, though this is equivalent to the default behavior [1][2].

Citations:


Add finite timeouts to both external requests.

Both scripts call requests without an explicit timeout, so stalled network responses can block the scripts indefinitely.

  • patch_comments.py#L22-L26: Add a finite timeout to requests.patch.
  • test_groq.py#L15-L15: Add the same project-standard timeout to requests.get.
🧰 Tools
🪛 Ruff (0.16.1)

[error] 22-22: Probable use of requests call without timeout

(S113)

📍 Affects 2 files
  • patch_comments.py#L22-L26 (this comment)
  • test_groq.py#L15-L15
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@patch_comments.py` around lines 22 - 26, Add the project-standard finite
timeout to the requests.patch call in patch_comments.py and the requests.get
call in test_groq.py, ensuring both external requests cannot block indefinitely.

Source: Linters/SAST tools

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.

bugs: lost WebSocket logs, missing agent loop cancellation, and WebIDE port mismatch

1 participant