Skip to content

Commit 2c72d71

Browse files
fix: defer tantivy/textual imports to avoid SIGSEGV on Linux CI
Tantivy (Rust) was crashing with SIGSEGV when loaded at CLI startup on ubuntu-latest. Defer imports to explore command only so backup/sync work without loading native search deps. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 0868b6d commit 2c72d71

3 files changed

Lines changed: 17 additions & 5 deletions

File tree

.github/workflows/release.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,14 @@ jobs:
3737
run: uv sync
3838

3939
- name: Run tests
40-
run: uv run pytest -v --tb=short
40+
run: uv run pytest -v --tb=short 2>&1 | tee test-output.txt; exit ${PIPESTATUS[0]}
41+
42+
- name: Upload test output on failure
43+
if: failure()
44+
uses: actions/upload-artifact@v4
45+
with:
46+
name: test-output
47+
path: test-output.txt
4148

4249
version:
4350
name: Bump version and create tag

src/convx_ai/cli.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313

1414
from convx_ai.adapters import default_input_path, get_adapter
1515
from convx_ai.engine import SyncResult, sync_sessions
16-
from convx_ai.search import ensure_index
17-
from convx_ai.tui import ExploreApp
1816
from convx_ai.utils import sanitize_segment
1917

2018
app = typer.Typer(help="Export AI conversations into a Git repo.", no_args_is_help=True)
@@ -233,6 +231,9 @@ def explore_command(
233231
),
234232
) -> None:
235233
"""Browse and search exported conversations in a TUI."""
234+
from convx_ai.search import ensure_index
235+
from convx_ai.tui import ExploreApp
236+
236237
repo = _require_git_repo(output_path)
237238
index_path = repo / ".convx" / "index.json"
238239
if not index_path.exists():

src/convx_ai/search.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
import shutil
55
from pathlib import Path
66

7-
from tantivy import Document, Index, SchemaBuilder
8-
97

108
def _schema():
9+
from tantivy import SchemaBuilder
10+
1111
return (
1212
SchemaBuilder()
1313
.add_text_field("session_key", stored=True)
@@ -34,6 +34,8 @@ def ensure_index(repo: Path) -> None:
3434
if search_dir.exists():
3535
shutil.rmtree(search_dir)
3636
search_dir.mkdir(parents=True)
37+
from tantivy import Document, Index
38+
3739
schema = _schema()
3840
index = Index(schema=schema, path=str(search_dir))
3941
writer = index.writer(heap_size=15_000_000, num_threads=1)
@@ -84,6 +86,8 @@ def list_sessions(repo: Path) -> list[dict]:
8486

8587

8688
def query_index(repo: Path, q: str, limit: int = 50) -> list[dict]:
89+
from tantivy import Index
90+
8791
search_dir = repo / ".convx" / "search-index"
8892
if not search_dir.exists():
8993
return []

0 commit comments

Comments
 (0)