Group Abstract Group Abstract

Message Boards Message Boards

0
|
71 Views
|
0 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Cloud chat notebooks frequently entirely failing to produce output?

Posted 22 hours ago

This must be a bug of some kind.

It's not even consistent, but when it's occurring, no matter what input I give a cloud chat notebook cell, using Wolfram as the LLM service, OpenAI as the LLM service, or even Gemini as the LLM service, there will be long periods when the evaluation of the chat notebook cell either returns an errored-out empty cell, or it briefly displays an empty cell and then deletes that in-progress empty output. If you mouse over the red cell (when it does show up), you see an error: "An unknown box name (ToBoxes) was sent as the BoxForm for the expression. Check the format rules for the expression.".

Here's an example where I evaluated a blank chat notebook input, with just that red inner cell showing up:

empty cell with ToBoxes error

The TLDR is that there might be an errant backtick after UpdateInterval breaking everything somehow:

Cell[
  BoxData[
    DynamicBox[
      ToBoxes[
        Refresh[
          CompoundExpression[
            Increment[Wolfram`Chatbook`SendChat`Private`x$82600],
            If[
              MatchQ[Wolfram`Chatbook`SendChat`Private`$reformattedCell, _Cell],
              CompoundExpression[
                Pause[1],
                NotebookWrite[
                  Wolfram`Chatbook`SendChat`Private`cellObject$81846,
                  Wolfram`Chatbook`SendChat`Private`$reformattedCell
                ],
                Remove[
                  Wolfram`Chatbook`SendChat`Private`x$82600,
                  Wolfram`Chatbook`SendChat`Private`cellObject$81846
                ],
                Null
              ],
              Wolfram`Chatbook`Common`catchTop[
                Wolfram`Chatbook`SendChat`Private`dynamicTextDisplay[
                  Wolfram`Chatbook`SendChat`Private`container$81846,
                  Function[
                    CompoundExpression[
                      Set[
                        Wolfram`Chatbook`$ChatHandlerData["EventName"],
                        "FormatChatOutput"
                      ],
                      Wolfram`Chatbook`FormatChatOutput[SlotSequence[1]]
                    ]
                  ],
                  True
                ]
              ]
            ]
          ],
          TrackedSymbols :> {Wolfram`Chatbook`SendChat`Private`x$82600},
          UpdateInterval -> 0.4`
        ],
        StandardForm
      ],
      Deinitialization :> Quiet[TaskRemove[Wolfram`Chatbook`SendChat`Private`task$81846]],
      Initialization :> If[
        UnsameQ[$SessionID, 35126011282740619268],
        NotebookDelete[EvaluationCell[]]
      ]
    ]
  ],

Can you spot it?


Ok, now what made this extremely difficult is that I believe somehow the parsing diagnostic reports an issue with the form argument to ToBoxes, even though it looks like it's correct (StandardForm). Indeed, tweaking and playing around with it gives a clue:

ToBoxes[
    Refresh[
        CompoundExpression[Null]`
        ], StandardForm
    ] 

yields:

Syntax::sntxf: "Refresh[" cannot be followed by "CompoundExpression[Null]`]". 

Removing the errant backtick gives a result that's almost reasonably renderable.

Now here's where things get a tiny bit deep. Because the issue is sometimes invisible, I had to start off my debugging session by tracking down the code that draws the tooltip. I was curious, so I spent several hours digging into the cloud chat notebook javascript implementation - thankfully I'm familiar with react and modern react buildsystems.

If you ever need to debug the wolfram cloud notebook interface, this information may be useful. They've not obfuscated the code, so if you're running in PRD instead of LOCAL, LOCAL8080, or DEVEL, the logging functions are there, just nopped out. To turn it all on, look for the debug logger class, you can search for debug() in dist/dyn/layoutWithNotebook.modern[some hash string].modern.js and you'll see where the shims are nopped out:

                warn() {}
                info() {}
                debug() {}
                trace() {
                    this.enabled && f >= _("trace") && console.trace()
                }

Then, if you set a breakpoint either after the class is finished defining, or at debug itself (will fire on any invocation of debug), you can monkey patch them back into functionality quite easily with the console as such:

(this.__proto__.warn = console.warn) | (this.__proto__.info = console.info) | (this.__proto__.debug = console.debug) | (this.__proto__.trace = console.trace)

If you do this you will quickly end up with thousands and thousands of log entries - they were quite thorough when building a full clone of the Mathematica environment in the browser. You'll probably enjoy chrome devtools crashing frequently from the memory usage.

This logging indicated there are a surprising number of unimplemented functions being sent to the browser client to evaluate, including symbols that look like they might be important to the functionality I'm using (e.g. Unsupported symbol WolframChatbookUIMakeChatCloudDockedCellContents`). I can't tell if I'm just experiencing two separate issues (blank output due to models spitting out unsupported symbols, separate from the backtick issue?) or something deeper.

Given I don't have access to mathematica desktop these days, I've been playing around with the cloud notebooks instead, so I'll have to fuss with this more.

For completeness, here's the notebook:

https://community.wolfram.com/groups/-/m/t/3336417

POSTED BY: Alexander Riccio
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard