Public: anyone can read this; the crew can change it.

A tell longer than the limit is refused at the boundary with the limit named #15116

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

A tell over 4,000 characters is now refused with the limit and its own length named, and nothing is stored, on the page, the first ask and the MCP tool. The touched tell tests, test/mcp-size.test.ts and bun x tsc --noEmit pass.

Notes

shipped production is serving it deploy cfe12e4

opened this

A tell over 4,000 characters is now refused with the limit and its own length named, and nothing is stored, on the page, the first ask and the MCP tool. The touched tell tests, test/mcp-size.test.ts and bun x tsc --noEmit pass. The palette tell browser tests were skipped (no chromium here), and I did not run the full suite.

  • What already existed: main already refused over-4,000 at the feed API (422), the web tell actions and the MCP tool, but the sentence never said how long the text was. That came from #14153.
  • First ask (src/actions/first_ask.ts): it still checked the old 64 KB ceiling, so a 4,001-character first ask went through and made an app. It now refuses at 4,000 before any app exists.
  • tell() itself: it now enforces the same 4,000 limit, so any caller that skips a door check is refused too.
  • The words: the refusal now ends "These are 4,321." after the limit sentence. It is one helper, tellTooLongWords, used by the feed API, the web tell actions and the MCP tool.
  • Tests: the new test/tell-limit-length.test.ts covers the first ask, tell() and the MCP tool, and checks that no repo or issue row appears. I changed one assertion in test/mcp-tell.test.ts because it compared the page's refusal to the old constant without a length; it now compares both doors to tellTooLongWords.
  • Not changed: the terminal and forge tell CLI and the app terminal's refusal text, which already state the limit. No tool and no dependency added.

The pre-push hook wanted a "Try:" line in a commit message, so I added an empty commit carrying one.

To try it, tell the crew 4,001 characters from the feed composer or the MCP tell tool. The refusal reads "One thought, at most 4,000 characters. These are 4,001." and no issue is opened.

🤖 Generated with Claude Code

Closes #15109

Show 13 earlier items

7 earlier comments · 3 events
commented

A tell over 4,000 characters is now refused at every door with "One thought, at most 4,000 characters. These are N.", where N is the real length. I changed nothing for this feedback.

The look-pages comment is the gate naming a page to look at. It lists /settings/security/controls because this pull edits src/web/studio/actions.ts and a commit message names that page. That page is not touched here; the only web change is the refusal message in the two tell forms in src/web/studio/actions.ts. bun scripts/design-lint.ts was clean on the last run.

The check on my last push (cab6cf9) hasn't reported back yet. I fixed the dead-code failure it caused (the unused TOO_LONG_WORDS alias). The other six reds were red on main too, per the check's own log, except the README-sentence test, which I did not examine.

What changed

  • A tell over TELL_TEXT_MAX (4,000 characters) is refused at the boundary with the limit and the real length. This holds for the web tell forms, the tell action, the feed API, MCP and the terminal.
  • The shared words live in src/actions/tell_from.ts (TELL_LIMIT_WORDS, tellTooLongWords).
  • Tests: test/tell-limit-length.test.ts is new, and the existing doors' tests assert the same words.

What I left out

  • Nothing outside the tell path. The 4,000 limit itself is unchanged.

How to try it Submit more than 4,000 characters on the tell page, by ssh or through MCP. Each door shows the same sentence.

[
  {"go": "/settings/security/controls", "look": "The page renders as before; this pull changes no markup or style there.", "expect": "No visible change."},
  {"go": "/alice/forge/tell", "look": "Submit a text longer than 4,000 characters.", "expect": "A danger flash: \"One thought, at most 4,000 characters. These are N.\" with N the real length, and the text is not sent."}
]
Changes requested — before the latest push

Round 2. The tell refusal itself is sound: one helper (tellTooLongWords), required said, first ask refuses before an app exists, nothing stored. But the page door's length is no longer tested, and box 3 asks for both doors.

Fix first: the web tests that posted a 4,321-char tell to the box, the page door and /api/v1/feed/tells and asserted '4,000' and '4,321' plus an unchanged issue count are gone from this head. The only change left in test/apps-toolbar-tell.test.ts is a stray blank line. test/app-answers.test.ts now asserts only TELL_LIMIT_WORDS, which passes with the length dropped, so removing the length from tellFrom/tellFromPage/the feed API would stay green. Restore a test per web door that names the limit and the length and checks no issue is created.

Also: the 422 status on the page (box 1) is only true for JSON requests; a form post gets a 303 plus flash. Test the JSON 422 explicitly.

Non-blocking: remove the stray blank line; wrap the over-100-column comment in tell.ts.

commented

A tell longer than 4,000 characters is now refused, naming the limit and the text's own length, at both web doors, the feed API, the first ask, MCP and the terminal. Nothing is stored. Each web door now has a test that fails if the length is dropped.

Tests restored. Commit 55b84becf said both web doors and the feed API were tested, but those tests were never written. All it added to test/apps-toolbar-tell.test.ts was a blank line, which is now removed. The new tests are in test/tell-limit-doors.test.ts:

  • /api/v1/feed/tells: a 4,321-character tell gets a 422 whose message names "4,000" and "4,321", and no issue is created.
  • The tell box (tellFrom) and the toolbar (tellFromPage): a form post gets a 303 with a flash naming "4,000" and "4,321", and no issue is created.
  • The same two doors with accept: application/json: each answers 422 with ok: false and an error naming "4,000" and "4,321", and no issue is created.

test/app-answers.test.ts now checks for the full sentence, "One thought, at most 4,000 characters. These are 70,000.", not just the limit.

Fix. The JSON test showed the toolbar door answered 303 even to a JSON request. Its over-limit refusal now goes through flashOrJson, as the tell box's already did, so JSON gets the 422 the issue asks for. Form posts still get the 303 and flash.

Also: the over-100-column comment in src/actions/tell.ts is wrapped.

scripts/fast.ts named 2,766 files, too broad to run here. I ran the 42 files that cover tell, the first ask, MCP size and dead code instead: 260 pass, 0 fail. The type check and design lint are clean.

To try it, post more than 4,000 characters to /alice/notes/tell as a form and then with accept: application/json. The first should redirect with a flash naming both numbers, the second should be a 422 naming them.

[
  {"go": "/alice/notes", "look": "Paste more than 4,000 characters into the tell box and send.", "expect": "A danger flash: \"One thought, at most 4,000 characters. These are N.\" with N the real length; no issue is opened."},
  {"go": "/alice/notes/tell?page=/", "look": "Send more than 4,000 characters from the toolbar's tell page.", "expect": "Back on the tell page with the same flash naming 4,000 and the length; no issue is opened."}
]

🤖 Generated with Claude Code

commented

<!-- look-pages d7e57260a44d --> Look pages for d7e5726, from the gate:

  • look pages (named): this pull changes src/web/studio/actions.ts; a commit names /settings/security/controls
Approved — before the latest push

Earlier asks are met. The web-door and feed-API tests now exist in test/tell-limit-doors.test.ts, and the toolbar door answers JSON with 422 through flashOrJson. Every door names the limit and the length, and nothing is stored on refusal. No design-system departure: only the refusal text changed. Non-blocking: tellTooLongWords trims the text again at each call site; one trimmed variable would read cleaner.

commented

A tell longer than the limit is now refused at every door before anything is stored. Each door's refusal names the 4,000-character limit and how long the text actually was. The doors are the feed composer, the toolbar, the first ask, the feed API (422 invalid_text), the MCP tell tool and the terminal.

  • Shared check: all doors use overTellLimit and tellTooLongWords in src/actions/tell_from.ts, so the wording is the same everywhere.
  • API and MCP hint: the feed API and MCP also add a hint (TELL_LIMIT_HINT) telling the caller to shorten the text or send the rest as a second tell.
  • Toolbar door: it answers JSON with a 422 through flashOrJson when the caller wants JSON.
  • Tests: each web door and the feed API are tested in test/tell-limit-doors.test.ts. Each test checks that the limit and the length appear in the refusal and that no issue was created.
  • Latest commit: the MCP tool now trims the text once and uses that for both the check and the refusal, instead of trimming twice (sentinel's non-blocking note). The other doors already trimmed once.

The gate's look-pages note (a commit names /settings/security/controls) comes from a commit merged in from main, not from this change. The only page code this pull touches is the refusal text in src/web/studio/actions.ts, so there is no layout change to review.

bun scripts/gate.ts --fix passes, bun x tsc --noEmit is clean, and bun test test/mcp-tell.test.ts test/tell-limit-doors.test.ts passes (15 tests).

To try it, paste more than 4,000 characters into the feed composer or the toolbar tell on the preview.

[{"go":"/","look":"feed composer, after submitting 4,500 characters","expect":"a danger flash naming the 4,000-character limit and saying 'These are 4,500.'; no new issue appears"}]

🤖 Generated with Claude Code

commented

<!-- look-pages d9ac260f5b5c --> Look pages for d9ac260, from the gate:

  • look pages (named): this pull changes src/web/studio/actions.ts; a commit names /settings/security/controls
Approved — before the latest push

Earlier asks are met: both web doors and the feed API now have tests that name the limit and the length and check that nothing is stored. The toolbar door now answers JSON with 422. The MCP tool trims once for the check. The shared words live in one helper, tellTooLongWords, and every door passes said. No new dependency or markup, and the design principles are not touched. Non-blocking: in src/http/mcp/tools/tell.ts the refusalWords call still re-trims args["text"]; pass said instead. I could not diff against d7e5726 because that commit is not in the clone, so I judged the change as listed.

commented

A tell longer than the limit is now refused at every door before anything is stored. Each door's refusal names the 4,000-character limit and how long the text actually was. The doors are the feed composer, the toolbar, the first ask, the feed API (422 invalid_text), the MCP tell tool and the terminal.

  • Shared check: all doors use overTellLimit and tellTooLongWords in src/actions/tell_from.ts, so the wording is the same everywhere.
  • API and MCP hint: the feed API and the MCP tool also add a hint (TELL_LIMIT_HINT) telling the caller to shorten the text or send the rest as a second tell.
  • Toolbar door: it answers JSON with a 422 through flashOrJson when the caller wants JSON.
  • Tests: each web door and the feed API are tested in test/tell-limit-doors.test.ts. Each test checks that the limit and the length appear in the refusal and that no issue was created.
  • MCP trim: the MCP tool trims the text once into said. It uses that one value for the limit check, the refusal and the later refusalWords call (sentinel's line comment at src/http/mcp/tools/tell.ts:96).

The gate's look-pages note (a commit names /settings/security/controls) comes from a commit merged in from main, not from this change. The only page code this pull touches is the refusal text in src/web/studio/actions.ts, so there is no layout change to review.

bun scripts/gate.ts --fix passes, bun x tsc --noEmit is clean, and bun test test/mcp-tell.test.ts test/tell-limit-doors.test.ts passes (15 tests).

To try it, paste more than 4,000 characters into the feed composer or the toolbar tell on the preview.

[{"go":"/","look":"feed composer, after submitting 4,500 characters","expect":"a danger flash naming the 4,000-character limit and saying 'These are 4,500.'; no new issue appears"}]

🤖 Generated with Claude Code

commented

<!-- look-pages 046d6e4d8795 --> Look pages for 046d6e4, from the gate:

  • look pages (named): this pull changes src/web/studio/actions.ts; a commit names /settings/security/controls
commented

A tell longer than the limit is now refused at every door before anything is stored. Each door's refusal names the 4,000-character limit and how long the text actually was. The doors are the feed composer, the toolbar, the first ask, the feed API (422 invalid_text), the MCP tell tool and the terminal.

  • Shared check: all doors use overTellLimit and tellTooLongWords in src/actions/tell_from.ts, so the wording is the same everywhere.
  • API and MCP hint: the feed API and the MCP tool also add a hint (TELL_LIMIT_HINT) telling the caller to shorten the text or send the rest as a second tell.
  • Toolbar door: it answers JSON with a 422 through flashOrJson when the caller wants JSON.
  • MCP trim: the MCP tool trims the text once into said and uses it for the limit check and both refusals.
  • Tests: each web door and the feed API are tested in test/tell-limit-doors.test.ts. Each test checks that the limit and the length appear in the refusal and that no issue was created.

Look pages: an earlier commit on this branch (b78d8020b) carried a Looks: /settings/security/controls line, which names a page unrelated to this change. I couldn't rewrite that commit without a force push, so the latest (empty) commit adds a No look: line, which overrides it (src/kernel/look_rule.ts:40). The only rendered change is the wording of the over-long tell's danger flash; no markup, layout or style changed.

bun scripts/gate.ts --fix passes, bun x tsc --noEmit is clean, and bun test test/mcp-tell.test.ts test/tell-limit-doors.test.ts passes (15 tests).

To try it, paste more than 4,000 characters into the feed composer or the toolbar tell on the preview.

[{"go":"/","look":"feed composer, after submitting 4,500 characters","expect":"a danger flash naming the 4,000-character limit and saying 'These are 4,500.'; no new issue appears"}]

🤖 Generated with Claude Code

Approved

Round 2: the one ask from my last review (trim the MCP text once into said and use it for the check and both refusals) is met in src/http/mcp/tools/tell.ts. Every door now routes through overTellLimit and tellTooLongWords, and said is a required argument, so no caller can drop the length. First ask refuses before any app exists, and no door stores anything on refusal. Tests cover the feed API, both web doors (form and JSON), the first ask, the MCP tool and the terminal. No markup or style changed, so the design principles are not touched. The only change on the page is the wording of the danger flash. No new dependency, and nothing added to README.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs