Skip to content

[BUG] main branch has broken imports: missing bundle_to_agent_envelope and handle_apply_episode #896

Description

@SinghAtithi

The main branch at current HEAD is currently unrunnable due to broken imports between the legacy/ application layer and the potpie/context-engine workspace package. Two symbol renames/removals in context-engine were never propagated to the consumers in legacy/.

Environment

Steps to Reproduce

  1. Clone the repo: git clone https://github.com/potpie-ai/potpie.git
  2. cd potpie/legacy && cp .env.template .env
  3. Install deps (either via legacy/scripts/start.sh or manually):
    uv sync --project .
  4. Try to import the app:
    uv run --project . python -c "import app.main"

Expected Behavior

The import should succeed and the application should boot.

Actual Behavior

Import fails with two separate ImportErrors:

##%3 Error 1 — bundle_to_agent_envelope

ImportError: cannot import name 'bundle_to_agent_envelope' from 'domain.agent_context_port'
  (/potpie/potpie/context-engine/domain/agent_context_port.py)

Called from: legacy/app/modules/intelligence/tools/context_tools/agent_context_tools.py:14

Missing symbol location: potpie/potpie/context-engine/domain/agent_context_port.py does not define bundle_to_agent_envelope.

##%3 Error 2 — handle_apply_episode

ImportError: cannot import name 'handle_apply_episode' from 'application.use_cases.context_graph_jobs'
  (/potpie/potpie/context-engine/application/use_cases/context_graph_jobs.py)

Called from: legacy/app/modules/context_graph/tasks.py:9

Also expected: handle_backfill_pot, handle_ingest_pr

Missing symbol location: context_graph_jobs.py only defines handle_process_batch.

Suspected Cause

PR #889 ("Restore detached context-engine daemon lifecycle") or a related refactoring changed the internal API surface but the legacy/ module imports were not updated to match.

Workaround

Check out the latest stable tag instead of main:

git checkout v1.1.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions