open-code-review icon indicating copy to clipboard operation
open-code-review copied to clipboard

web viewer: Status should be something like `running` instead of `aborted` while review is going on

Open iredmail opened this issue 3 months ago • 2 comments

OpenCodeReview Version

open-code-review v1.9.1 (200424c) darwin/arm64

Operating System

macOS (Apple Silicon)

Installation Method

npm (global)

LLM Provider

Other OpenAI-compatible endpoint

Bug Description

After running ocr scan or ocr review, web viewer shows the task status as aborted, it should be something like running which indicates it's running.

Steps to Reproduce

Run ocr scan or ocr review to start a review.

Expected Behavior

Status should be running instead of aborted.

Logs / Error Output


Additional Context

No response

iredmail avatar Aug 11 '26 15:08 iredmail

I investigated this and found that both viewer summaries currently initialize an unfinished session as Aborted: true, then clear that flag only when a session_end record is read. A review that is still running has not written session_end either, so an active run and a genuinely interrupted run are indistinguishable.

My proposed status model is:

  • session_end exists: use the manifest terminal state (complete, partial, failed, or skipped), or legacy when no supported manifest exists.
  • No session_end, and the owning OCR process still holds a per-session sidecar file lock: running.
  • No session_end, and that lock is no longer held: aborted.

The writer would acquire a lock such as <session-id>.lock for the lifetime of the session. The OS releases the lock on both normal exit and process termination, so a stale sidecar file after a crash would still be recognized as inactive. This avoids guessing from file modification times, which can incorrectly mark a live review as aborted during a long LLM request.

I would also flush session_start immediately so the viewer can read the session metadata as soon as the run appears, apply the same status semantics to both the Web Viewer and ocr session, and add tests for active, completed, interrupted, and older lock-less sessions.

Would this status model and sidecar-lock approach be reasonable for the project? If you prefer a PID or heartbeat-based mechanism, I can adjust the implementation accordingly.

YAO-001 avatar Aug 11 '26 15:08 YAO-001

I reviewed the current implementation and the earlier sidecar-lock proposal. The ambiguity is still present on current main: the viewer represents every session without session_end as Aborted, and the templates render that state directly. I found no open PR for the issue.

Before implementing, I would like maintainer guidance on the runtime-liveness contract: is a per-session OS file lock (acquired by the session writer, probed non-blockingly by the viewer) acceptable as the source of truth for running vs aborted? It avoids timeout-based false aborts during a long LLM request and does not require a persistent PID. If that direction is accepted, I can submit a focused PR with writer lifecycle coverage plus viewer/session-list tests.

AI disclosure: I used an AI/LLM assistant to inspect the code and draft this comment, and I reviewed the findings and wording myself.

huong8373tt-beep avatar Oct 31 '26 22:10 huong8373tt-beep