Skip to content

fix(admission): make NotApplicable a terminal no-op - #1843

Merged
ScriptedAlchemy merged 4 commits into
masterfrom
cursor/not-applicable-terminal-noop-9c8a
Sep 19, 2026
Merged

ScriptedAlchemy merged 4 commits into
masterfrom
cursor/not-applicable-terminal-noop-9c8a

Conversation

@ScriptedAlchemy

Copy link
Copy Markdown
Owner

Summary

  • Treat closed HostAdmissionStatus::NotApplicable as a terminal no-op in the shared replay-pass decision, so an unchanged spool stops until the next kick instead of backing off.
  • Publish that status from the MCP hook-runtime error boundary as a successful JSON-RPC no-op (isError: false, retryable: false) rather than an internal error.

Motivation

NotApplicable already closes the replay record, but classify_replay_pass still counted it as replay progress and backed off while records remained. The MCP wire then published the same status through tool_error_response as a JSON-RPC failure, so hosts retried a demand that does not apply.

Changes

  • crates/tracedecay-host-admission/src/replay.rs: ReplayPassDecision::TerminalNoop for NotApplicable when the spool does not shrink. A real shrink still continues; a drain still requeues. AcceptedForReplay still backs off.
  • Profile and project replay workers honor TerminalNoop by stopping without a backoff sleep and without a failure log.
  • crates/tracedecay-mcp/src/tool_errors.rs: hook-runtime not_applicable returns JsonRpcResponse::success. Other admission statuses stay JSON-RPC errors.

Test plan

  • cargo test -p tracedecay-host-admission --lib replay::tests::not_applicable_is_a_terminal_noop_unless_the_spool_actually_moves -- --exact (1 passed)
  • cargo test -p tracedecay-mcp --lib not_applicable (2 passed: project replay does not back off; wire response is success and unavailable stays an error)
  • cargo test -p tracedecay-daemon-service --lib profile_host_admission_replay::tests::not_applicable_pending_record_does_not_back_off -- --exact (1 passed)
  • cargo clippy --workspace --all-targets --locked -- -D warnings not run here

Checklist

  • CHANGELOG.md updated (under [Unreleased])
  • No secrets, credentials, or .env files included
  • Breaking changes documented (if any) — ReplayPassDecision gains TerminalNoop; both in-repo workers match it
Open in Web Open in Cursor 

Closed NotApplicable already finishes the replay record, but the shared
pass classifier still backed off on it and the MCP hook boundary still
published it as a JSON-RPC failure. Stop that pass without retry or a
failure log, and return a successful no-op on the wire.

Co-authored-by: Zack Jackson <ScriptedAlchemy@users.noreply.github.com>
@changeset-bot

changeset-bot Bot commented Sep 19, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: c30cc2d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 19, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-19T07:15:09.828960Z 1ee84d3 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: 1ee84d3bf0

ℹ️ 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 +194 to +197
if tool_name == "tracedecay_hook_runtime"
&& let Some(result) = hook_runtime_not_applicable_noop(error)
{
return JsonRpcResponse::success(id, result);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Connect the no-op branch to a production hook-runtime producer

This branch has no production path that can satisfy it: the repo-wide production constructor of HostAdmissionStatus::NotApplicable is code_index_host_outcome in crates/tracedecay/src/mcp/server.rs, whose outcome is consumed by replay and hook-event notification handling rather than converted into the status-bearing TraceDecayError required here. The only call demonstrating this response is the synthetic unit test below, so the advertised MCP behavior does not actually stop a host retry; translate the real outcome on its response path instead of adding an unreachable boundary mapping.

AGENTS.md reference: AGENTS.md:L132-L134

Useful? React with 👍 / 👎.

ScriptedAlchemy and others added 3 commits September 19, 2026 08:33
Master run 35431539771 failed Check formatting (projector.rs, query.rs) and
Clippy (items_after_test_module in query.rs) after #1844/#1845 merged
without CI.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The hook-runtime error boundary gained a branch that turned a
`not_applicable` admission status into a successful JSON-RPC result, but
no production path can produce that error. The only production
constructor of `HostAdmissionStatus::NotApplicable` is
`code_index_host_outcome`; its outcome reaches either the hook-event
notification path (which returns no JSON-RPC response at all) or a
replay worker pass, and neither converts an outcome into a
`TraceDecayError`. The one hook-runtime call site that maps an outcome to
an error, `hermes.rs`, is gated on `!commits_replay_record()`, and
`NotApplicable` commits.

Removing the branch and its synthetic test leaves the reachable half of
the change: `classify_replay_pass` treating a closed `NotApplicable` that
did not shrink the spool as `TerminalNoop`. Resolves the Codex P1 review
finding on #1843 and corrects the CHANGELOG entry, which claimed a wire
behaviour change that does not occur.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@ScriptedAlchemy

Copy link
Copy Markdown
Owner Author

Cursor checked: this PR is fully folded into #1848 (batch C). Leaving the leaf alone — Claude owns the batch head. No competing rebase.

@ScriptedAlchemy
ScriptedAlchemy merged commit 00fde63 into master Sep 19, 2026
1 check passed
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