Skip to content

feat(agents): scaffold workspace on agent add and register#487

Closed
sytone wants to merge 1 commit into
mainfrom
feat/agent-workspace-scaffold
Closed

feat(agents): scaffold workspace on agent add and register#487
sytone wants to merge 1 commit into
mainfrom
feat/agent-workspace-scaffold

Conversation

@sytone
Copy link
Copy Markdown
Owner

@sytone sytone commented May 22, 2026

Closes #331

Changes

New: IAgentWorkspaceScaffolder + AgentWorkspaceScaffolder

  • Interface defined in BotNexus.Gateway.Contracts
  • Implementation wraps BotNexusHome.GetAgentDirectory which provisions workspace from embedded assembly templates on first access
  • Registered as singleton in DI

AgentsController.Register

  • Accepts optional IAgentWorkspaceScaffolder (backward compatible)
  • Calls ScaffoldAsync after config is saved — best-effort, non-fatal (logs warning on failure)

AgentCommands (CLI)

  • ExecuteAddAsync and ExecuteWizardAsync now call BotNexusHome.GetAgentDirectory directly (same scaffold trigger) after config save
  • Non-fatal: scaffold failure logs a warning but does not fail the agent add command

Tests (13 new)

  • AgentWorkspaceScaffolderTests: workspace dir created, scaffold files present, idempotent, returns correct path, sad paths
  • AgentCommandsScaffoldTests: agent add creates workspace dir, creates scaffold files, resilient to scaffold failure

All 1649 gateway + 86 CLI + 206 CodingAgent tests pass.

- Add IAgentWorkspaceScaffolder + AgentWorkspaceScaffolder wrapping BotNexusHome.GetAgentDirectory
- Register as singleton in DI
- Call from AgentsController.Register (best-effort, non-fatal)
- Call from AgentCommands.ExecuteAddAsync and ExecuteWizardAsync (CLI)
- 13 new tests covering workspace creation, scaffold files, idempotency, sad paths

Closes #331
}
catch (Exception ex)
{
_logger.LogWarning(ex, "Workspace scaffold failed for agent {AgentId} — agent was registered successfully.", descriptor.AgentId.Value);
@sytone
Copy link
Copy Markdown
Owner Author

sytone commented May 22, 2026

Farnsworth Review -- PR #487

CI: All checks passing
Merge conflicts: CLEAN/MERGEABLE
Conventional commit title: feat(agents): scaffold workspace on agent add and register -- correct

Test coverage: 13 tests covering workspace creation, scaffold files, idempotency, sad paths, CLI resilience to scaffold failure. All 1649 gateway + 86 CLI pass.

Design notes:
IAgentWorkspaceScaffolder delegates to BotNexusHome.GetAgentDirectory which already handles embedded template scaffold on first access -- clean composition, avoids duplication.
Non-fatal best-effort pattern in both controller and CLI is the right call for optional scaffolding.
Optional DI param on AgentsController.Register maintains backward compatibility.

LGTM. Ready to merge.

@sytone
Copy link
Copy Markdown
Owner Author

sytone commented May 22, 2026

CI: All checks passing
Merge conflicts: Clean / MERGEABLE
Commit title: Conventional commit format correct
Coverage: 13 tests for IAgentWorkspaceScaffolder, AgentWorkspaceScaffolder, controller/CLI integration
Spec completeness: Closes #331 - IAgentWorkspaceScaffolder + AgentWorkspaceScaffolder wrapping BotNexusHome.GetAgentDirectory; called from AgentsController.Register and CLI wizard/add (best-effort)

LGTM - ready to merge.

Copy link
Copy Markdown
Owner Author

@sytone sytone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Farnsworth Review — PR #487

CI: ✅ All checks passing
Merge conflicts: ✅ Clean (MERGEABLE)
Conventional commit title:feat(agents): scaffold workspace on agent add and register

Test coverage:

  • ✅ 13 tests (scaffolder called on register, best-effort non-fatal, CLI add wizard)
  • 1649/1649 pass

Spec completeness vs #331: Delegates to BotNexusHome.GetAgentDirectory existing mechanism — correct approach, avoids duplicating templates. Both AgentsController.Register and CLI wizard paths covered.

LGTM. Ready to merge.

@sytone
Copy link
Copy Markdown
Owner Author

sytone commented May 22, 2026

Closing as part of a planned hard-reset of the in-flight branch set so the new domain-model refactor can land on a clean trunk.

Audit verdict: keep

Rationale: Workspace lifecycle; orthogonal.

The new plan (in session state) reshapes core types: Citizen (User+Agent union), Vogen-generated value objects, ThreadId removed in favour of composite ChannelAddress, mark-not-delete compaction, centralised SessionContextProjector, single-path routing. Many in-flight branches touch contracts that are about to change — rebasing later would be more work than rebuilding on the new shape.

If this work is still wanted, refile as a new issue/PR against the post-refactor contracts.

@sytone sytone closed this May 22, 2026
@sytone sytone deleted the feat/agent-workspace-scaffold branch May 22, 2026 18:47
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.

[Agents] Agent creation should scaffold workspace consistently across all creation paths

2 participants