Skip to content

fix: make long-prompt temp files unique under concurrency#693

Merged
lsdefine merged 1 commit into
lsdefine:mainfrom
Solaris-star:fix/665-user-prompt-tempfile-race
Jul 20, 2026
Merged

fix: make long-prompt temp files unique under concurrency#693
lsdefine merged 1 commit into
lsdefine:mainfrom
Solaris-star:fix/665-user-prompt-tempfile-race

Conversation

@Solaris-star

Copy link
Copy Markdown
Contributor

Summary

Fixes #665

When a prompt exceeds 2000 chars, agentmain.py writes it to:

temp/user_prompt_{int(time.time())}.md

Second-granularity names collide under concurrent --func / run_subagents runs, so one task can read another task's prompt.

Change

temp/user_prompt_{os.getpid()}_{time.time_ns()}.md

This matches the issue's suggested fix and keeps the same write/read flow.

Testing

  • Inspected the single call site in agentmain.py
  • Naming now includes pid + nanosecond timestamp, so same-second concurrent processes cannot share a path

Use pid + time_ns in user_prompt temp filenames so concurrent agentmain
/--func / run_subagents processes do not overwrite each other within the
same second.

Fixes lsdefine#665

Signed-off-by: Solaris-star <solaris@users.noreply.github.com>
@lsdefine
lsdefine merged commit 51f7692 into lsdefine:main Jul 20, 2026
lsdefine pushed a commit that referenced this pull request Jul 23, 2026
Use pid+nanos for user_prompt temp filename to avoid same-second collisions under concurrent --func / run_subagents.

Fixes #665
ridesnails pushed a commit to ridesnails/GenericAgent that referenced this pull request Jul 23, 2026
… .gitignore)

- Resolve 30 conflicts: .gitignore = ours (local ignore rules); all other paths = theirs (upstream)
- Preserve local evolution commits; absorb official updates including lsdefine#693-era changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Race condition: user_prompt_{int(time.time())}.md temp file collides under concurrent --func / run_subagents

3 participants