Skip to content

fix(solver): harden portfolio scouts, team handoffs, usage accounting, and plan help - #23

Merged
LikC1606 merged 1 commit into
mainfrom
fix/portfolio-container-bugs-20261125
Nov 25, 2026
Merged

LikC1606 merged 1 commit into
mainfrom
fix/portfolio-container-bugs-20261125

Conversation

@LikC1606

Copy link
Copy Markdown
Collaborator

Summary

Fixes container runtime and orchestration issues discovered during real-math Docker benchmarks (entropy-q4 2D AgentResearchTeam + 3D CooperativeResearch) after PR #18:

  • Portfolio scout isolation & cold-start race: Move scout worktrees out of /tmp into portfolio-worktrees/ with isolatedWorkspaceParent, allocate private per-scout runtime profiles (portfolio-profiles/) without mutating the shared solver profile or copying credential stores, serialize per-repository git worktree add/remove, and snapshot any non-isolated config.toml into profile/runtime/ so web_provider never mutates frozen profiles (math_harness_identity_changed).
  • Portfolio scout budget & wrap-up: Include the Phase 1 wall-clock budget and halfway atomic PORTFOLIO.json guidance in scout instructions, send a soft wrap-up session.notify before the deadline, accept valid reports saved before abort, and emit math_portfolio_scout_timed_out when missing/invalid at deadline.
  • Team Lead soft-slice & empty declaration handoff: Direct AgentResearchTeam Lead soft-slice notices to team coordination instead of .scratch/declaration-submission.json, consume empty Lead helper requests without trapping the Lead in a repair loop, and require non-empty compiled helpers in solo guidance.
  • Warm-thread usage replay: Suppress already-accounted cumulative thread/tokenUsage/updated replays before turnStarted() on thread/resume while retaining worker_usage_unscoped alerts for genuinely unaccounted tokens.
  • Cooperative Lead plan CLI help & Web telemetry: Materialize plan-validate / plan-apply CLI guidance in .scratch/theoremos-help.md, remind Cooperative Leads to omit progressReview on initial plans, and forward all new portfolio/soft-slice/compaction/team-fallback events in apps/web.

Verification

  • Native 4-bundle build (bun run build), bun run typecheck, bun run typecheck:web, and git diff --check passed.
  • Host Vitest (with THEOREMOS_TEST_REQUIRE_LEAN=1): 17 suites passed (386 passed | 4 skipped | 0 failed), plus post-rebase web/solver sanity check (8/8 suites, 123 passed).
  • Real Docker math container benchmarks (2d-team-portfolio-v3 & 3d-auto-coop-portfolio-v3): 6/6 scouts cold-started cleanly, 2/3 2D scouts delivered valid PORTFOLIO.json reports, 2D Team Lead spawned 2 teammates and compiled 3 foundation lemmas with 0 empty-declaration loops, 3D Cooperative Lead ran math plan-validate to self-correct a draft schema issue and published with 0 rejections, 0 worker_usage_unscoped, and 0 residual containers.

…, and plan help

- Isolate portfolio scout worktrees and private runtime profiles outside /tmp and the shared solver profile, serialize per-repository git worktree add/remove, and prevent web_provider config.toml writes from mutating frozen profiles.
- Give portfolio scouts their concrete Phase 1 budget and a soft wrap-up notice, accept valid PORTFOLIO.json reports saved before abort, and classify missing/invalid deadline reports as math_portfolio_scout_timed_out.
- Direct AgentResearchTeam Lead milestone notices to team coordination instead of declaration-submission.json, consume empty Lead helper nominations without a repair loop, and require non-empty compiled helpers in solo guidance.
- Suppress already-accounted cumulative token replays on warm thread/resume before turnStarted while keeping alerts for genuinely unscoped tokens.
- Materialize Lead plan-validate/plan-apply CLI guidance in .scratch/theoremos-help.md and remind Cooperative Leads to omit progressReview on initial plans.
- Forward portfolio, soft-slice, compaction-circuit-breaker, and team-transport-fallback progress events in apps/web.
@LikC1606
LikC1606 merged commit e006813 into main Nov 25, 2026
4 checks passed
@LikC1606
LikC1606 deleted the fix/portfolio-container-bugs-20261125 branch November 25, 2026 06:23
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