Skip to content

test(ai): require payload literals for orchestrator mode scans - #117

Closed
cursor[bot] wants to merge 3 commits into
mainfrom
cursor/bc-ecfd108e-e0f4-4e54-806e-40f6e3f09687-0b33
Closed

test(ai): require payload literals for orchestrator mode scans#117
cursor[bot] wants to merge 3 commits into
mainfrom
cursor/bc-ecfd108e-e0f4-4e54-806e-40f6e3f09687-0b33

Conversation

@cursor

@cursor cursor Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Keep fix(ai): rebase adaptive defaults onto current main #106's auto/verify split and wire-level answer() / judge() assertions.
  • Require payload-level "mode": "auto" / "mode": "verify" literals so a class docstring cannot satisfy ADR-0013.
  • Treat post-evaluation as the typed-default exception ("mode": mode plus mode: str = "auto").
  • Add a scan-honesty unit that a docstring mode="auto" mention is not a payload literal.
  • Record the scan contract in ADR-0013 and the Unreleased changelog.

This branch is #106 (a815440) plus the payload-literal lock. Prefer this PR over merging #106 or draft #109.

Product contract

  • Ordinary product adapters keep mode="auto" on the wire.
  • Citation-bearing post-chat and lineage adjudication keep mode="verify" on the wire.
  • Source scans fail if those payload literals disappear, even when a docstring still mentions the mode.

Test plan

  • pytest tests/test_contextual_orchestrator_default_policy.py — 3 passed, 7 subtests
  • Red-green: replacing post_summary.py's payload "mode": "auto" with "mode": "verify" fails the auto scan while the class docstring still says mode="auto"
  • Required PR checks

Synthetic fixtures only. No raw LLM API.

Open in Web View Automation 

cursoragent and others added 3 commits August 16, 2026 14:43
Keep ADR-0013 and drop the colliding ADR-0005 copies. Record one
Unreleased changelog entry, restore the runtime-adapter and
post-evaluation transport regressions, and correct the leftover
post-chat docstring so it no longer describes a forced route.

Co-authored-by: Seongho Bae <[email protected]>
Split auto and verify client lists so a post-chat docstring cannot
satisfy the auto policy. Add wire-level verify assertions for
citation chat and lineage adjudication, and name both exceptions
in the Unreleased changelog.

Co-authored-by: Seongho Bae <[email protected]>
A docstring mention of mode="auto" or mode="verify" can no longer
satisfy the source-scan contract. Dict-payload clients must contain
the JSON literal; post-evaluation keeps the typed default plus
forwarded "mode": mode.

Co-authored-by: Seongho Bae <[email protected]>
@cursor

cursor Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor Author

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ADR-0013 payload literals are a real lock over #106: live adapters send auto/verify, and wire tests call answer() / judge(). Do not merge this head as the final transport contract.

Residuals on 32b6d8a:

  1. test_docstring_mode_mention_is_not_a_payload_literal only checks that mode="auto" is not the substring "mode": "auto". It never runs the scan against a file. A later edit that ORs the docstring spelling back in would still pass.
  2. Whole-file assertIn("mode": "auto") still greens if a class docstring quotes that JSON after the real payload is deleted. Same class of hole as #106, one spelling later.
  3. lineageweave/image_content.py is an orchestrator chat consumer (orchestrator_vision_client) and is not in AUTO_CLIENTS. A generic OpenAI-compatible vision client must keep omitting mode so unknown-field gateways do not 400.

Successor cursor/bc-c1bda94f-3013-4808-8be0-a9bc8c075d80-c501 (b1f1db6) walks the AST, runs those same helpers against a prose-only fixture (including quoted JSON), and sends mode="auto" from orchestrator_vision_client. Prefer that PR over this one, and over #106 / draft #109. Keep this lock transport-only — do not mix related-node captions.

Focused checks on the successor: pytest tests/test_contextual_orchestrator_default_policy.py tests/test_image_content.py — 22 passed, 8 subtests. CodeRabbit CLI 0.7.3 is present but auth login --agent stays on awaiting_browser_auth here, so this is not a CodeRabbit CLI report.

Open in Web View Automation 

Sent by Cursor Automation: Fix Issues

import unittest

ROOT = Path(__file__).resolve().parents[1]
AUTO_CLIENTS = (

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

AUTO_CLIENTS omits lineageweave/image_content.py. orchestrator_vision_client POSTs /v1/chat/completions and is an ordinary ADR-0013 consumer. Add it as a factory-auto case (mode="auto" on the factory, written onto the body) rather than stuffing mode into generic OpenAiCompatibleVisionClient — that path must keep omitting mode so OpenAI-compatible gateways do not 400.

self.assertIn(_TYPED_AUTO_DEFAULT, source)
continue
self.assertIn(
_PAYLOAD_AUTO,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Whole-file assertIn(_PAYLOAD_AUTO, source) still passes if the only remaining "mode": "auto" lives inside a class docstring. Walk the AST for dict literals (and the post-evaluation "mode": mode / typed-default exception) so prose JSON cannot satisfy ADR-0013.

f"{relative} must send verify, not a payload-level auto default",
)

def test_docstring_mode_mention_is_not_a_payload_literal(self) -> None:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This unit asserts that mode="auto" is not the substring "mode": "auto". It never calls _source(), never points AUTO_CLIENTS at a fixture, and never expects the auto/verify scan to fail. Point the same assertion helper used on production clients at a prose-only file (docstring mode="auto" plus quoted {"mode": "auto"}) and expect AssertionError.

Copy link
Copy Markdown
Contributor

Superseded by protected main and the narrower successor #130. The accepted adaptive-orchestration ADR and executable wire-level tests are already present on main; #258 carries the current Buyer/runtime transport policy. This branch's payload-literal scan is not a separate product slice and should not duplicate the same policy history. Closing without merge; any still-useful AST/source-scan assertion belongs only in #130 after reconciliation to live main.

@seonghobae seonghobae closed this Aug 20, 2026
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