When reading a file using sed or tail, it takes output from the terminal as content of the file

Resolved 💬 2 comments Opened May 20, 2025 by tristanbes Closed Aug 7, 2025

What version of Codex is running?

web codex version

Which model were you using?

web version

What platform is your computer?

web version

What steps can reproduce the bug?

any task that the agent will use sed or tail to read the content of the file:

What is the expected behavior?

_No response_

What do you see instead?

root@6cf3c7fdeac7:/workspace/myproject# sed -n '1,80p' src/schemas/deliveries.sch
ema.ts
import { z } from 'zod'

// Full schema for validating complete delivery objects from the database
export const deliveriesSchema = z.object({
  id: z.string(),
  boxId: z.string(),
  pickedUp: z.boolean(),
  createdAt: z.string(),
})

export type DeleteResponse = {
  success: boolean
} root@6cf3c7fdeac7:/workspace/myproject#

The agent says "There's an extra text "root@..." I will fix it

Then runs tail -n and have the same issue:

} root@6cf3c7fdeac7:/workspace/myproject# tail -n 10 src/schemas/deliveries.schem
a.ts
  delivery: Delivery | null
}

export type DeleteResponse = {
  success: boolean
} root@6cf3c7fdeac7:/workspace/myproject#

The answer "it seems the file still has unecessary text, i'll re-write everything (because of the root@....)

and the re-writes the whole file;

Thanks.

Additional information

_No response_

View original on GitHub ↗

2 Comments

juanfcastropiccolo · 1 year ago

Hey good morning, same issue here. Was working fine yesterday, asking for changes. Now o4-mini is using sed command without asking for change approval in the code.

`
command

$ grep -Rn 'const navigate' src/components/admin/ClientDetailPage.tsx

command.stdout (code: 0, duration: 0s)

src/components/admin/ClientDetailPage.tsx:33: const navigate = useNavigate();

command

$ sed -n 25\,45p src/components/admin/ClientDetailPage.tsx

command.stdout (code: 0, duration: 0s)

timestamp: string;
type: 'tool_call' | 'message' | 'review';
agentRole: string;
content: string;
... (18 more lines)
`

Did @tibo-openai break something? haha :p

codex-maintainers · 1 year ago

Thank you for the feedback! Please try again on the latest version of Codex CLI. If the issue persists, feel free to let us know.