Skip to content

fix: auto-derive unique slug from identity when WORLD_ID is not set#14

Merged
Jing-yilin merged 2 commits into
mainfrom
fix/auto-derive-worldid
Mar 24, 2026
Merged

fix: auto-derive unique slug from identity when WORLD_ID is not set#14
Jing-yilin merged 2 commits into
mainfrom
fix/auto-derive-worldid

Conversation

@Jing-yilin
Copy link
Copy Markdown
Contributor

Problem

All deployed instances without explicit WORLD_ID env var get the same slug star-office, causing 6 identical entries on the gateway and indistinguishable URLs.

Solution

When WORLD_ID is not set, derive a unique slug from the world's identity keypair:

  • Format: star-office-<6char-hash> (e.g. star-office-chs9cn)
  • Deterministic: same identity always produces the same slug
  • Uses world-identity.json publicKey hash, falls back to random suffix if identity not yet created
  • Explicit WORLD_ID still takes full priority when provided

Files Changed

  • src/config.ts: deriveSlug() function, integrated into resolveConfig()
  • test/integration.test.mjs: Updated slug assertions to use startsWith check

All 35 tests pass.

Jing-yilin and others added 2 commits March 25, 2026 00:57
When no WORLD_ID env var is provided, the slug was always 'star-office',
causing all deployed instances to appear identical on the gateway. Now
derives a unique slug from the world-identity.json keypair (format:
'star-office-<6char-hash>'), ensuring each instance has a distinct URL
suffix. Explicit WORLD_ID still takes priority when set.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
@Jing-yilin Jing-yilin merged commit 2d67aaf into main Mar 24, 2026
1 check 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