Skip to content

fix(dashboard): Distribution saves one half alone, show cwd-less sessions, refresh stale pages - #11

Open
hsuchifeng wants to merge 1 commit into
mainfrom
claude/project-thread-8glb8x
Open

hsuchifeng wants to merge 1 commit into
mainfrom
claude/project-thread-8glb8x

Conversation

@hsuchifeng

Copy link
Copy Markdown
Owner

Summary

Fixes three Dashboard bugs. I found all three by running the real dashboard against a sandbox team repo and driving the page in Chromium.

  1. Distribution could not preview or save for many teams. The page sent primaryRole and projects on every preview and save. A team with no manifest/projects.yaml got a 409 (This team repo defines no projects). A team with no roles.yaml got the same error for roles. A workspace with no primary role got a 400 (Expected { primaryRole: string … }), even when only the projects changed. Because Save needs a preview first, these workspaces could change nothing. The page now sends only the halves the team defines and the draft changed. When only additional roles are picked, it asks for a primary role first.
  2. Copilot sessions outside every project were in no workspace. workspaceEvents sends a session that matches no project to unassigned. But dashboardWorkspaces listed the Unassigned bucket only when an unowned event had a cwd. Copilot events record no cwd, so such a session never appeared under any option in the picker. The bucket now uses the same per-session rule.
  3. Stale pages after a write. After a Distribution save, the Resources page kept showing the old skill and rule delivery until you switched workspace. After a skill exclusion, the Distribution counts stayed stale. Each write now reloads the other page.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)

Test Plan

  • npx tsc --noEmit passes
  • npm run lint passes
  • npx vitest run src/__tests__/dashboard* passes (298 tests)
  • npm run test:e2e -- dashboard-distribution-ui dashboard-distribution dashboard-unified passes (5 tests)
  • Added a test: dashboardWorkspaces lists the Unassigned bucket for a cwd-less Copilot session. It fails before the fix and passes after.

Real-CLI record (after npm run build). The sandbox team repo had skills/{frontend,backend}/*, root and namespaced rules, manifest/roles.yaml and manifest/projects.yaml. Setup ran teamai init https://github.com/your-org/your-repo.git --provider git --agent claude --role frontend, then teamai pull, then teamai dashboard --port 4791. I drove the page with headless Chromium:

  • Before the fix: POST /api/distribution/preview {"primaryRole":null,…,"projects":["pay"]} returned 400. With projects.yaml removed, a role-only preview returned 409.
  • After the fix, with no primary role: ticking only "Additional" and clicking Preview showed "Pick a primary role first.". Ticking project pay gave a preview of skills: +backend. Save showed "Saved". The config on disk then held projects: [pay]. The Resources page showed the new delivery right away (api-kit Delivered).
  • After the fix, with projects.yaml removed: picking the frontend primary role, previewing and saving all worked. The config on disk held primaryRole: frontend.
  • After the fix, with only a Copilot event (cwd: "") in events.jsonl: /api/workspaces now lists unassigned, and /api/sessions?workspace=unassigned returns the session.
  • Skill exclusion (POST /api/resources/skills/exclusions) writes excludedSkills to the workspace's own config, and the effective Distribution then drops the skill.

I covered only the Claude agent and the git provider. I did not run the other agents or providers locally and am leaving them to CI.

Notes for Reviewers

  • The Distribution fix is client-only (src/dashboard/client.ts). The server's validation is unchanged.
  • One known gap, left out to keep this PR small: the exclusion endpoint and the Distribution save use separate write queues. Two writes to the same workspace config that land at the same moment could still drop one of them.

Generated by Claude Code

…essions, refresh stale pages

- Distribution sent primaryRole and projects on every preview and save, so a
  team with no manifest/projects.yaml (or no roles.yaml) got a 409 and a
  workspace with no primary role got a 400, even for a change to the other
  half. The page now sends only the halves the team defines and the draft
  changed, and asks for a primary role when only additional roles are picked.
- The Unassigned bucket was listed only for an unowned event with a cwd, so a
  Copilot session (no cwd) outside every project was in no workspace. The
  bucket now uses the same per-session rule workspaceEvents routes by.
- A Distribution save left the Resources page's skills and rules stale until a
  workspace switch, and a skill exclusion left the Distribution counts stale.
  Each now reloads the other.
@hsuchifeng hsuchifeng self-assigned this Oct 20, 2026
@github-actions

Copy link
Copy Markdown

Code Erosion Report

Informational — never blocks the merge. scb-check==0.2.0 SlopCodeBench metrics; method & caveats in docs/dev/ci-code-erosion.md.

Metric Value Human band Agent band Reading
Verbosity* 0.064 0.15 0.33 human
Erosion 0.710 0.31 0.68 agent
Cognitive erosion 0.878 – – –

Scanned 386 files / 86114 SLOC · high-CC functions 662/7247

* On TypeScript, verbosity is partial and the bands are Python-calibrated.

Rule hits (TS verbosity layer)

Standalone ast-grep, separate from the number above.

Rule Hits
unnecessary-else-after-return 53
empty-catch-block 5

58 distinct lines flagged across src/.

Copy link
Copy Markdown
Owner Author

Codex PR Review failed in the openai/codex-action setup step, before any review ran: Failed to read server info from /home/runner/.codex/<run>.json. The Codex server never started on this fork, most likely because the fork has no Codex/OpenAI credentials configured. The failure is not caused by this PR's diff, and no code fix exists for it. I am not re-running it, because a re-run would fail the same way until the action is configured on the fork. Lint & Test is the check that covers this change.


Generated by Claude Code

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