Index: includes/ajax.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/ajax.inc,v
retrieving revision 1.7
diff -u -p -r1.7 ajax.inc
--- includes/ajax.inc	27 Aug 2009 04:40:12 -0000	1.7
+++ includes/ajax.inc	1 Sep 2009 14:11:53 -0000
@@ -214,14 +214,18 @@ function ajax_form_callback() {
   if (function_exists($callback)) {
     $html = $callback($form, $form_state);
 
-    // If the returned value is a string, assume it is HTML and create
-    // a command object to return automatically.
+    // If the returned value is a string, assume it is HTML, add the status
+    // messages, and create a command object to return automatically. We want
+    // the status messages inside the new wrapper, so that they get replaced
+    // on subsequent AJAX calls for the same wrapper.
     if (is_string($html)) {
-      $commands = array();
       $commands[] = ajax_command_replace(NULL, $html);
+      $commands[] = ajax_command_prepend(NULL, theme('status_messages'));
     }
     // Otherwise, $html is supposed to be an array of commands, suitable for
-    // Drupal.ajax, so we pass it on as is.
+    // Drupal.ajax, so we pass it on as is. In this situation, the callback is
+    // doing something fancy, so let it decide how to handle status messages
+    // without second guessing it.
     else {
       $commands = $html;
     }
Index: modules/field/field.form.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/field/field.form.inc,v
retrieving revision 1.23
diff -u -p -r1.23 field.form.inc
--- modules/field/field.form.inc	27 Aug 2009 04:40:12 -0000	1.23
+++ modules/field/field.form.inc	1 Sep 2009 14:11:57 -0000
@@ -362,9 +362,5 @@ function field_add_more_js($form, $form_
   $field_form[$langcode][$delta]['#prefix'] = '<div class="ajax-new-content">' . (isset($field_form[$langcode][$delta]['#prefix']) ? $field_form[$langcode][$delta]['#prefix'] : '');
   $field_form[$langcode][$delta]['#suffix'] = (isset($field_form[$langcode][$delta]['#suffix']) ? $field_form[$langcode][$delta]['#suffix'] : '') . '</div>';
 
-  $output = theme('status_messages') . drupal_render($field_form);
-
-  $commands = array();
-  $commands[] = ajax_command_replace(NULL, $output);
-  ajax_render($commands);
+  return drupal_render($field_form);
 }
Index: modules/poll/poll.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/poll/poll.module,v
retrieving revision 1.311
diff -u -p -r1.311 poll.module
--- modules/poll/poll.module	29 Aug 2009 05:46:03 -0000	1.311
+++ modules/poll/poll.module	1 Sep 2009 14:12:00 -0000
@@ -382,7 +382,7 @@ function _poll_choice_form($key, $chid =
 function poll_choice_js($form, $form_state) {
   $choice_form = $form['choice_wrapper']['choice'];
 
-  return theme('status_messages') . drupal_render($choice_form);
+  return drupal_render($choice_form);
 }
 
 /**
