Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/onenot8/issueLoop/llms.txt

Use this file to discover all available pages before exploring further.

The live monitoring API watches a process or log file in a background thread, matches output lines against a set of error patterns, debounces multi-line bursts into a single event, and flushes error blocks as entries to the same JSONL run log that create_tickets reads. This means errors detected during live monitoring flow into the ticket queue with no additional steps — just call create_tickets after the monitoring session or schedule it on a timer.

watch_process

Spawns command as a subprocess and reads its combined stdout/stderr in a background thread. Lines matching any error pattern start the debounce timer; quiet time longer than debounce_seconds flushes the accumulated buffer as a single log entry.
handle = issueloop.watch_process(
    "myrepo",
    "python3 main.py",
    cwd="/path/to/repo",
    debounce_seconds=3.0,
)
repo_name
str
required
Repository name to associate with detected errors.
command
str
required
Shell command string to spawn. Executed with shell=True.
cwd
str
Working directory for the subprocess. Defaults to the current directory if not provided.
error_patterns
list
List of compiled re.Pattern objects that identify error lines. Defaults to a built-in set covering Python tracebacks, exception, error, FAILED, fatal, panic:, and panicked at.
debounce_seconds
float
default:"3.0"
Seconds of silence required to flush the error buffer. A multi-line traceback is accumulated until no new matching lines arrive for this duration.
on_flush
callable
Optional callback invoked every time a buffer is flushed. Receives the JSONL entry dict as its only argument.
Returns an integer handle. Pass this value to stop_watch to stop the watcher.

watch_log_file

Tails an existing log file from its current end, waiting for new lines. Useful for processes that are already running and writing to a file that IssueLoop did not spawn.
handle = issueloop.watch_log_file(
    "myrepo",
    "/var/log/myapp/app.log",
    debounce_seconds=5.0,
)
repo_name
str
required
Repository name to associate with detected errors.
log_path
str
required
Absolute or relative path to the log file to tail. If the file does not yet exist, the watcher polls until it appears.
error_patterns
list
Same as watch_process. Defaults to the built-in error pattern set.
debounce_seconds
float
default:"3.0"
Seconds of silence required to flush the error buffer.
on_flush
callable
Optional callback invoked on each flush with the JSONL entry dict.
Returns an integer handle. Pass this value to stop_watch.

stop_watch

Stops a running watcher, flushes any remaining buffered lines as a final log entry, and (for watch_process) terminates the spawned subprocess.
issueloop.stop_watch(handle)
handle
int
required
The integer handle returned by watch_process or watch_log_file.
Returns True on success. Raises KeyError if the handle is not found in the active watcher registry.

list_active_watchers

Returns metadata for every watcher that is currently running in this Python process.
watchers = issueloop.list_active_watchers()
# [{"handle": 140234, "repo": "myrepo", "command": "python3 main.py"}]
Returns a list of dicts, each with:
handle
int
The integer handle identifying this watcher.
repo
str
Repository name the watcher is associated with.
command
str
The command string or log path label used to identify this watcher in the JSONL log.

Output format

When a watcher flushes, it writes the following entry to data/logs/run_<repo_name>.jsonl — the same file and format used by the batch test runner:
{
  "timestamp": "2024-01-15T10:30:00+00:00",
  "repo": "myrepo",
  "command": "python3 main.py",
  "test_id": "live_a3f9b2c1",
  "blocking": true,
  "exit_code": 1,
  "stdout_tail": "",
  "stderr_tail": "Traceback (most recent call last):\n  ..."
}
The test_id is a generated string prefixed with live_ followed by a random hex suffix. The exit_code is always 1 for live-detected errors. The accumulated error lines are stored in stderr_tail.
Watchers run in daemon threads tied to the lifetime of the current Python process. If the process exits, all active watchers are stopped immediately without flushing their buffers. Call stop_watch explicitly before exiting to ensure all buffered error lines are written to the log.

Build docs developers (and LLMs) love