-// writeAgentConfig writes config as the config.json of the agent in dir.
-func writeAgentConfig(t *testing.T, dir string, config AgentConfig) {
+func TestAgentPromptUsesAnAbsoluteInstructionsPath(t *testing.T) {
+ dir := t.TempDir()
+ workdir, err := os.Getwd()
+ require.NoError(t, err)
+
+ relative, err := filepath.Rel(workdir, dir)
+ require.NoError(t, err)
+ require.False(t, filepath.IsAbs(relative))
+
+ agent, err := openAgent(relative)
+ require.NoError(t, err)
+
+ text, err := agent.Prompt()
+ require.NoError(t, err)
+ require.Contains(t, text, "The user's instructions live in the file "+filepath.Join(dir, agentInstructionsFileName)+",")
+}
+
+// agentWriteTestConfig writes config as the config.json of the agent in dir.
+func agentWriteTestConfig(t *testing.T, dir string, config AgentConfig) {