harbor run -t openthoughts/tasktrove-exp-rpt-issue-issue-1134harbor download openthoughts/tasktrove-exp-rpt-issue-issue-1134Problem description: Cookies provided to a Session through a functional API call (e.g., via Session.request, or the top-level convenience methods that delegate to it) are not persisted in the session’s cookie jar. As a result, cookies set on the initial request are not used on subsequent requests (including redirects), and the Cookie header may be missing from subsequent requests even though the cookie was sent on the first request.
Expected behavior:
Files to modify/create (in /app/)
What to implement:
Notes:
Before state (code you will replace/modify). The following blocks show the pre-fix versions of the relevant parts of the codebase.
def cookiejar_from_dict(cookie_dict, cookiejar=None):
"""Returns a CookieJar from a key/value dictionary.
:param cookie_dict: Dict of key/values to insert into CookieJar.
"""
if cookiejar is None:
cookiejar = RequestsCookieJar()
if cookie_dict is not None:
for name in cookie_dict:
cookiejar.set_cookie(create_cookie(name, cookie_dict[name]))
return cookiejar
def copy(self):
p = PreparedRequest()
p.method = self.method
p.url = self.url
p.headers = self.headers
p.body = self.body
p.hooks = self.hooks
return p
prep = self.prepare_request(req)
proxies = proxies or {}
# Gather clues from the surrounding environment.
What to create/modify (instructions for the agent):
Goal after implementing the fix: