Skip to content

fix(serenity): finish LLMO-6190 headroom wiring (unbreak type-check + build)#2883

Closed
byteclimber wants to merge 1 commit into
feat/serenity-intent-classificationfrom
fix/serenity-headroom-typecheck
Closed

fix(serenity): finish LLMO-6190 headroom wiring (unbreak type-check + build)#2883
byteclimber wants to merge 1 commit into
feat/serenity-intent-classificationfrom
fix/serenity-headroom-typecheck

Conversation

@byteclimber

Copy link
Copy Markdown
Contributor

Summary

The feat/serenity-intent-classification branch shipped the LLMO-6190 dynamic-allocation headroom guard half-wired, which is why the branch's own CI (PR #2785) and the stacked edit-path PR #2875 are both red. This fixes the base breakage. Base is feat/serenity-intent-classification, not main.

What was broken (reproduced on the pristine base)

  • type-check: markets-subworkspace.jsgenerateAndAttachPrompts's JSDoc documents a required headroom param and the caller passes it, but the function never declared/used it (TS8024 + TS2554: 6 args to a 5-param fn).
  • ci / build (eslint): prompts-subworkspace.js:251 — a second headroom guard shadowed the one at line 171 (no-shadow).
  • test: handleCreatePromptsSubworkspace dynamic-allocation test failed — its options object was passed in the env positional slot instead of the 8th, so the guard was never enabled.

Fixes

  1. markets-subworkspace.js — add headroom as the 6th param to generateAndAttachPrompts and front headroom.ensure({ prompts: texts.size }, { includeDrafted: true }) before the metered createPromptsByIds write loop (the metered write is the create, not publish). Matches the JSDoc + the prompts-subworkspace.js twin. No-op when the flag is OFF.
  2. prompts-subworkspace.js⚠️ behavior change, please scrutinize: removed the redundant pre-publish ensure (which re-created a second guard → the no-shadow, and issued a second getWorkspaceResources read). The LLMO-6190 design meters once before the write (test title: "front headroom before the write, not just before publish"; assertion: getWorkspaceResources called once, before createPromptsByIds). The pre-write ensure at line 176 already reserves the whole batch, so the pre-publish read was a pre-LLMO-6190 leftover. If a second pre-publish top-up is intentional, this is the line to push back on.
  3. prompts-subworkspace.test.js — fixed the stale positional call (options → 8th slot) to match the controller + signature.

Verification

Type-check clean, lint clean. Combined with PR #2875, the three serenity handler test suites are 223 passing / 0 failing.

⚠️ Interdependency with #2875

This PR and #2875 are complementary — the feature branch is broken in two places and each PR fixes one, so neither is green alone; both must merge for feat/serenity-intent-classification (and PR #2785) to go green. Verified locally that edit-path + headroom together are fully green.

🤖 Generated with Claude Code

The feature branch left the dynamic-allocation headroom guard half-wired,
breaking type-check + build and a metering test:

- markets-subworkspace.js generateAndAttachPrompts: the caller threaded a
  headroom guard as a 6th arg and the JSDoc documented it as required, but the
  function never declared or used it (TS8024 + TS2554). Add the param and front
  headroom.ensure({ prompts: texts.size }, { includeDrafted: true }) before the
  metered createPromptsByIds write loop.

- prompts-subworkspace.js handleCreatePromptsSubworkspace: removed the redundant
  pre-publish ensure that re-created a second headroom guard (no-shadow) and
  issued a second getWorkspaceResources read. LLMO-6190 meters ONCE before the
  write (the create is the metered write, not publish); the pre-write ensure
  already reserves the whole batch, so the pre-publish read was a leftover.

- prompts-subworkspace.test.js: the dynamic-allocation test passed its options
  object in the env positional slot instead of the 8th, so the guard was never
  enabled; corrected to match the controller/signature.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@byteclimber
byteclimber requested a review from MysticatBot July 22, 2026 08:05
@byteclimber

Copy link
Copy Markdown
Contributor Author

Consolidated into #2875. These two fixes are a mutual dependency (each PR's CI ran the full suite and was red on the other's unfixed domain), so two separate green PRs was technically impossible. The headroom/LLMO-6190 commit is now cherry-picked onto #2875; that branch is green (type-check + lint clean, 223 serenity handler tests passing). Closing this one.

@byteclimber
byteclimber deleted the fix/serenity-headroom-typecheck branch July 22, 2026 08:24
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.

1 participant