Skip to content

docs: add troubleshooting section to README#643

Closed
ankitasahu83964 wants to merge 1 commit into
sreerevanth:mainfrom
ankitasahu83964:docs/troubleshooting-clean
Closed

docs: add troubleshooting section to README#643
ankitasahu83964 wants to merge 1 commit into
sreerevanth:mainfrom
ankitasahu83964:docs/troubleshooting-clean

Conversation

@ankitasahu83964

@ankitasahu83964 ankitasahu83964 commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Description

Summary

Added a Troubleshooting section to the README to help users quickly resolve common installation and setup issues.

Changes Made

  • Added guidance for resolving ModuleNotFoundError.
  • Added steps to verify and start Docker.
  • Added instructions for diagnosing port conflicts.
  • Added guidance for checking the supported Python version.
  • Added setup instructions for configuring environment variables with .env.example.

Why

This improves the onboarding experience by providing clear solutions to common setup problems, helping new users and contributors get started more easily while reducing confusion during installation.

Fixes #635

Summary by CodeRabbit

  • Documentation
    • Added a troubleshooting section covering common setup and startup issues.
    • Included guidance for missing dependencies, Docker availability, occupied ports, Python version mismatches, and missing environment variables.
    • Added commands and remediation steps for diagnosing local development problems.

@vercel

vercel Bot commented Jul 21, 2026

Copy link
Copy Markdown

@ankitasahu83964 is attempting to deploy a commit to the sreerevanth's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The README adds a Troubleshooting section covering missing dependencies, Docker availability, occupied ports, Python version mismatches, and missing environment variables.

Changes

Troubleshooting documentation

Layer / File(s) Summary
README troubleshooting guidance
README.md
Documents diagnostic commands and remediation steps for dependency, Docker, port, Python version, and environment variable setup issues.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Possibly related PRs

Poem

A rabbit found a port awry,
Then checked Docker reaching high.
.env bloomed, dependencies grew,
Python matched its version too—
“Troubleshooting hops” made setup fly! 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding a troubleshooting section to the README.
Linked Issues check ✅ Passed The README adds troubleshooting guidance for all requested issues: ModuleNotFoundError, Docker, ports, Python version, and environment variables.
Out of Scope Changes check ✅ Passed The changes stay within the README troubleshooting documentation scope and do not introduce unrelated code or behavior changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 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.

@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

🧪 PR Test Results

Check Result
Tests (pytest tests/) ✅ success
Lint (ruff check .) ✅ success
Coverage (agentwatch) 74.01%

Python 3.12 · commit 8e73b2e

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🧹 Nitpick comments (2)
README.md (1)

301-309: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

State the supported Python version explicitly.

“Use the version recommended in this README” is not actionable during a version-mismatch failure. Repeat the exact supported version or range in this troubleshooting step, matching the repository’s declared runtime configuration.

🤖 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 `@README.md` around lines 301 - 309, Update the “Python version mismatch”
troubleshooting section in README.md to explicitly state the exact supported
Python version or range, matching the repository’s declared runtime
configuration, instead of referring readers to the README generally.
agentwatch/core/models.py (1)

242-263: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Redundant second query to compute count.

Since seq starts at 0 and is contiguous, the fetched latest record's seq + 1 already equals the total count — the separate func.count() query is an unnecessary extra round-trip on the hot path exercised before every audit append.

♻️ Suggested simplification
-        record = result.scalar_one_or_none()
-
-        if record is None:
-            return 0, GENESIS_HASH
-
-        count_result = await self._session.execute(
-            select(func.count()).select_from(AuditLogRecord)
-        )
-
-        return count_result.scalar_one(), record.record_hash
+        record = result.scalar_one_or_none()
+
+        if record is None:
+            return 0, GENESIS_HASH
+
+        return record.seq + 1, record.record_hash
🤖 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 `@agentwatch/core/models.py` around lines 242 - 263, Update read_head to derive
the total count from the fetched latest AuditLogRecord by returning record.seq +
1 with record.record_hash, and remove the separate func.count query and import
while preserving the empty-session and no-record genesis responses.
🤖 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 `@agentwatch/core/models.py`:
- Around line 242-263: Make sequence allocation in read_head and the subsequent
write atomic so concurrent append calls cannot reuse the same seq. Serialize
access by locking the latest AuditLogRecord row or using the project’s
database/advisory-lock mechanism before computing the count, and ensure the lock
remains held through insertion; alternatively replace app-computed seq with a
database-generated sequence and handle unique-violation retries. Preserve the
existing genesis return behavior for an empty log.
- Around line 295-307: Update the record construction in read_all() to pass an
independent copy of each ORM record’s details mapping, matching
AuditRecord.copy() and InMemoryAuditStore.records(). Leave the other AuditRecord
fields and ordering unchanged.
- Around line 265-281: Update AuditLogWriter.write so a missing self._session is
not silently ignored: raise an appropriate persistence/configuration error (or
use the project’s established failure-reporting mechanism) before returning,
ensuring PersistentAuditLog.append cannot report a successful record when the
audit write was not persisted. Keep the existing database record construction
and flush behavior unchanged when a session is available.

