Hi Christian, Thanks for testing this — that's a useful data point.
I can confirm your workaround works with ob-python. However, I'm using ob-jupyter (#+begin_src jupyter-python :results raw), which takes a different code path for result insertion. On re-execution, the #+NAME: and #+CAPTION: lines placed above #+RESULTS: get pushed below the new output rather than being preserved. Looking at the source, ob-jupyter uses custom result insertion (jupyter-org--insert-nonstream in jupyter-org-client.el) rather than the standard org-babel-insert-result. Both paths treat #+NAME: and #+CAPTION: as affiliated keywords of the #+RESULTS: element, but they handle the deletion/replacement differently — ob-python apparently preserves them, ob-jupyter does not. This is arguably an ob-jupyter bug, but the broader issue remains: there is no reliable way to attach captions to results across babel backends. A :result-caption header arg (or similar) would solve it portably. Best, Peter
