Skip to content

fix(map-ai): review fixes and shared AI plumbing for the map editing backend - #455

Merged
camreeves merged 6 commits into
PPT-2832-ai-map-reviewfrom
PPT-2832-codex-review
Oct 15, 2026
Merged

camreeves merged 6 commits into
PPT-2832-ai-map-reviewfrom
PPT-2832-codex-review

Conversation

@camreeves

@camreeves camreeves commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Review fixes and de-duplication for the AI map editing backend, stacked on #453 (base PPT-2832-ai-map-review).

Fixes

  1. Sequential renames, canvas expansion and SD replay prompt rules. Codex made these on 14 Oct and they ran in the sidecar for both the local and the mqt.placeos.run demos, but were never committed. They come in unchanged, so the code under review matches what was demoed.
  2. A cut-off Anthropic proposal is reported as length. With the proposal returned as a tool input, a response that stopped at max_tokens either had no tool_use block, which raised InvalidResponse, or a truncated one. Either way the runner's retry with a larger budget never ran. New spec in spec/llm_anthropic_spec.cr.
  3. The server checks canvas expansion the same way the editor does. The op checker accepted any positive viewBox on the root. The editor rejects one that crops the old map or grows it beyond four times, and the server now applies the same rule against the posted context viewBox. New spec in spec/llm_prompt_spec.cr.
  4. The snapshot bounds line sits under the ANNOTATIONS heading. Commit 1 wrote it ahead of the heading, which broke map_ai_spec ("sends the markup snapshot as an image part"). Codex had only run a focused subset of specs. It is also left out now when there are no annotations, since it only explains off-map marks.

Reuse of the signage AI code

The map AI backend already shares most of the signage AI groundwork: provider rows, job rows and their long poll, the vendor HTTP client with its proxy and timeouts, slots, the upload store and sweep, error types and credential reading. The models PR (#334) extends the existing sums and usage with a kind filter rather than copying them. Two places had been copied instead:

  1. Utils::OpenAIVendor. OpenAIImages (signage) and OpenAIChat (maps) carried the same base URL, Azure check, auth headers and error mapping. Both now include one module. The image adapter also maps Azure's content_filter code to a moderation error, as the chat adapter already did.
  2. Utils::AIJobs. The map AI controller had copied the signage controller's quota count, cancel action and recent-jobs query, changing only the job kind. They are now remaining_ai_quota, request_job_cancel and recent_ai_jobs, next to the shared long poll.

Left as they are: quotas_for and disabled differ in their quota keys and response types, and usage is a one-line call in each controller.

Verification

🤖 Generated with Claude Code

camreeves and others added 3 commits October 15, 2026 23:07
…t rules

These changes were made on 14 Oct and ran in the rest-api sidecar for the
local and mqt.placeos.run demos, but were never committed:

- set_id renames update the index in proposal order, so later ops can target
  the new id and the old id becomes free
- set_attr viewBox is allowed on the SVG root only, with four finite numbers
- prompt rules for preserving label font weight, composited overlay contrast,
  referencing ids created earlier in the same proposal, translucent booking
  overlays, shared-wall doorways and bounded canvas expansion

Co-authored-by: Codex <noreply@openai.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With the proposal returned as a tool input, a response that stopped at
max_tokens either had no tool_use block, which raised InvalidResponse, or a
truncated one. Both skipped the runner's retry with a larger output budget.
The adapter now sets finish to length before reading the tool input.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The server accepted any positive viewBox on the root, while the editor rejects
one that crops the old map or grows it beyond four times. The op checker now
applies the same rule against the viewBox the editor posts in the context, so
the job's server issues agree with what the editor will allow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added type: bug something isn't working and removed type: bug something isn't working labels Oct 15, 2026
camreeves and others added 2 commits October 15, 2026 23:30
The bounds line was written ahead of the ANNOTATIONS heading, so the markup
part no longer started with its heading and map_ai_spec could not find it.
It explains annotations drawn off the map, so it now sits under that heading
and is left out when there are no annotations.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ap adapters

OpenAIImages and the map edit OpenAIChat adapter each carried the same base
URL, Azure check, authentication headers and error mapping. They now include
Utils::OpenAIVendor. The image adapter also treats Azure's content_filter
error code as a moderation refusal, as the chat adapter already did.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot removed the type: bug something isn't working label Oct 15, 2026
…rollers

The map AI controller copied the signage AI controller's quota count, cancel
action and recent-jobs query, differing only in the job kinds. They now live
in Utils::AIJobs next to the shared long poll: remaining_ai_quota,
request_job_cancel and recent_ai_jobs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the type: bug something isn't working label Oct 15, 2026
@camreeves camreeves changed the title fix(map-ai): review fixes on the AI map editing backend fix(map-ai): review fixes and shared AI plumbing for the map editing backend Oct 15, 2026
@camreeves
camreeves merged commit 3450a35 into PPT-2832-ai-map-review Oct 15, 2026
11 checks passed
@camreeves
camreeves deleted the PPT-2832-codex-review branch October 15, 2026 12:53
@camreeves

Copy link
Copy Markdown
Contributor Author

Superseded: these commits were pushed straight to PPT-2832-ai-map-review and are described on #453 (#453 (comment)). GitHub marked this PR merged because its commits are now in that branch; nothing went to master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: bug something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant