Page MenuHomePhabricator

Quote objects constructed in the user interface cannot be used in function evaluations or code implementations
Open, In Progress, LowPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • Go to Echo (Z801)
  • In “Try a function”, choose Quote for the type
  • For the Quote object (…) choose “Reference”
  • Select a Reference like Z17403/Monday
  • Click “Run function”

What happens?:
Z560/Invalid evaluation result

What should have happened instead?:
The quoted object reference should have been returned

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.):

Any object in the quote will fail to echo. It will also fail in Z199 and any code implementation of any function.

If, however, a valid Quote object is constructed by a code implementation, it will echo correctly.

  • For echo’s input (…) choose “Function call”
  • Choose Z29267/quoted reference as the function
  • Click ➕ to add an item to the untyped list
  • For item 1 (…) choose “Reference”
  • Select Z17403/Monday
  • Click “Run function”

IMG_1398.png (2×960 px, 126 KB)

Trying non-builtin implementations of echo, the Python error is:

Error type: Unspecified error
Error data:
error information: "'str' object has no attribute 'get'"

The JavaScript error is:

Error type: Invalid executor response
Error data:
contents: "[2025-11-04 22:39:48.106] [error] execution failed: out of bounds memory access, Code: 0x408 [2025-11-04 22:39:48.106] [error] When executing function name: "_start""

Details

Related Changes in Gerrit:
Related Changes in GitLab:
TitleReferenceAuthorSource BranchDest Branch
Update function-schemata sub-module to HEAD (a192c85)repos/abstract-wiki/wikifunctions/function-orchestrator!506apinesync-function-schematamain
Customize query in GitLab

Event Timeline

{F70688397}I just tried the use case in the 'try this function' on the python implementation and I see it working. Also in the javascript one.
(Also I don't see how this is tagged as front-end? @Jdforrester-WMF )

{F70688397}I just tried the use case in the 'try this function' on the python implementation and I see it working. Also in the javascript one.
(Also I don't see how this is tagged as front-end? @Jdforrester-WMF )

It appears that you may have used the “successful” reproduction steps given in “Other information” rather than those given in the “Steps to replicate…”. I can confirm that the quote object constructed by supplying a Reference continues to fail in the manner described. There should be no use of the “quoted reference” function when attempting to reproduce the error.

Ah Yes. Adding the link for convenience here

(Also I don't see how this is tagged as front-end? @Jdforrester-WMF )

Because the front-end code shouldn't allow/encourage the user to create malformed Z99s, I imagine.

At least part of the problem will be resolved once https://gitlab.wikimedia.org/repos/abstract-wiki/wikifunctions/function-schemata/-/merge_requests/310 is deployed in the orchestrator. When I look at the executors, I see that we don't do anything special for Z99/Quote, so I can see how these things will fail.

Do we think the front-end part of this is solved adequately? Is there still a way someone can craft degenerate Z99s that make it to the evaluator? If so, can someone provide a Z7 that demonstrates that behavior?

We should harden the evaluator either way, but the answers to these questions will help prioritize that work.

Change #1224079 had a related patch set uploaded (by Jforrester; author: Jforrester):

[operations/deployment-charts@master] wikifunctions: Upgrade orchestrator from 2025-12-10-133418 to 2026-01-07-132737

https://gerrit.wikimedia.org/r/1224079

Change #1224079 merged by jenkins-bot:

[operations/deployment-charts@master] wikifunctions: Upgrade orchestrator from 2025-12-10-133418 to 2026-01-07-132737

https://gerrit.wikimedia.org/r/1224079

Jdforrester-WMF assigned this task to cmassaro.

This has now been deployed, and from my testing the back-end changes are sufficient. I'm calling this Resolved.

A quoted reference still fails to reach Python or JavaScript code.

For example, in this call the two elements should be equivalent but the second causes a failure that does not occur when it is deleted from the list. The failure is equally apparent with a call using Python echo (Z15788) but there is no link available for such a call. Test case Z31006 demonstrates the failure but is not connected: “Unspecified error (error information: "'str' object has no attribute 'get'")”. The JavaScript failure with Z10015 is: “Invalid executor response (contents: "[2026-01-08 11:14:38.395] [error] execution failed: out of bounds memory access, Code: 0x408 [2026-01-08 11:14:38.395] [error] When executing function name: "_start"")”

A quoted reference still fails to reach Python or JavaScript code.

For example, in this call the two elements should be equivalent but the second causes a failure that does not occur when it is deleted from the list. The failure is equally apparent with a call using Python echo (Z15788) but there is no link available for such a call. Test case Z31006 demonstrates the failure but is not connected: “Unspecified error (error information: "'str' object has no attribute 'get'")”. The JavaScript failure with Z10015 is: “Invalid executor response (contents: "[2026-01-08 11:14:38.395] [error] execution failed: out of bounds memory access, Code: 0x408 [2026-01-08 11:14:38.395] [error] When executing function name: "_start"")”

I'm not sure that's at all the same issue. Can you please file it as a new task?

DSantamaria changed the task status from Open to In Progress.Jan 8 2026, 3:12 PM

I think it is the same issue, but it should already be covered under T405411 anyway, if not. Original report:

Trying non-builtin implementations of echo, the Python error is:

Error type: Unspecified error
Error data:
error information: "'str' object has no attribute 'get'"
The JavaScript error is:

Error type: Invalid executor response
Error data:
contents: "[2025-11-04 22:39:48.106] [error] execution failed: out of bounds memory access, Code: 0x408 [2025-11-04 22:39:48.106] [error] When executing function name: "_start""

I'm still able to reproduce this on prod. When I run in a local stack, the same requests work perfectly. Unfortunately, our logs don't capture the relevant stack traces (or even tell us where the errors are coming from). We also don't log the requests made to the evaluator. If we logged that, we could at least tell whether this issue was due to 1) an invalid payload constructed by the orchestrator or 2) differences in how prod vs. local evaluators process the same payload.

The plot thickens.

I've put a Wikifunctions.Debug call into the JS implementation:

function Z801( Z801K1 ) {
	Wikifunctions.Debug( JSON.stringify( Z801K1 ) );
	return Z801K1;
}

I'm now running the following functions call (Z99/Quote wrapping an empty Z6/String):

{"Z1K1":"Z7","Z7K1":{"Z1K1":"Z8","Z8K1":["Z17",{"Z1K1":"Z17","Z17K1":"Z1","Z17K2":"Z801K1","Z17K3":{"Z1K1":"Z12","Z12K1":["Z11",{"Z1K1":"Z11","Z11K1":"Z1002","Z11K2":"input"}]}}],"Z8K2":"Z1","Z8K3":["Z20","Z8010","Z8011","Z8012","Z8013","Z13517","Z15868","Z13870","Z17799","Z17603","Z31006"],"Z8K4":["Z14",{"Z1K1":"Z14","Z14K1":"Z801","Z14K3":{"Z1K1":"Z16","Z16K1":"Z600","Z16K2":"function Z801( Z801K1 ) {\n\tWikifunctions.Debug( JSON.stringify( Z801K1 ) );\n\treturn Z801K1;\n}"}}],"Z8K5":"Z801"},"Z801K1":{"Z1K1":"Z99","Z99K1":{"Z1K1":"Z6","Z6K1":""}}}

When I run locally, the debug content looks like this:

{"Z1K1":{"Z1K1":"Z9","Z9K1":"Z99"},"Z99K1":""}"]}

When I run in prod,

{"Z1K1":{"Z1K1":"Z9","Z9K1":"Z99"},"Z99K1":{"Z1K1":null}}

Both of these are wrong in their own way. We shouldn't type-convert the contents of Z99/Quote, so that's something we can fix. However, it's still a problem that the object being sent to the evaluator differs in prod. Without logging the request received by the evaluator, I can't pinpoint the issue. This means it could still be the fault of either the orchestrator or the evaluator.

I logged some things locally to check what is send from PHP to the orchestrator.

I don't know if this is helpfull. locally these tests fail for the same reason as on PROD for me btw.

When running perform tests for echo quoted reference(Z31006) and JavaScript implementation of Echo(Z10015).

1. Test call

MediaWiki\Extension\WikiLambda\ActionAPI\ApiPerformTest::logFunctionCallPayload
stage = testCall
functionZid = Z801
implementationZid = Z10015
testerZid = Z31006
flags = {"isUnsavedCode": false}

Function payload:

{
  "Z1K1": "Z7",
  "Z7K1": {
    "Z1K1": "Z8",
    "Z8K1": [
      "Z17",
      {
        "Z1K1": "Z17",
        "Z17K1": "Z1",
        "Z17K2": "Z801K1",
        "Z17K3": {
          "Z1K1": "Z12",
          "Z12K1": [
            "Z11",
            { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "input" },
            { "Z1K1": "Z11", "Z11K1": "Z1157", "Z11K2": "invoer" },
            { "Z1K1": "Z11", "Z11K1": "Z1025", "Z11K2": "wejście" },
            { "Z1K1": "Z11", "Z11K1": "Z1014", "Z11K2": "Ihe" },
            { "Z1K1": "Z11", "Z11K1": "Z1011", "Z11K2": "ইনপুট" },
            { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "saisie" },
            { "Z1K1": "Z11", "Z11K1": "Z1820", "Z11K2": "इनपुट" },
            { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "Eingabe" }
          ]
        }
      }
    ],
    "Z8K2": "Z1",
    "Z8K3": [
      "Z20",
      "Z8010",
      "Z8011",
      "Z8012",
      "Z8013",
      "Z13517",
      "Z15868",
      "Z13870",
      "Z17799",
      "Z17603",
      "Z31006"
    ],
    "Z8K4": [
      "Z14",
      "Z10015"
    ],
    "Z8K5": "Z801"
  },
  "Z801K1": {
    "Z1K1": "Z99",
    "Z99K1": "Z16101"
  }
}

What is send to the orchestrator:
Logged in: MediaWiki\Extension\WikiLambda\ActionAPI\WikiLambdaApiBase::executeFunctionCall before 'orchestrate'

{
  "zobject": { ...same payload as above... },
  "doValidate": true
}

2. Validation call

MediaWiki\Extension\WikiLambda\ActionAPI\ApiPerformTest::logFunctionCallPayload
stage = validationCall
functionZid = Z801
implementationZid = Z10015
testerZid = Z31006
flags = {"validate": false}

Function payload:

{
  "Z1K1": "Z7",
  "Z7K1": "Z29166",
  "Z29166K2": {
    "Z1K1": "Z7",
    "Z7K1": "Z29267",
    "Z29267K1": [
      "Z1",
      "Z16101"
    ]
  },
  "Z29166K1": "Z24"
}

What is send to the orchestrator:
Logged in: MediaWiki\Extension\WikiLambda\ActionAPI\WikiLambdaApiBase::executeFunctionCall before 'orchestrate'

{
  "zobject": {
    "Z1K1": "Z7",
    "Z7K1": "Z29166",
    "Z29166K2": {
      "Z1K1": "Z7",
      "Z7K1": "Z29267",
      "Z29267K1": [
        "Z1",
        "Z16101"
      ]
    },
    "Z29166K1": "Z24"
  },
  "doValidate": false
}