Skip to content

fix: home resolution follows mined data, not a bare directory - #34

Merged
ohad6k merged 1 commit into
mainfrom
fix/home-resolution-orphans-legacy-cache
Jul 27, 2026
Merged

fix: home resolution follows mined data, not a bare directory#34
ohad6k merged 1 commit into
mainfrom
fix/home-resolution-orphans-legacy-cache

Conversation

@ohad6k

@ohad6k ohad6k commented Jul 27, 2026

Copy link
Copy Markdown
Owner

The bug

resolve_emulo_home chose ~/.emulo whenever that directory merely existed:

if not os.path.isdir(new_home) and os.path.isdir(legacy_home):
    raw = legacy_home

Emulo Pro and the release tooling both create ~/.emulo for unrelated reasons
(pro/, autopilot/, release-keys/, release-builds/). The moment any of
them run, the legacy fallback stops firing and the miner loses sight of the
profile store and segment cache still living in ~/.ditto.

The intent in the original comment was right. The test was wrong: it asks whether
someone happened to mkdir the folder, not whether the folder holds any mined
data.

Impact, measured on a real upgraded machine

before after
cached segments 0 104
planned worker calls 112 9
profile files visible 0 59

272 cached reports were orphaned. Every re-mine paid full price, and it ran
against an empty profile store, so a user could re-mine repeatedly and never
build on prior work.

Anyone who used Ditto before the rename and has anything create ~/.emulo is
affected. That includes every Pro user.

The fix

Decide on the presence of mined data (profiles/, cache/reports,
cache/segments), not on directory existence. No data is moved; EMULO_HOME and
the legacy DITTO_HOME still win outright.

Tests

tests/test_home_resolution.py, 8 cases: fresh machine, upgraded user, the
regression itself, a cache-only home mid-migration, a genuinely migrated home,
both env-var overrides, and the home_holds_mined_data predicate.

Full suite: 415 passing.

🤖 Generated with Claude Code

resolve_emulo_home chose ~/.emulo whenever that directory merely existed.
Emulo Pro and the release tooling both create ~/.emulo for unrelated
reasons (pro/, autopilot/, release-keys/, release-builds/), so on any
machine that upgraded from Ditto the miner stopped seeing the profile
store and segment cache still living in ~/.ditto.

Measured on a real upgraded machine before the fix:

  cached segments   0        (272 reports orphaned in ~/.ditto)
  worker calls    112
  profiles          0        (59 files orphaned)

After:

  cached segments 104
  worker calls      9

A 12x cost reduction on every re-mine, and re-mining was previously
running against an empty profile store. The intent in the original
comment was right; the test was wrong. Decide on the presence of mined
data (profiles/, cache/reports, cache/segments), not on whether someone
happened to mkdir the folder.

tests/test_home_resolution.py covers all five paths: fresh machine,
upgraded user, the regression itself, a genuinely migrated home, and
both env-var overrides.

NOTE: test_release_runtime_hashes_match_canonical_repository_bytes now
fails, because .agents/skills/emulo/runtime.json pins emulo.py for the
v0.6.1 release and this changes those bytes. That pin controls what
installs on other people's machines, so it is deliberately NOT updated
here. Shipping this needs a version bump and a real release, not an
edited pin. The new digest, if that release is cut, is:

  emulo.py  e696bec245be88317a8136abb9bc03a7b36611bdbaaeffe0e226f3bec2c3dddb

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 27, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ditto Ready Ready Preview, Comment Jul 27, 2026 11:46am

@ohad6k
ohad6k merged commit 31e1999 into main Jul 27, 2026
4 of 6 checks passed
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