Skip to content

Add safe run-scoped workspaces - #139

Open
xuxian73 wants to merge 4 commits into
fmagent-project:mainfrom
xuxian73:agent/safe-run-workspaces
Open

Add safe run-scoped workspaces#139
xuxian73 wants to merge 4 commits into
fmagent-project:mainfrom
xuxian73:agent/safe-run-workspaces

Conversation

@xuxian73

Copy link
Copy Markdown
Contributor

Summary

  • store every execution under a timestamped fm_agent/runs/<run-id>/ directory
  • track the active run in fm_agent/current_run.json
  • prompt before touching existing results with resume, archive-and-new, overwrite-current, and exit choices
  • migrate legacy flat fm_agent/ results into runs/legacy-* instead of deleting them
  • propagate the selected run path through full, incremental, entry-point, isolated-worktree, tracing, validation, and dashboard flows
  • update English and Chinese documentation for the new layout

Why

A normal invocation previously deleted the target repository's entire fm_agent/ directory without confirmation. This could destroy an interrupted run or collide with an unrelated directory. Run-scoped workspaces preserve prior results by default and limit destructive behavior to the explicitly selected run after an interactive overwrite choice.

Non-interactive invocations fail safely when results already exist unless --resume is explicitly supplied.

Validation

  • python -m unittest discover -v — 10 tests passed
  • python -m compileall -q main.py dashboard.py src tests
  • git diff --check
  • CLI smoke test against a minimal directory containing hello.py:
    • first invocation created fm_agent/runs/<timestamp>/
    • a second non-interactive invocation preserved the run and exited with guidance
    • --resume selected the same current run
  • generated setup prompt smoke test confirmed paths point to fm_agent/runs/<run-id>/...

xuxian73 added 3 commits July 20, 2026 17:48
…aces

# Conflicts:
#	main.py
#	src/domain_knowledge.py
#	src/incremental_reasoner.py
#	src/opencode_trace.py
#	src/pipeline_setup.py
#	src/verification.py
@xuxian73
xuxian73 marked this pull request as ready for review July 21, 2026 11:28

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c9ed2124a9

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread main.py

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e9f45ad5c1

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/domain_knowledge.py
Comment on lines +112 to +113
if prefix is None:
prefix = inferred_workdir_relpath(work_dir)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep domain knowledge readable in run workspaces

When --domain-knowledge is used with the new fm_agent/runs/<run-id> layout, this default now returns relpaths like fm_agent/runs/<run-id>/spec_prompts/...; however load_staged_domain_knowledge_text() still resolves those relpaths from os.path.dirname(work_dir), so it looks under .../fm_agent/runs/fm_agent/runs/<run-id>/... and silently drops the content. The verifier and incremental spec-update prompts both rely on that loader, so normal run-scoped executions omit the user-provided knowledge from reasoning even though the files were staged.

Useful? React with 👍 / 👎.

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.

1 participant