Skip to content

Commit 03f5ca2

Browse files
committed
Fix feedback log path: use absolute path so agent always finds it
The feedback log (.docetl_feedback.log) used a relative path, so if the server and the agent had different cwds, the agent's Monitor would watch the wrong file and never see feedback. Now FeedbackStore resolves the log path to an absolute path at init. The pipeline prints [FEEDBACK_LOG] <path> to stdout so the agent knows where to monitor. Added /feedback/log_path endpoint for discovery. https://claude.ai/code/session_013WUwghjHVh6r5mRHEMuhGP
1 parent a67446b commit 03f5ca2

2 files changed

Lines changed: 22 additions & 3 deletions

File tree

.claude/skills/docetl/SKILL.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,8 @@ You can also start it manually with `docetl serve` if you want it running before
585585
Monitor(command="tail -F .docetl_feedback.log", description="Watch for human feedback")
586586
```
587587
588+
If the pipeline prints a `[FEEDBACK_LOG] /absolute/path` line, use that path instead — the log may be in a different directory than your cwd. You can also query the server: `curl -s http://localhost:<PORT>/feedback/log_path`.
589+
588590
This is MANDATORY. Without the Monitor, you will not see feedback until the pipeline finishes. The Monitor sends you a notification the instant the human submits feedback.
589591
590592
Each feedback event appears as a line:

docetl/tui/web_reporter.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,19 @@
3434
_FEEDBACK_LOG = ".docetl_feedback.log"
3535

3636

37+
def _resolve_feedback_log() -> str:
38+
"""Return the absolute path to the feedback log.
39+
40+
When a port file exists, write the log next to it so the agent always
41+
knows where to find it regardless of cwd. Falls back to cwd.
42+
"""
43+
try:
44+
port_path = os.path.abspath(_PORT_FILE)
45+
return os.path.join(os.path.dirname(port_path), _FEEDBACK_LOG)
46+
except Exception:
47+
return os.path.abspath(_FEEDBACK_LOG)
48+
49+
3750
# ---------------------------------------------------------------------------
3851
# Feedback store
3952
# ---------------------------------------------------------------------------
@@ -47,13 +60,13 @@ def __init__(self):
4760
self.kill_reason: str | None = None
4861
self._agent_messages: list[dict] = []
4962
self._agent_msg_counter = 0
50-
# Truncate log at start of each session
51-
with open(_FEEDBACK_LOG, "w") as f:
63+
self._log_path = _resolve_feedback_log()
64+
with open(self._log_path, "w") as f:
5265
pass
5366

5467
def _log(self, line: str):
5568
try:
56-
with open(_FEEDBACK_LOG, "a") as f:
69+
with open(self._log_path, "a") as f:
5770
f.write(line + "\n")
5871
f.flush()
5972
except OSError:
@@ -312,6 +325,8 @@ def do_GET(self):
312325
self._json_response(broadcaster._last_event or {})
313326
elif self.path == "/health":
314327
self._json_response({"ok": True})
328+
elif self.path == "/feedback/log_path":
329+
self._json_response({"path": feedback._log_path})
315330
else:
316331
self.send_error(404)
317332

@@ -2241,6 +2256,8 @@ def _run_with_remote_server(runner: "DSLRunner", tracker: ProgressTracker, port:
22412256
runner.console.log(
22422257
f"[bold blue]Using persistent server:[/bold blue] http://localhost:{port}"
22432258
)
2259+
log_path = _resolve_feedback_log()
2260+
print(f"[FEEDBACK_LOG] {log_path}", flush=True)
22442261

22452262
# Reset the server UI for this new run
22462263
try:

0 commit comments

Comments
 (0)