diff --git a/docs/CONFIG.md b/docs/CONFIG.md index f60ab1ca..adbe9340 100644 --- a/docs/CONFIG.md +++ b/docs/CONFIG.md @@ -275,7 +275,9 @@ resumes the same session (`claude -p --resume `) unless the context a fresh short prompt with the scrubbed tail (1,500 characters, credentials masked) of what the run said, asking it to inspect the checkout (`git branch --show-current`, `git status -sb`, `git log`). If the Coding run's commits never reached origin, the follow-up pushes that one branch (`git push -u origin `, never forced, never another -branch, nothing new committed) — the kept folder is deleted afterwards, and VNChess #124 lost two finished fix runs +branch; work the stopped run never committed goes in first as one `wip:` commit, gitignored secrets excluded, +so the next round continues from it — VNChess #144 lost a finished fix at the time limit) — the kept folder is +deleted afterwards, and VNChess #124 lost two finished fix runs because the follow-up was told not to push. If the follow-up gives no summary either (it timed out, or still no JSON) but the run was a revision whose pull-request branch head moved since it started, the pushed work carries on to the checks, review and acceptance with the summary *"The run pushed its work but sent no summary"* and the pull request's diff --git a/src/AgentOs.Modules.Pipeline/Agents/AcceptanceAgent.cs b/src/AgentOs.Modules.Pipeline/Agents/AcceptanceAgent.cs index c1f6d074..54d5aa30 100644 --- a/src/AgentOs.Modules.Pipeline/Agents/AcceptanceAgent.cs +++ b/src/AgentOs.Modules.Pipeline/Agents/AcceptanceAgent.cs @@ -213,8 +213,10 @@ 3. Build and run the unit tests the way the repository does (e.g. `dotnet build` integration test, a data check, a measurement. When a criterion needs the running app, start the repository's documented local stack in the background (e.g. `dotnet run --project infra/.AppHost`), wait until its web endpoint answers, run the relevant end-to-end specs (`npx playwright test `), - then stop the stack gracefully (Ctrl+C) so it removes its own containers. Never delete Docker volumes, - images or any data outside this directory. + then stop the stack gracefully (Ctrl+C) so it removes its own containers. Docker runs on this computer and + the app host starts its own containers: never run the `docker` CLI (it is refused here) and never conclude + from that refusal that the app can't start. Never delete Docker volumes, images or any data outside this + directory. 5. A criterion this computer cannot check — it needs Docker / `docker compose`, a shell script, a data set or secret that is not available, or an external service — may still be proven by the pull request's CI: run `gh pr checks {branch}`, open the workflow file (`.github/workflows/*.yml`) of a job that looks relevant and diff --git a/src/AgentOs.Modules.Pipeline/Prompts/IssueWorkPrompt.cs b/src/AgentOs.Modules.Pipeline/Prompts/IssueWorkPrompt.cs index 2aee1c4b..87c1431b 100644 --- a/src/AgentOs.Modules.Pipeline/Prompts/IssueWorkPrompt.cs +++ b/src/AgentOs.Modules.Pipeline/Prompts/IssueWorkPrompt.cs @@ -78,6 +78,11 @@ You are an AI software engineer with shell access to a developer machine where t - .NET: `dotnet test` - Node: `npm test` Only skip tests if there is no test infrastructure. + Docker runs on this computer: an app host (e.g. `dotnet run --project infra/.AppHost`) and test + containers start their own containers. Never run the `docker` CLI — it is refused here — and never conclude + from that refusal that the app or the tests can't run. + A run is stopped at its time limit and anything not pushed is lost: commit and push after each working step, + not only at the end. 7. Commit: git add -A @@ -134,6 +139,11 @@ You are an autonomous coding agent (for example claude-code) running directly on 6. Run the test suite if one exists (.NET: `dotnet test`; Node: `npm test`). Only skip tests if there is no test infrastructure. + Docker runs on this computer: an app host (e.g. `dotnet run --project infra/.AppHost`) and test + containers start their own containers. Never run the `docker` CLI — it is refused here — and never conclude + from that refusal that the app or the tests can't run. + A run is stopped at its time limit and anything not pushed is lost: commit and push after each working step, + not only at the end. 7. Commit: git add -A @@ -253,12 +263,17 @@ internal static string RecoveryAsk(IssueWorkRequest req, WorkRepo repo) return string.Format( CultureInfo.InvariantCulture, """ - Your previous run on {0}/{1} for ticket #{2} ended before you sent the JSON reply. Do NOT redo or change the - work, and do not commit anything new. Look at what you already did in the checkout you worked in (this + Your previous run on {0}/{1} for ticket #{2} ended before you sent the JSON reply. Do NOT redo, extend or + change the work. Look at what you already did in the checkout you worked in (this directory; if it holds no checkout, clone https://github.com/{0}/{1}.git . and run git fetch origin {3}): git branch --show-current git status -sb git log --oneline -10 + If git status shows changes you never committed (the run was stopped mid-work), commit ALL of them as one + commit, exactly as they are, so the next round continues from them instead of starting over: + git add -A + git commit -m "wip: unfinished work from the stopped run (#{2})" + (.env and other secrets stay out: they are gitignored — never force-add anything.) If your commits are on {3} but not on origin yet (the branch is missing on origin, or git status shows it ahead of origin), push that branch now — this machine's checkout is deleted when the run ends, so unpushed work is lost: diff --git a/tests/AgentOs.Tests/Sessions/ReplyRecoveryTests.cs b/tests/AgentOs.Tests/Sessions/ReplyRecoveryTests.cs index b9f7b2d8..fcecf77e 100644 --- a/tests/AgentOs.Tests/Sessions/ReplyRecoveryTests.cs +++ b/tests/AgentOs.Tests/Sessions/ReplyRecoveryTests.cs @@ -341,7 +341,10 @@ public async Task IssueWork_FollowUpPrompt_CarriesOnlyWhatItNeeds() // Unpushed work is pushed before the checkout is deleted — only the run's own branch, never forced. followUp.UserPrompt.ShouldContain("git push -u origin issue-102-ai-fix"); followUp.UserPrompt.ShouldContain("never with --force"); - followUp.UserPrompt.ShouldContain("do not commit anything new"); + // A run stopped mid-work commits what it left uncommitted (VNChess #144 lost a finished fix that way). + followUp.UserPrompt.ShouldContain("git commit -m \"wip: unfinished work from the stopped run (#102)\""); + followUp.UserPrompt.ShouldContain("never force-add"); + followUp.UserPrompt.ShouldContain("Do NOT redo, extend or"); followUp.UserPrompt.ShouldContain("the end, no JSON."); // the tail of what it said followUp.SystemPrompt.ShouldStartWith("You are the Coding Agent of AgentOS.NET"); followUp.SystemPrompt.ShouldContain(UntrustedText.SystemRule);