Skip to content

🚧 4JK4MP task: Allow replacement after a rejected external-agent result [202608241454-4JK4MP] - #4883

Closed
densmirnov wants to merge 1 commit into
mainfrom
task/202608241454-4JK4MP/allow-replacement-after-a-rejected-external-agen
Closed

densmirnov wants to merge 1 commit into
mainfrom
task/202608241454-4JK4MP/allow-replacement-after-a-rejected-external-agen

Conversation

@densmirnov

@densmirnov densmirnov commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Task: 202608241454-4JK4MP
Title: Allow replacement after a rejected external-agent result
Canonical task record: .agentplane/tasks/202608241454-4JK4MP/README.md

Summary

Allow replacement after a rejected external-agent result

Fix the external-agent supervisor so a schema-valid result that is durably recorded but later rejected by pre-apply implementation-authority validation does not permanently lock the exchange or replay the same failure. Preserve immutable accepted/consumed result semantics and effect-in-doubt safety. Add a regression for completed implementation with no workspace change followed by a corrected replacement exchange, plus conflicting replay coverage. This is a v0.7.8 release blocker discovered by task 202608241434-NCQYZ4; it must remain a separate code Task and merge before a fresh release attempt.

Scope

  • In scope: Fix the external-agent supervisor so a schema-valid result that is durably recorded but later rejected by pre-apply implementation-authority validation does not permanently lock the exchange or replay the same failure. Preserve immutable accepted/consumed result semantics and effect-in-doubt safety. Add a regression for completed implementation with no workspace change followed by a corrected replacement exchange, plus conflicting replay coverage. This is a v0.7.8 release blocker discovered by task 202608241434-NCQYZ4; it must remain a separate code Task and merge before a fresh release attempt.
  • Out of scope: unrelated refactors not required for "Allow replacement after a rejected external-agent result".

Verification

  • State: ok
  • Note: Verified: CLI-owned declared checks passed; independent EVALUATOR review is pending.
  • Canonical workflow state lives in the task README.
Raw evidence
  • Updated: 2026-08-24T16:58:00.402Z
  • Branch: task/202608241454-4JK4MP/allow-replacement-after-a-rejected-external-agen
  • Head: computed live by agentplane pr check / agentplane integrate
 ...n-cli.core.task-advance-effect-recovery.test.ts | 38 ++++++++--
 ...un-cli.core.task-advance.blocked-result.test.ts | 87 ++++++++++++++++++++++
 .../src/commands/task/external-agent-supervisor.ts | 71 ++++++++++++++++--
 3 files changed, 181 insertions(+), 15 deletions(-)

Signed-off-by: Denis Smirnov <densmirnov@me.com>

@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: b6727bb356

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +692 to +695
expect(replacement.action.kind).toBe("agent_episode");
expect(replacement.exchange?.result_path).not.toBe(rejectedResultPath);
expect(replacement.transition_id).not.toBe(issued.transition_id);
expect(replacement.exchange?.directory).not.toBe(issued.exchange.directory);

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 Exercise the corrected result after issuing the replacement

This regression stops after confirming that a replacement exchange was issued, despite its name and the task acceptance criteria claiming that a corrected replacement is accepted. It never creates an allowed workspace change, writes a completed result to replacement.exchange.result_path, or returns that result through task advance, so a failure in the replacement acceptance/consumption path could leave the feature broken while this test still passes.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Keep this PR for focused rework against current main (review baseline: ca07204, 0.7.9-beta.1).

The no-change implementation rejection still exists, while the proposed pre-apply rejection recovery is absent from the current supervisor.

Requested changes:

  1. Update the branch against main and adapt the fix to the current acceptedApplication and already-applied handling.
  2. Retire an exchange and permit replacement only when the supervisor can establish that the rejected result produced no apply effect. Preserve fail-closed behavior for partial application, stale results, and unrelated validation failures.
  3. Prefer an existing structured rejection classification over matching a human-readable error message. If none exists, introduce only the narrow classification needed for this case.
  4. Make the journal/exchange update recoverable across a crash or CAS failure. A retry must neither apply a result twice nor leave a rejected exchange permanently unusable.

Acceptance evidence:

  • Reject a completed no-change result, obtain a fresh replacement packet, and successfully return a corrected implementation.
  • Reject replay of the retired result.
  • Cover CAS contention and interruption between journal persistence and exchange retirement.
  • Demonstrate that partial-apply and other validation errors do not enter this recovery path.
  • Run the focused supervisor/replacement tests and all checks required for the updated head.

This is a rework request, not an approval or a claim that the updated implementation has been tested.

@deus-agentplane

Copy link
Copy Markdown
Collaborator

Superseded by #5951 (07b7e86c9c3855288c31bff11e7488f5887512f5) and the current converged supervisor. Current main retires an implementation result rejected during application only after confirming Git, workspace, and route fingerprints did not change, records a failed supervisor operation, and emits an exact task advance --replacement --agent-json successor route. Replacement authority tests pass in the current-main targeted recovery suite at cc0516672e107f63083aa97aa4d8a8509e19d169. Closing this stale branch without merging.

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.

2 participants