Skip to content

test(ai): scan orchestrator mode literals via AST - #130

Closed
cursor[bot] wants to merge 4 commits into
mainfrom
cursor/bc-c1bda94f-3013-4808-8be0-a9bc8c075d80-c501
Closed

test(ai): scan orchestrator mode literals via AST#130
cursor[bot] wants to merge 4 commits into
mainfrom
cursor/bc-c1bda94f-3013-4808-8be0-a9bc8c075d80-c501

Conversation

@cursor

@cursor cursor Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Successor to #117. Keep the auto/verify split and wire-level answer() / judge() assertions, then close the remaining ADR-0013 holes:

  • Walk the AST for payload mode literals so a docstring mode="auto" or a quoted {"mode": "auto"} fragment cannot satisfy the scan.
  • Run those same helpers against a prose-only fixture and expect failure (the honesty unit now invokes the scan).
  • Treat orchestrator_vision_client as an ordinary auto consumer: it sends mode="auto" on describe(). Generic OpenAiCompatibleVisionClient still omits mode so OpenAI-compatible gateways do not 400.
  • Record the AST + vision contract in ADR-0013, ARCHITECTURE, and the Unreleased changelog.

Prefer this PR over merging #117, #106, or draft #109. Transport-only — do not mix related-node captions.

Product contract

  • Ordinary product adapters keep mode="auto" on the wire.
  • Citation-bearing post-chat and lineage adjudication keep mode="verify" on the wire.
  • Orchestrator-built vision sends mode="auto"; a raw OpenAI-compatible vision client omits mode.
  • Source scans fail if those executable payload literals disappear, even when a docstring still mentions the mode or quotes the JSON.

Test plan

  • pytest tests/test_contextual_orchestrator_default_policy.py tests/test_image_content.py — 22 passed, 8 subtests
  • Honesty fixture with docstring mode="auto" plus quoted {"mode": "auto"} fails _assert_auto_client / _assert_verify_client
  • orchestrator_vision_client(...).describe() asserts outbound mode == "auto"
  • Generic OpenAiCompatibleVisionClient.describe() asserts mode is absent
  • Required PR checks

Synthetic fixtures only. No raw LLM API.

Open in Web View Automation 

cursoragent and others added 4 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]>
Close the remaining ADR-0013 hole where a docstring JSON fragment
could satisfy a whole-file substring scan. The honesty unit now
runs the same helpers against a prose-only fixture. Orchestrator
vision sends mode=auto; generic OpenAI-compat vision still omits it.

Co-authored-by: Seongho Bae <[email protected]>
@cursor
cursor Bot requested a review from seonghobae August 16, 2026 15:51
@seonghobae
seonghobae marked this pull request as ready for review August 16, 2026 15:51
@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.

This is the landing vehicle for ADR-0013 transport honesty. Keep #117, #106, and draft #109 closed behind it.

What landed. The source scan now walks the AST, so a docstring mode="auto" or a quoted {"mode": "auto"} fragment cannot green the contract. The honesty unit calls those same helpers. Orchestrator-built vision sends mode="auto" on describe(); a generic OpenAI-compatible vision client still omits mode. Wire tests cover every current chat/completions consumer (summary, evaluation, keyman, commitment, entity-relationship, vision, post-chat, adjudication).

Not merge-blocking. The factory and forwarded-auto helpers are still file-global and value-blind (an unused {"mode": "auto"} dict, or mode="auto" plus any x["mode"] = ..., would satisfy the AST scan). Today’s wire tests backstop that. Do not open another mode-scan PR to tighten the helpers; fold that in when the next channel is added.

Before a human approves. Update the data-flow mermaid in ARCHITECTURE.md: the ORC node still says mode=verify for the whole LLM channel, which contradicts the callout this PR added. That diagram is what an operator reads first.

Do not merge yet. Required checks are still queued, and this automation cannot supply the non-author approval. Do not mix related-node captions or analysis-run work into this branch.

Next human action. Wait for Tests / security / required review checks, fix the mermaid line, then approve from a human account. After it lands, the next buyer-facing slice is related-node chip context (— already in flight on #123 / #92), not another transport scan.

Open in Web View Automation 

Sent by Cursor Automation: Fix Issues

Comment thread ARCHITECTURE.md
> not caused by anything in this repo. Ordinary product adapters request
> `mode="auto"` and are unaffected. Vision built by
> `orchestrator_vision_client` also sends `mode="auto"`; a generic
> OpenAI-compatible vision client omits `mode`.

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.

The callout is now honest about auto vs verify vs omitted vision mode. The mermaid ORC node above this table still reads mode=verify for the entire LLM channel. Change that node to something like mode=auto (verify for chat/adjudication) before a human approves, so the first diagram an operator sees matches ADR-0013.

Copy link
Copy Markdown
Contributor

Superseded by the current architecture. Protected main already owns accepted ADR 0015 and executable wire-level auto regressions, while canonical Buyer root #258 routes vision through contextual-orchestrator and explicitly asserts both mode="auto" and reasoning_effort="auto" on the live multimodal/region calls. This stale branch preserves an older split in which a generic vision client omits mode; that no longer matches the Buyer rule that provider/model/orchestration policy is centralized. Its AST source scan would duplicate stronger behavior-level tests and collide with live ADR/changelog history. Closing without merge.

@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