Skip to content

fix: native compress telemetry crash (UnboundLocalError on out) - #67

Draft
cursor[bot] wants to merge 11 commits into
mainfrom
cursor/critical-bug-investigation-cc3d
Draft

fix: native compress telemetry crash (UnboundLocalError on out)#67
cursor[bot] wants to merge 11 commits into
mainfrom
cursor/critical-bug-investigation-cc3d

Conversation

@cursor

@cursor cursor Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Bug and impact

HiveStack.compress() crashes with UnboundLocalError: cannot access local variable 'out' when:

  • backend="native" (or HIVE_BACKEND=native)
  • A RustBrain is passed explicitly (so native compression stays enabled)
  • Telemetry is enabled

This breaks any native-backend deployment that records compression metrics — including eval harnesses and production observability paths.

Root cause

PR #62 added a native compression branch that builds a CompressedTurn in result, but the shared telemetry block still referenced out, which only exists on the Python path.

Fix

Record telemetry from result fields (role, label, original_tokens, compressed_tokens) so both paths share the same code.

Validation

  • Reproduced crash with mocked native_compress before fix
  • Added test_native_compress_with_telemetry_does_not_crash
  • pytest tests/test_backend.py tests/test_hlc_snapshot_gossip.py tests/test_stack.py — 21 passed, 1 skipped
Open in Web View Automation 

cursoragent and others added 11 commits August 25, 2026 17:30
Tier 1: Add uv.lock, pre-commit, Dependabot, ruff config, Python 3.13 CI,
and fix HLC preservation on snapshot restore and gossip replay.

Tier 2: Add server/mcp/agents/http optional extras, long-context compression
eval script, and CI smoke jobs for MCP and long-context workloads.

Tier 3: Wire HIVE_BACKEND in HiveStack, implement LinUCB policy updater,
and add httpx async LLM client support.

Tier 4: Refresh enterprise roadmap and improvement plan, add pip-audit/SBOM
CI jobs, bump Jetson Docker base image, and enable nightly GPU smoke CI.

Co-authored-by: Daniel <DJLougen@users.noreply.github.com>
Reflect PR #62 changes: new optional extras, HIVE_BACKEND, LinUCB,
MCP/server deployment, 200-test CI matrix, uv.lock/pre-commit, and
upcoming PFN busyBee training-mode integration.

Co-authored-by: Daniel <DJLougen@users.noreply.github.com>
- README outcome table: HLC fix, MCP, long-context eval, HIVE_BACKEND, LinUCB
- New docs/WHATS_NEW.md with tier summary and Twitter-ready copy
- CHANGELOG [Unreleased] docs entry; dedupe [full] install block in README

Co-authored-by: Daniel <DJLougen@users.noreply.github.com>
Co-authored-by: Daniel <DJLougen@users.noreply.github.com>
Co-authored-by: Daniel <DJLougen@users.noreply.github.com>
Co-authored-by: Daniel <DJLougen@users.noreply.github.com>
Co-authored-by: Daniel <DJLougen@users.noreply.github.com>
Co-authored-by: Daniel <DJLougen@users.noreply.github.com>
- Rewrite hive.mcp_server for MCP 2.x MCPServer API (hive-mcp console script)
- Add client config generator, installer, and project .cursor/mcp.json
- Document setup in docs/MCP_SETUP.md and harness wiring in docs/HARNESS_SETUP.md
- Add hive.harness.load_routing_policy() for SWE-bench eval (busyBee or rules)
- Add integration tests; 214 tests passing

Co-authored-by: Daniel <DJLougen@users.noreply.github.com>
- Add python -m hive.mcp (server default, install subcommand)
- Test MCP list_tools/call_tool over stdio subprocess
- Validate bundled Claude/Codex snippets against config generator
- Run MCP integration tests in CI; update docs to 218 tests

Co-authored-by: Daniel <DJLougen@users.noreply.github.com>
HiveStack.compress() native path builds CompressedTurn in result but
telemetry still referenced out from the Python branch, causing
UnboundLocalError when backend=native, an explicit rust_brain is
provided, and telemetry is enabled.

Add regression test that mocks native_compress and verifies telemetry
recording.

Co-authored-by: Daniel <DJLougen@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant