mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-10-30 09:42:21 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
98d76e3ea7 |
@@ -1,7 +1,7 @@
|
|||||||
# Optional dependencies — install only if you use the corresponding feature.
|
# Optional dependencies — install only if you use the corresponding feature.
|
||||||
# Local OCR for screenshots, scans, labels, and coordinate-grounded text extraction.
|
# Local OCR for screenshots, scans, labels, and coordinate-grounded text extraction.
|
||||||
rapidocr==3.9.2
|
rapidocr==3.10.0
|
||||||
onnxruntime>=1.20,<2
|
onnxruntime>=1.31.0,<2
|
||||||
# The app handles their absence gracefully (clear error message on first use).
|
# The app handles their absence gracefully (clear error message on first use).
|
||||||
#
|
#
|
||||||
# Note: chromadb-client + fastembed moved to requirements.txt — RAG, semantic
|
# Note: chromadb-client + fastembed moved to requirements.txt — RAG, semantic
|
||||||
@@ -46,7 +46,7 @@ PyMuPDF
|
|||||||
# magika (onnxruntime), already a core dep via fastembed. We avoid the
|
# magika (onnxruntime), already a core dep via fastembed. We avoid the
|
||||||
# [all]/Azure/audio extras (cloud + heavy). Pinned to a release >30 days old per
|
# [all]/Azure/audio extras (cloud + heavy). Pinned to a release >30 days old per
|
||||||
# the dependency-age discussion in issue #485.
|
# the dependency-age discussion in issue #485.
|
||||||
markitdown[docx,pptx,xlsx,xls]==0.1.6
|
markitdown[docx,pptx,xlsx,xls]==0.1.9
|
||||||
|
|
||||||
# Photoshop PSD opening / flattened previews / layer inspection.
|
# Photoshop PSD opening / flattened previews / layer inspection.
|
||||||
psd-tools
|
psd-tools
|
||||||
|
|||||||
+5
-5
@@ -5,9 +5,9 @@ python-dotenv
|
|||||||
httpx
|
httpx
|
||||||
# HTTPS clients using certifi must distrust the compromised eMudhra CA paths.
|
# HTTPS clients using certifi must distrust the compromised eMudhra CA paths.
|
||||||
certifi>=2026.10.23
|
certifi>=2026.10.23
|
||||||
httpcore>=1.0,<2.0
|
httpcore>=1.0.9,<2.0
|
||||||
pydantic>=2.13.4
|
pydantic>=2.14.1
|
||||||
pydantic-settings>=2.14.1
|
pydantic-settings>=2.16.1
|
||||||
SQLAlchemy
|
SQLAlchemy
|
||||||
pypdf
|
pypdf
|
||||||
pypdfium2
|
pypdfium2
|
||||||
@@ -25,7 +25,7 @@ numpy
|
|||||||
# ChromaDB service); fastembed runs local ONNX embeddings.
|
# ChromaDB service); fastembed runs local ONNX embeddings.
|
||||||
chromadb-client
|
chromadb-client
|
||||||
# gRPC vendors independent roots; 1.84.1 removes the incident trust anchors.
|
# gRPC vendors independent roots; 1.84.1 removes the incident trust anchors.
|
||||||
grpcio>=1.84.1
|
grpcio>=1.85.0
|
||||||
fastembed>=0.9.1
|
fastembed>=0.9.1
|
||||||
youtube-transcript-api
|
youtube-transcript-api
|
||||||
yt-dlp
|
yt-dlp
|
||||||
@@ -51,7 +51,7 @@ bcrypt
|
|||||||
# Built-in servers use the v1 low-level Server decorator API. MCP SDK v2 is a
|
# Built-in servers use the v1 low-level Server decorator API. MCP SDK v2 is a
|
||||||
# breaking rewrite, so keep fresh installs on the maintained v1 line until the
|
# breaking rewrite, so keep fresh installs on the maintained v1 line until the
|
||||||
# servers are migrated together.
|
# servers are migrated together.
|
||||||
mcp<2
|
mcp<3
|
||||||
pyotp
|
pyotp
|
||||||
qrcode[pil]
|
qrcode[pil]
|
||||||
croniter
|
croniter
|
||||||
|
|||||||
@@ -11,38 +11,6 @@ import time
|
|||||||
from urllib.request import urlopen
|
from urllib.request import urlopen
|
||||||
|
|
||||||
ROOT = Path(__file__).resolve().parents[1]
|
ROOT = Path(__file__).resolve().parents[1]
|
||||||
if str(ROOT) not in sys.path:
|
|
||||||
sys.path.insert(0, str(ROOT))
|
|
||||||
|
|
||||||
|
|
||||||
def _stop_owned_server(server, identity):
|
|
||||||
"""Close only identity-bound descendants, including MCP's new sessions.
|
|
||||||
|
|
||||||
Capture before signalling the parent: an orphaned stderr holder can no
|
|
||||||
longer be attributed by ancestry. Never search by executable name or kill
|
|
||||||
the caller's process group.
|
|
||||||
"""
|
|
||||||
from src import process_lifecycle as lifecycle
|
|
||||||
|
|
||||||
descendants = (lifecycle.bind_descendants([identity.pid])
|
|
||||||
if identity.verdict() == lifecycle.OWNED else [])
|
|
||||||
if os.name == "nt":
|
|
||||||
if identity.verdict() == lifecycle.OWNED:
|
|
||||||
lifecycle.taskkill_tree(identity.pid)
|
|
||||||
else:
|
|
||||||
outcome = lifecycle.terminate_identities(
|
|
||||||
[*(entry.identity for entry in reversed(descendants)), identity],
|
|
||||||
steps=lifecycle.term_kill_steps(10),
|
|
||||||
)
|
|
||||||
if outcome.survivors or outcome.unverified:
|
|
||||||
raise RuntimeError(f"Disposable Notes cleanup could not verify exit: {outcome}")
|
|
||||||
try:
|
|
||||||
logs, _ = server.communicate(timeout=2)
|
|
||||||
except subprocess.TimeoutExpired as error:
|
|
||||||
# Do not turn an unidentified pipe holder into an unbounded wait.
|
|
||||||
server.stdout.close()
|
|
||||||
raise RuntimeError("Disposable Notes output pipe remained open after owned cleanup") from error
|
|
||||||
return logs
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
@@ -68,10 +36,7 @@ def main():
|
|||||||
server = subprocess.Popen(
|
server = subprocess.Popen(
|
||||||
[sys.executable, "-m", "uvicorn", "app:app", "--host", "127.0.0.1", "--port", str(port)],
|
[sys.executable, "-m", "uvicorn", "app:app", "--host", "127.0.0.1", "--port", str(port)],
|
||||||
cwd=target, env=env, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True,
|
cwd=target, env=env, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True,
|
||||||
start_new_session=(os.name != "nt"),
|
|
||||||
)
|
)
|
||||||
from src.process_lifecycle import ProcessIdentity
|
|
||||||
server_identity = ProcessIdentity.capture(server.pid)
|
|
||||||
result = None
|
result = None
|
||||||
try:
|
try:
|
||||||
origin = f"http://127.0.0.1:{port}"
|
origin = f"http://127.0.0.1:{port}"
|
||||||
@@ -97,7 +62,12 @@ def main():
|
|||||||
print(result.stderr, file=sys.stderr)
|
print(result.stderr, file=sys.stderr)
|
||||||
return result.returncode
|
return result.returncode
|
||||||
finally:
|
finally:
|
||||||
logs = _stop_owned_server(server, server_identity)
|
server.terminate()
|
||||||
|
try:
|
||||||
|
logs, _ = server.communicate(timeout=10)
|
||||||
|
except subprocess.TimeoutExpired:
|
||||||
|
server.kill()
|
||||||
|
logs, _ = server.communicate()
|
||||||
if result is None or result.returncode:
|
if result is None or result.returncode:
|
||||||
print(logs[-8000:], file=sys.stderr)
|
print(logs[-8000:], file=sys.stderr)
|
||||||
|
|
||||||
|
|||||||
@@ -1,43 +0,0 @@
|
|||||||
"""A detached Notes descendant must not hold output open or kill a bystander."""
|
|
||||||
import os
|
|
||||||
import runpy
|
|
||||||
import subprocess
|
|
||||||
import sys
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
import pytest
|
|
||||||
from src import process_lifecycle as lifecycle
|
|
||||||
|
|
||||||
ROOT = Path(__file__).resolve().parents[1]
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif(os.name == "nt", reason="POSIX detached-session regression; Windows uses taskkill tree")
|
|
||||||
def test_notes_cleanup_reaps_detached_pipe_holder_and_preserves_bystander():
|
|
||||||
stop = runpy.run_path(str(ROOT / "scripts/verify_notes_browser_runtime.py"))["_stop_owned_server"]
|
|
||||||
child = "import time; time.sleep(60)"
|
|
||||||
program = ("import subprocess,sys,time; "
|
|
||||||
f"p=subprocess.Popen([sys.executable,'-c',{child!r}],start_new_session=True); "
|
|
||||||
"print(p.pid,flush=True); time.sleep(60)")
|
|
||||||
with subprocess.Popen([sys.executable, "-c", child]) as bystander:
|
|
||||||
server = subprocess.Popen([sys.executable, "-c", program], stdout=subprocess.PIPE,
|
|
||||||
stderr=subprocess.STDOUT, text=True, start_new_session=True)
|
|
||||||
root_identity = lifecycle.ProcessIdentity.capture(server.pid)
|
|
||||||
detached = None
|
|
||||||
try:
|
|
||||||
child_pid = int(server.stdout.readline())
|
|
||||||
detached = lifecycle.ProcessIdentity.capture(child_pid)
|
|
||||||
assert os.getpgid(child_pid) == child_pid
|
|
||||||
stop(server, root_identity)
|
|
||||||
assert server.poll() is not None
|
|
||||||
assert detached.exited()
|
|
||||||
assert bystander.poll() is None, "cleanup touched an unrelated process"
|
|
||||||
finally:
|
|
||||||
# Test-owned fallback cleanup also runs when the negative control
|
|
||||||
# intentionally substitutes the old parent-only teardown.
|
|
||||||
targets = [identity for identity in (detached, root_identity) if identity]
|
|
||||||
lifecycle.terminate_identities(targets, steps=lifecycle.term_kill_steps(1))
|
|
||||||
server.wait(timeout=3)
|
|
||||||
if server.stdout:
|
|
||||||
server.stdout.close()
|
|
||||||
bystander.terminate()
|
|
||||||
bystander.wait(timeout=3)
|
|
||||||
Reference in New Issue
Block a user