In `@README.md`:
- Around line 285-299: Update the “Port already in use” section to document both
default ports: API port 8000 and frontend port 3000. Extend the Linux/macOS and
Windows diagnostic commands or clearly identify which startup mode each port
applies to, while preserving the existing troubleshooting guidance.
- Around line 311-319: Add Windows-compatible environment file creation commands
to the “Missing environment variables” section alongside the existing Unix cp
command: include Copy-Item for PowerShell and copy for cmd, while preserving the
instruction to update required configuration values.

---

Nitpick comments:
In `@agentwatch/core/models.py`:
- Around line 242-263: Update read_head to derive the total count from the
fetched latest AuditLogRecord by returning record.seq + 1 with
record.record_hash, and remove the separate func.count query and import while
preserving the empty-session and no-record genesis responses.

In `@README.md`:
- Around line 301-309: Update the “Python version mismatch” troubleshooting
section in README.md to explicitly state the exact supported Python version or
range, matching the repository’s declared runtime configuration, instead of
referring readers to the README generally.
🪄 Autofix (Beta)

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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5eab75de-1db3-4d83-b5fc-e2a38fdf8230

📥 Commits

Reviewing files that changed from the base of the PR and between 42759cd and 82c1003.

📒 Files selected for processing (6)
  • README.md
  • agentwatch/api/server.py
  • agentwatch/cli/main.py
  • agentwatch/core/models.py
  • agentwatch/governance/gdpr.py
  • tests/cli_surface.txt

Comment thread agentwatch/core/models.py Outdated
Comment on lines +242 to +263
async def read_head(self) -> tuple[int, str]:
from sqlalchemy import select, func

if self._session is None:
return 0, GENESIS_HASH

result = await self._session.execute(
select(AuditLogRecord)
.order_by(AuditLogRecord.seq.desc())
.limit(1)
)

record = result.scalar_one_or_none()

if record is None:
return 0, GENESIS_HASH

count_result = await self._session.execute(
select(func.count()).select_from(AuditLogRecord)
)

return count_result.scalar_one(), record.record_hash

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🔴 Critical | 🏗️ Heavy lift

TOCTOU race on seq assignment via non-atomic COUNT + later INSERT.

read_head() computes the next seq (returned as count_result.scalar_one()) from a snapshot COUNT(*)/latest-row query, and write() inserts a new row using that pre-computed seq later, with no locking or transaction isolation shown. Per the downstream contract, append() in agentwatch/governance/audit_log.py uses this seq value directly as the new record's primary key. If two concurrent sessions call append() around the same time, both can read the same count and attempt to insert the same seq/record_hash, causing an IntegrityError (or, absent constraints catching it, a broken hash chain). This directly undermines the tamper-evident audit guarantee this class exists to provide.

🔒 Suggested direction

Options: use SELECT ... FOR UPDATE on the latest row (or an advisory lock) before computing the next seq, or rely on a DB-generated sequence/identity column instead of app-computed seq, retrying on unique-violation.

🤖 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 `@agentwatch/core/models.py` around lines 242 - 263, Make sequence allocation
in read_head and the subsequent write atomic so concurrent append calls cannot
reuse the same seq. Serialize access by locking the latest AuditLogRecord row or
using the project’s database/advisory-lock mechanism before computing the count,
and ensure the lock remains held through insertion; alternatively replace
app-computed seq with a database-generated sequence and handle unique-violation
retries. Preserve the existing genesis return behavior for an empty log.

Comment thread agentwatch/core/models.py Outdated
Comment on lines +265 to +281
async def write(self, record: AuditRecord) -> None:
if self._session is None:
return

db_record = AuditLogRecord(
seq=record.seq,
timestamp=record.timestamp,
actor=record.actor,
action=record.action,
target=record.target,
details=record.details,
prev_hash=record.prev_hash,
record_hash=record.record_hash,
)

self._session.add(db_record)
await self._session.flush()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Silent no-op when session is None masks lost audit writes.

When self._session is None, write() returns without persisting or raising/logging anything, yet PersistentAuditLog.append() still returns a "successful" record.copy() to the caller. This means audit/compliance entries can be silently dropped with no signal to the caller or operator — a serious gap for a tamper-evident, compliance-facing audit trail.

🛡️ Suggested fix
     async def write(self, record: AuditRecord) -> None:
         if self._session is None:
-            return
+            raise RuntimeError("SqlAlchemyAuditStore has no session; audit record was not persisted")
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
async def write(self, record: AuditRecord) -> None:
if self._session is None:
return
db_record = AuditLogRecord(
seq=record.seq,
timestamp=record.timestamp,
actor=record.actor,
action=record.action,
target=record.target,
details=record.details,
prev_hash=record.prev_hash,
record_hash=record.record_hash,
)
self._session.add(db_record)
await self._session.flush()
async def write(self, record: AuditRecord) -> None:
if self._session is None:
raise RuntimeError("SqlAlchemyAuditStore has no session; audit record was not persisted")
db_record = AuditLogRecord(
seq=record.seq,
timestamp=record.timestamp,
actor=record.actor,
action=record.action,
target=record.target,
details=record.details,
prev_hash=record.prev_hash,
record_hash=record.record_hash,
)
self._session.add(db_record)
await self._session.flush()
🤖 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 `@agentwatch/core/models.py` around lines 265 - 281, Update
AuditLogWriter.write so a missing self._session is not silently ignored: raise
an appropriate persistence/configuration error (or use the project’s established
failure-reporting mechanism) before returning, ensuring
PersistentAuditLog.append cannot report a successful record when the audit write
was not persisted. Keep the existing database record construction and flush
behavior unchanged when a session is available.

Comment thread agentwatch/core/models.py Outdated
Comment thread README.md Outdated
Comment thread README.md
Comment on lines +311 to +319
### Missing environment variables

Create your environment file:

```bash
cp .env.example .env
```

Then update the required configuration values before running the application.

Copy link
Copy Markdown
Contributor

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

Add a Windows command for creating .env.

cp is unavailable in standard Windows PowerShell/cmd, so this remediation can fail for Windows users. Add Copy-Item .env.example .env for PowerShell or copy .env.example .env for cmd.

🤖 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 `@README.md` around lines 311 - 319, Add Windows-compatible environment file
creation commands to the “Missing environment variables” section alongside the
existing Unix cp command: include Copy-Item for PowerShell and copy for cmd,
while preserving the instruction to update required configuration values.

@sreerevanth

Copy link
Copy Markdown
Owner

sorry @ankitasahu83964 this was closed by mistake please do check and finish it sorry from my side

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tests/cli_surface.txt (1)

20-37: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Regenerate the compliance CLI fixture from the current command definitions.

The changed block still records export-csv --api-key as type=str, while agentwatch/cli/main.py uses the shared API_KEY_OPTION, which renders as type=text. Also, compliance_export_local does not declare an api_key parameter, so it must not document that option unless the command implementation is updated first. Remove the duplicate compliance block and keep one snapshot matching the generated CLI surface.

🤖 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 `@tests/cli_surface.txt` around lines 20 - 37, Regenerate the compliance CLI
snapshot from the current definitions in the compliance command implementations
and shared API_KEY_OPTION. Ensure export-csv documents --api-key as type=text,
while export-local omits --api-key because compliance_export_local does not
declare it. Remove the duplicate compliance block and retain one generated
snapshot matching the current CLI surface.
🤖 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.

Outside diff comments:
In `@tests/cli_surface.txt`:
- Around line 20-37: Regenerate the compliance CLI snapshot from the current
definitions in the compliance command implementations and shared API_KEY_OPTION.
Ensure export-csv documents --api-key as type=text, while export-local omits
--api-key because compliance_export_local does not declare it. Remove the
duplicate compliance block and retain one generated snapshot matching the
current CLI surface.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d264af41-a02a-4773-8069-cf5f1cc00936

📥 Commits

Reviewing files that changed from the base of the PR and between 82c1003 and 448c96e.

📒 Files selected for processing (4)
  • agentwatch/cli/main.py
  • agentwatch/core/models.py
  • agentwatch/governance/gdpr.py
  • tests/cli_surface.txt
