Skip to content

fix(review): coerce answer-consent object input to serialized string (#2375) - #2387

Open
carlosmoradev wants to merge 1 commit into
Gentleman-Programming:mainfrom
carlosmoradev:fix/2375-gentle-review-answer-consent-input-coercion
Open

carlosmoradev wants to merge 1 commit into
Gentleman-Programming:mainfrom
carlosmoradev:fix/2375-gentle-review-answer-consent-input-coercion

Conversation

@carlosmoradev

@carlosmoradev carlosmoradev commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Closes #2375

Problem

gentle_review {"operation":"answer-consent"} cannot be completed from a direct tool call when passing an object input.

In extensions/gentle-ai.ts:5567, parseReviewControllerParameters only serialized object inputs for START and ASSESS (#1573). Any other operation with a non-string input immediately threw:

Review controller input must be a string

Because Pi's tool execution runtime automatically parses JSON tool arguments into JavaScript objects, an LLM tool call responding to a consent/v3 envelope with input: {"consentBinding": "<opaque>", "answer": "granted"} arrives as an object and fails closed at parameter parsing.

Solution

  • Object Coercion for answer-consent:
    • In extensions/gentle-ai.ts (parseReviewControllerParameters), included value.operation === REVIEW_CONTROLLER_OPERATION.ANSWER_CONSENT in the serializeReviewJsonArgument branch alongside START and ASSESS.
  • Schema Description:
    • Updated tool parameter description in REVIEW_CONTROLLER_PARAMETER_FIELDS.input to reflect START/ASSESS/answer-consent.
  • Regression Coverage:
    • Added unit test in tests/review-json-arguments.test.ts verifying that answer-consent accepts object inputs, coerces them to serialized JSON strings, and dispatches to the controller without throwing.

Changes

File Change
extensions/gentle-ai.ts Allow object input coercion for answer-consent in parseReviewControllerParameters and update schema description
tests/review-json-arguments.test.ts Unit test for answer-consent object coercion and execution; update operations filter
odd/tasks/fix-2375-gentle-review-answer-consent-input-coercion.md Task breakdown and verification evidence

Verification

  • Strict TDD:
    • RED: Observed Review controller input must be a string in tests/review-json-arguments.test.ts when passing object input to answer-consent.
    • GREEN: All 9 tests in tests/review-json-arguments.test.ts passing.
  • Suite Integrity:
    • node --experimental-strip-types --test tests/review-controller.test.ts: 7/7 tests pass.
    • npm run typecheck: 0 diagnostics, no regressions.

Summary by CodeRabbit

  • New Features
    • answer-consent now accepts either a JSON object or a serialized JSON object, making it easier to provide consent answers.
    • Object inputs are converted to JSON before processing. Other operations continue to require serialized JSON objects.

@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: b46ce304-fa6b-4f65-922c-28c638d0469f
📥 Commits

Reviewing files that changed from the base of the PR and between ceb5e54 and 90bdbd1.

📒 Files selected for processing: 3
  • extensions/gentle-ai.ts
  • odd/tasks/fix-2375-gentle-review-answer-consent-input-coercion.md
  • tests/review-json-arguments.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.

📝 Walkthrough

The gentle_review input description and parser now accept object-form answer-consent input and serialize it as JSON. Tests cover validation, serialization, facade handling, and the resulting consent-binding-stale outcome.

Changes: Answer-consent input coercion

Layer / File(s) Summary
Coercion and validation
extensions/gentle-ai.ts, tests/review-json-arguments.test.ts, odd/tasks/fix-2375-gentle-review-answer-consent-input-coercion.md
The input description and parser now allow object-form answer-consent input and serialize it as JSON. Tests cover validation and facade handling. The task document records the implementation and verification details.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: dnlrsls

Merge Risk: ⚪ Minimal · up to 90bdb

Object-form consent answers now pass parsing and reach the answer-consent path. No material merge-blocking issue is established.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: coercing object-form answer-consent input to a serialized string for review handling.
Linked Issues check Passed Issue #2375 requires direct gentle_review calls to accept object-form answer-consent input. The diff adds ANSWER_CONSENT to the object-serialization branch in parseReviewControllerParameters. …
Out of Scope Changes check Passed The changes stay within issue #2375. The source change enables answer-consent object coercion. The schema text documents that behavior. The tests cover validation, serialization, dispatch, and prese…
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Full details: Linked Issues check

Explanation

Issue #2375 requires direct gentle_review calls to accept object-form answer-consent input. The diff adds ANSWER_CONSENT to the object-serialization branch in parseReviewControllerParameters. The diff updates the input schema description. The regression test validates { consentBinding, answer }, checks JSON serialization, and executes the controller without the previous string error. This meets the issue's minimum acceptance requirement. The test also confirms that execution reaches the controller; it does not claim an end-to-end granted START.

Full details: Out of Scope Changes check

Explanation

The changes stay within issue #2375. The source change enables answer-consent object coercion. The schema text documents that behavior. The tests cover validation, serialization, dispatch, and preservation of fail-closed behavior for other operations. The task document records the implementation and verification. No unrelated change is demonstrated.

Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files. (2 skipped: 1 unsupported, 1 too large.)

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

This branch has not been deployed

No deployments
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.

bug(review): gentle_review answer-consent input is unreachable from direct tool calls (object never coerced to string) (4.3.0)

1 participant