Download tasks/data/reverse/0fl01__oxide-agent.e2f15d4/environment/docs/stack-logs.md from Lego-X/ProgramGen: direct link, hf CLI and curl.
- Browser
- Download file 6.98 kB
-
https://huggingface.co/datasets/Lego-X/ProgramGen/resolve/main/tasks/data/reverse/0fl01__oxide-agent.e2f15d4/environment/docs/stack-logs.md
- Command line
-
hf download hf://datasets/Lego-X/ProgramGen/tasks/data/reverse/0fl01__oxide-agent.e2f15d4/environment/docs/stack-logs.md
-
curl -L -o stack-logs.md https://huggingface.co/datasets/Lego-X/ProgramGen/resolve/main/tasks/data/reverse/0fl01__oxide-agent.e2f15d4/environment/docs/stack-logs.md
Stack Logs
Reference for the Stack Logs tool: compose-stack log discovery and bounded retrieval for top-level agents.
Purpose
- Give the top-level agent a safe way to read logs of the entire Docker Compose stack without direct Docker socket access from the
oxide_agentprocess. - Return bounded JSON instead of raw log dumps, so memory and progress UI are not inflated.
- Support service selection, time windows, and cursor-based line-by-line pagination.
Tools
Two tools with separate semantics:
| Tool | Purpose |
|---|---|
stack_logs_list_sources |
List available services and containers in the selected compose stack. |
stack_logs_fetch |
Fetch a bounded, normalized log stream by time window or cursor. |
stack_logs_list_sources
Arguments:
{
"selector": {
"compose_project": "oxide-agent"
},
"services": ["oxide_agent", "crw"],
"include_stopped": false
}
selector— optional;compose_projectoverrides the stack selection for this call.services— optional; when omitted, all services in the selected stack are returned.include_stopped— defaultfalse.
Response:
{
"stack_selector": {
"compose_project": "oxide-agent"
},
"containers": [
{
"service": "oxide_agent",
"container_name": "oxide_agent",
"container_id": "abc123def456",
"state": "running",
"started_at": "2026-04-02T10:11:12Z"
}
]
}
stack_logs_fetch
Arguments:
{
"selector": {
"compose_project": "oxide-agent"
},
"services": ["oxide_agent", "sandboxd"],
"since": "2026-04-02T10:00:00Z",
"until": "2026-04-02T10:10:00Z",
"cursor": {
"ts": "2026-04-02T10:03:04.500Z",
"service": "oxide_agent",
"stream": "stdout",
"ordinal": 17
},
"max_entries": 200,
"include_noise": false,
"include_stderr": true
}
selector— optional; same as inlist_sources.services— optional; when omitted, all services in the selected stack are read.since/until— RFC3339 timestamps. If both are set,sincemust be ≤until.cursor— optional; returned by a previousfetchcall for continuation without duplicates.max_entries— default200, hard max500. Values of0are clamped to1with a warning.include_noise— defaultfalse.include_stderr— defaulttrue.
Response:
{
"window": {
"since": "2026-04-02T10:00:00Z",
"until": "2026-04-02T10:10:00Z"
},
"entries": [
{
"ts": "2026-04-02T10:03:04.500Z",
"service": "oxide_agent",
"container_name": "oxide_agent",
"stream": "stdout",
"ordinal": 17,
"message": "retrying LLM request after rate limit"
}
],
"suppressed": [
{
"reason": "exact_duplicate_burst",
"count": 12
}
],
"truncated": false,
"next_cursor": {
"ts": "2026-04-02T10:03:04.500Z",
"service": "oxide_agent",
"stream": "stdout",
"ordinal": 18
},
"warnings": []
}
Stack selector
Three-level resolution, in priority order:
- Per-request override —
selector.compose_projectin the tool arguments. - Environment variable —
STACK_LOGS_PROJECT. - Runtime detection — the sandboxd container's
com.docker.compose.projectDocker label, looked up viaHOSTNAME→inspect_container.
If none resolve, the call fails with an error (see Error handling).
Docker Compose wiring sets STACK_LOGS_PROJECT=${COMPOSE_PROJECT_NAME:-oxide-agent} in docker-compose.yml.
Arbitrary label selectors are not supported.
Cursor contract
Cursor key: ts, service, stream, ordinal — all required.
Merge order for cross-container pagination:
tsservicestreamordinal
Timestamp alone does not guarantee stable pagination when log timestamps collide. Ordinals are assigned per (service, stream) after sorting and noise filtering, making the cursor unambiguous.
Noise policy
When include_noise=false, three classes are suppressed:
- Empty lines —
reason: "empty_line". - Health/readiness probe chatter — messages mentioning endpoints (
/health,/healthz,/ready,/readyz,/readiness,/live,/livez) alongside keywords (get,head,healthcheck,kube-probe,probe).reason: "health_probe_chatter". - Exact duplicate bursts — same
service,container_name,stream, andmessagewithin 1 second of the previous kept entry.reason: "exact_duplicate_burst".
Suppressed entries are never lost silently: the tool always returns suppressed counters with reasons and counts. Semantic summarization, clustering, and LLM rewrite are not performed.
Access policy
- Top-level agents — full access.
- Sub-agents — blocked; both tool names are always unavailable to sub-agents.
- Topic agents — blocked by default; can be enabled explicitly through the manager control plane using the provider alias
"stack_logs"or"logs".
Prompt composer exposes a guidance group under alias "stack_logs" instructing the agent to call list_sources before fetch.
Error handling
The provider does not fail tool calls on backend errors. Instead, it returns a JSON object:
{ "error": "Unable to resolve compose project for stack log discovery; set STACK_LOGS_PROJECT or run sandboxd inside a Docker Compose deployment" }
Key error conditions:
| Condition | Message |
|---|---|
| Unresolvable compose project | Unable to resolve compose project for stack log discovery; set STACK_LOGS_PROJECT or run sandboxd inside a Docker Compose deployment |
HOSTNAME unavailable for runtime detection |
Unable to resolve compose project for stack log discovery automatically: HOSTNAME is unavailable; set STACK_LOGS_PROJECT |
| Container missing compose label | Unable to resolve compose project for stack log discovery automatically: current sandboxd container is missing label '...'; set STACK_LOGS_PROJECT |
| Inverted time window | Invalid stack log time window: 'since' must be earlier than or equal to 'until' |
| All sources failed, no entries | Failed to fetch logs for {service} ({container_name}): {error} (joined with ; ) |
Warnings (non-fatal, returned in the warnings array):
max_entries=0clamped to1:Requested max_entries=0 is invalid; using 1max_entries>500clamped to500:Requested max_entries={n} exceeds hard limit 500; using 500- Unparsable log lines:
Skipped {n} unparsable timestamped log lines from {service} ({container_name}) - Per-source fetch failures (when at least some entries were still collected from other sources)
Configuration
| Variable | Purpose |
|---|---|
STACK_LOGS_PROJECT |
Optional compose project name override. Set in Docker Compose files to ${COMPOSE_PROJECT_NAME:-oxide-agent}. |
No YAML config keys. Stack selection is purely env + per-request selector.compose_project.