🚧 Files skipped from review as they are similar to previous changes (3)
  • agentwatch/governance/gdpr.py
  • agentwatch/cli/main.py
  • agentwatch/core/models.py

@SHAURYASANYAL3 SHAURYASANYAL3 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Hi! We'd love to get this merged, but it's currently blocked. Please address the following so we can proceed:

  • CI Failures: The following checks are failing: fail, fail, fail, fail. Please check the GitHub Actions tab for detailed logs and apply the necessary fixes.

Let us know once you've updated the PR!

@SHAURYASANYAL3

Copy link
Copy Markdown
Collaborator

Hi! We'd love to get this merged, but it's currently blocked. Please address the following so we can proceed:

  • CI Failures: The following checks are failing: fail, fail, fail, fail. Please check the GitHub Actions tab for detailed logs and apply the necessary fixes.

Let us know once you've updated the PR!

@SHAURYASANYAL3

Copy link
Copy Markdown
Collaborator

Action Required (Update)

🔹 Review Feedback: Please address previous review comments.

🔹 CI Failures (fail, fail, fail, fail)

Failure Log Snippet

ext Test & lint Fail if tests failed 2026-07-23T07:14:22.4554854Z ##[group]Run echo "::error::pytest reported failures — see the test step log above." Test & lint Fail if tests failed 2026-07-23T07:14:22.4555358Z ^[[36;1mecho "::error::pytest reported failures — see the test step log above."^[[0m Test & lint Fail if tests failed 2026-07-23T07:14:22.4555666Z ^[[36;1mexit 1^[[0m Test & lint Fail if tests failed 2026-07-23T07:14:22.4595335Z shell: /usr/bin/bash -e {0} Test & lint Fail if tests failed 2026-07-23T07:14:22.4595543Z env: Test & lint Fail if tests failed 2026-07-23T07:14:22.4595766Z pythonLocation: /opt/hostedtoolcache/Python/3.12.13/x64 Test & lint Fail if tests failed 2026-07-23T07:14:22.4596117Z PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.12.13/x64/lib/pkgconfig Test & lint Fail if tests failed 2026-07-23T07:14:22.4596469Z Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.13/x64 Test & lint Fail if tests failed 2026-07-23T07:14:22.4596761Z Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.13/x64 Test & lint Fail if tests failed 2026-07-23T07:14:22.4597051Z Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.13/x64 Test & lint Fail if tests failed 2026-07-23T07:14:22.4597350Z LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.12.13/x64/lib Test & lint Fail if tests failed 2026-07-23T07:14:22.4597606Z ##[endgroup] Test & lint Fail if tests failed 2026-07-23T07:14:22.4662609Z ##[error]pytest reported failures — see the test step log above. Test & lint Fail if tests failed 2026-07-23T07:14:22.4664341Z ##[error]Process completed with exit code 1.

@ankitasahu83964

Copy link
Copy Markdown
Contributor Author
Screenshot 2026-07-23 143837 Hi @SHAURYASANYAL3,

I opened a new clean PR for the same documentation issue (#650).

All project CI checks have passed successfully. I also isolated the changes so this PR only contains the README documentation update.

The only remaining check is the Vercel authorization, which appears to require repository/team authorization.

Could you please review this PR when you have time? Thank you!

@ankitasahu83964
ankitasahu83964 force-pushed the docs/troubleshooting-clean branch from 448c96e to 8e73b2e Compare July 23, 2026 10:31

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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 `@README.md`:
- Around line 287-319: Fix the Markdown fence structure in the troubleshooting
section: remove the outer ```md wrapper, close the shell code block after the
lsof commands, and close the .env code block after the copy command. Keep the
“Python version mismatch” and “Missing environment variables” headings rendered
as Markdown.
🪄 Autofix (Beta)

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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2cba7f9a-2e4f-467f-970d-06d4085a8cda

📥 Commits

Reviewing files that changed from the base of the PR and between 448c96e and 8e73b2e.

📒 Files selected for processing (1)
  • README.md

Comment thread README.md
@vercel

vercel Bot commented Jul 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agent-watch Ready Ready Preview, Comment Jul 24, 2026 8:55am

@SHAURYASANYAL3

Copy link
Copy Markdown
Collaborator

Closing this as a duplicate of #650. Please avoid opening multiple PRs for the exact same changes in the future, as it clutters the board and wastes maintainer time. We will review #650.

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.

[DOCS] Add Troubleshooting section for common installation errors

3 participants