Skip to content

Accurate pipeline: every ingest_data task crashes - ObservationsAgent.observe() called without required 'context' argument #78

Description

@Starosdev

Summary

With PIPELINE_MODE=accurate, every ingest_data Celery task raises before observations are saved and the task is marked FAILURE. The ingestion task calls observe() with only text and observate_for, but the method signature requires a third positional argument context.

Environment

  • Image: ghcr.io/lumen-labs/brainapi:v2.14.2-dev
  • Also present on main (af5c778)
  • Backends: GRAPH_DB=networkx, DATA_DB=postgresql, VECTOR_DB=postgresql (backend-independent - the crash is in the task body before any graph work)
  • MODELS_MODE=remote (OpenAI), AGENTIC_ARCHITECTURE=custom

Reproduction

  1. Deploy with PIPELINE_MODE=accurate.
  2. POST /ingest/ with any text payload:
    {"data": {"data_type": "text", "text_data": "Some document text."}}
  3. Watch the worker log.

Actual result

[ERROR/MainProcess] Task src.workers.tasks.ingestion.ingest_data[...] raised unexpected:
TypeError("ObservationsAgent.observe() missing 1 required positional argument: 'context'")
Traceback (most recent call last):
  File "/app/src/workers/tasks/ingestion.py", line 346, in ingest_data
    observations = observations_agent.observe(
TypeError: ObservationsAgent.observe() missing 1 required positional argument: 'context'

Task meta ends FAILURE; text chunks and data vectors written before the call remain, so the brain is left partially ingested.

Cause

Call site passes two args:

observations = observations_agent.observe(
text=(
payload.data.text_data
if payload.data.data_type == IngestionTaskDataType.TEXT.value
else json.dumps(payload.data.json_data)
),
observate_for=payload.observate_for,
)

Signature requires three:

def observe(
self, text: str, observate_for: Optional[List[str]], context: Optional[str]
) -> list[str]:

def observe(
    self, text: str, observate_for: Optional[List[str]], context: Optional[str]
) -> list[str]:

Expected

Either the call site passes context (or context=None), or the signature defaults it: context: Optional[str] = None.

Workaround

PIPELINE_MODE=lightweight (skips the observations stage entirely).

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions