fix: cap ARTEX container and tool resource use

This commit is contained in:
ji ruo committed 2026-11-27 15:20:52 +08:00
1 parent 253a8eeac3
commit ea4377ef9a
36 files changed
+1869 -64

No files matched your search

+12
View File
@@ -7,6 +7,7 @@ import (
"log"
"runtime/debug"
"github.com/Autumn-27/artex/internal/toolguard"
actool "github.com/Autumn-27/norma/tool"
)
@@ -79,6 +80,17 @@ func AugmentTools(ctx context.Context, agentKey string, base []actool.CoreTool)
return out, def, cleanup
}
// Install the guarded handler before ToolResolve decorates it with DB defaults.
func guardedDefaultTools() []actool.CoreTool {
tools := actool.DefaultTools()
for i, t := range tools {
if t.Name() == "Bash" {
tools[i] = toolguard.NewBash()
}
}
return tools
}
// guardPanic turns a panicking tool handler into an ordinary tool error. The
// harness runs each tool on its own goroutine, so a panic inside a handler can't
// be recovered by the caller that started the run — it takes the whole process