Skip to content

Fix FreeOS → openXYOS pack so assets show in the signed-in tenant - #47

Merged
XYAIStudio merged 1 commit into
mainfrom
cursor/org-ingest-ui-tenant-2b72
Sep 17, 2026
Merged

XYAIStudio merged 1 commit into
mainfrom
cursor/org-ingest-ui-tenant-2b72

Conversation

@XYAIStudio

Copy link
Copy Markdown
Owner

Summary

Pack/ingest was succeeding (remote_applied: true, landed counts in the mirror receipt) while the embedded openXYOS UI showed nothing. The smoking gun on the user PC: ingest wrote employees/talent/skills/plugins to tenant 1 (雄元科技 / admin@example.com, never logged in), but the embed login is demo@demo.com → tenant 2 (openXYOS 本地租户). List APIs filter by req.user.tenant_id, so the business-space pages stayed empty.

This change:

  • Resolves the active UI tenant (most recent last_login, else demo@demo.com, else the local/demo tenant slug) and writes ingest rows there. Requested tenant 1 is still mirrored for super_admin, but the signed-in tenant is primary.
  • Remaps FreeOS lifecycle leftovers (staff / probation / draft / recruited) to list-visible values (employees.employment_category=internal + status=active, talent.status=available).
  • Stops FreeOS apply from hardcoding tenant_id=1 when the FreeOS config tenant is not a digit; it now asks /api/freeos/health|session for ui_tenant_id.
  • Pack/loop receipts report concrete landed counts; when the embed is up, the preview navigates to /employees.
  • Includes the equivalent of PR Fix org self-growth loop 500 when employees are already active #46 (still open): the self-growth loop no longer 500s on already-active employees (cannot move active → market). Skip illegal/already-reached edges instead.

Target branch

  • Base is develop (feature / fix — default)
  • Base is main (requested for this fix)

Type of change

  • Bug fix

Test plan

  • uv run pytest tests/unit/test_openxyos_apply.py tests/unit/test_org_loop.py tests/unit/test_lifecycle.py tests/unit/test_org_notes.py tests/unit/test_asset_loop.py tests/unit/test_org_module.py tests/unit/i18n/test_catalog.py tests/e2e/test_org_growth_loop.py -q — 50 passed
  • cd modules/openxyos && npm run test:freeos-ingest — ingest with tenant_id=1 while demo@demo.com last_login is tenant 2; /api/employees?category=internal, /api/talent, /api/skills, /api/plugins return the rows
  • cd dashboard && npx vitest run src/pages/Organization/index.test.tsx — pack receipt + preview /employees
  • uv run mypy --strict on touched org_os / org_module modules — clean
  • cd dashboard && npx tsc --noEmit and cd modules/openxyos && npx tsc --noEmit — clean
  • make all locally (not run in this environment; CI should cover it)
  • Re-run「把 FreeOS 资产推到 openXYOS」on the user PC: Ops Coordinator / Policy Analyst should appear under the signed-in tenant's Employees (and Talent)

Checklist

  • Updated CHANGELOG.md
  • README / docs updated (docs/asset-loop.md)

Coordination

#46 is still open (active→market 500). This PR includes that fix so the Organization OS management path is complete. After merge, #46 can close as duplicate.

Open in Web Open in Cursor 

Ingest was writing to tenant 1 (or ORDER BY id LIMIT 1) while the embed
login demo@demo.com uses tenant 2, so pack succeeded but Employees/Talent
lists stayed empty. Target the active UI tenant, remap list-visible
statuses, show landed counts, refresh the employees preview, and skip
illegal active→market loop promotions.

Co-authored-by: XYAI Labs <haoboy8@gmail.com>
@XYAIStudio
XYAIStudio marked this pull request as ready for review September 17, 2026 12:48
@XYAIStudio
XYAIStudio merged commit 176c274 into main Sep 17, 2026
12 checks passed
@XYAIStudio
XYAIStudio deleted the cursor/org-ingest-ui-tenant-2b72 branch September 17, 2026 12:48
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.

2 participants