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 ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