Skip to content

fix: pass workspace from YAML import to agent definition#35

Open
dajiaohuang wants to merge 1 commit into
chaitin:mainfrom
dajiaohuang:fix/33-yaml-import-workspace
Open

fix: pass workspace from YAML import to agent definition#35
dajiaohuang wants to merge 1 commit into
chaitin:mainfrom
dajiaohuang:fix/33-yaml-import-workspace

Conversation

@dajiaohuang

@dajiaohuang dajiaohuang commented Jun 20, 2026

Copy link
Copy Markdown

Summary

When importing a project via YAML, the workspace was parsed and stored in the normalized spec but never bound to the agent. AgentDefinition.WorkspaceID was always empty, so agents started in an empty directory.

Agent-level workspace takes precedence; project-level workspace is used as fallback.

Testing

go build ./pkg/compose/ and go build ./pkg/agentcompose/ pass.

Checklist

  • Documentation updated when behavior or configuration changed.
  • Tests added or updated for user-visible behavior.
  • No secrets, private endpoints, internal certificates, or local runtime state included.

Fixes #33

When importing a project via YAML, the workspace was parsed and
stored in the normalized spec but never bound to the agent. The
AgentDefinition.WorkspaceID was always empty, so agents started
in an empty directory.

Resolve workspace from agent-level spec first, falling back to
project-level. Generate a deterministic workspace ID from the
spec fields so repeated imports do not create duplicates.

Fixes chaitin#33
@eetoc

eetoc commented Jun 21, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the fix. The direction makes sense to me: YAML-imported managed agents should not lose the workspace declared in the project spec, especially when the managed agent is started outside the project-run path.

One thing I am not fully sure about from this patch: projectManagedAgentDefinitionFromSpec now fills AgentDefinition.WorkspaceID with a deterministic ID, but I could not find where ApplyProject creates or upserts a matching WorkspaceConfig for that ID. Later, agent validation / CreateAgentSession resolves WorkspaceID through GetWorkspaceConfig, so if the config row does not exist the managed agent may show as unavailable with workspace config <id> not found.

Project runs already seem to materialize workspace from the project revision spec at run time, so this mainly matters for using the imported managed agent through the normal agent-definition/session path.

Could we confirm that the matching workspace config is persisted somewhere, or add that as part of this change? A regression test that applies a project with project-level + agent-level workspace and then verifies the managed agent workspace resolves successfully would make this much clearer.

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.

[Bug]: 通过 YAML 导入项目时,工作区没有真正绑定到智能体。

2 participants