Merge pull request #3055 from chengzhichao-xydt/codex/context-getwd-error
fix(agent): handle os.Getwd error in NewContextBuilder
This commit is contained in:
commit
5b9f9c85a9
1 changed files with 7 additions and 1 deletions
|
|
@ -102,7 +102,13 @@ func NewContextBuilder(workspace string) *ContextBuilder {
|
||||||
// Use the skills/ directory under the current working directory
|
// Use the skills/ directory under the current working directory
|
||||||
builtinSkillsDir := strings.TrimSpace(os.Getenv(config.EnvBuiltinSkills))
|
builtinSkillsDir := strings.TrimSpace(os.Getenv(config.EnvBuiltinSkills))
|
||||||
if builtinSkillsDir == "" {
|
if builtinSkillsDir == "" {
|
||||||
wd, _ := os.Getwd()
|
wd, err := os.Getwd()
|
||||||
|
if err != nil {
|
||||||
|
// os.Getwd failure is extremely rare; fall back to empty
|
||||||
|
// string so that filepath.Join produces a relative "skills"
|
||||||
|
// path, preserving the original lookup behavior.
|
||||||
|
wd = ""
|
||||||
|
}
|
||||||
builtinSkillsDir = filepath.Join(wd, "skills")
|
builtinSkillsDir = filepath.Join(wd, "skills")
|
||||||
}
|
}
|
||||||
globalSkillsDir := filepath.Join(getGlobalConfigDir(), "skills")
|
globalSkillsDir := filepath.Join(getGlobalConfigDir(), "skills")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue