v0.1: Stabilize Current Runtime¶
Goal¶
Make the current owner setup boring, inspectable, and debuggable before adding new architecture.
Why It Matters¶
G-Agent already has valuable local-first surfaces: channels, tools, visual/image generation, Google Workspace, service mode, and workspace restriction. The next features will fail if the current runtime is hard to inspect when something breaks.
Scope¶
- Keep
tools.restrictToWorkspaceenabled by default. - Keep
tools.allowedPathsas the official way to trust media/project folders. - Document OpenAI-compatible image proxy usage, including current Codex image models.
- Add focused tests for image proxy response formats.
- Fix Google Workspace discovery for service environments.
- Add easy log inspection from CLI and chat.
- Improve troubleshooting docs for PATH, systemd user services, sandbox behavior, and trusted media folders.
Module Targets¶
backend/agent/g_agent/agent/tools/selfie.pybackend/agent/g_agent/providers/backend/agent/g_agent/config/schema.pybackend/agent/g_agent/observability/backend/agent/g_agent/cli/commands.pydocs/configuration.mddocs/operations.mddocs/troubleshooting.md
Acceptance Criteria¶
- Image generation works through an OpenAI-compatible proxy.
- Failed image generation logs provider, model, endpoint, and response shape.
- Google Workspace errors explain missing
gws, missinggcloud, or PATH issues separately. - CLI can show recent runtime logs without manual journal digging.
- Docs explain how to add
/home/galyarder/Documents/Keiyaor similar owner media roots throughtools.allowedPaths, without disabling workspace safety.
Tests¶
- Proxy image response parser handles expected response variants.
- Provider error path returns actionable text.
- Google Workspace discovery test covers service PATH behavior.
- Log command truncates long output safely.
References¶
- Main roadmap Phase 0.
- Existing visual/selfie implementation.
- Current user reports around image proxy,
gws, and workspace path access.
Agent Handoff¶
Current G-Agent State¶
agent/tools/selfie.pyalready supportshuggingface,cloudflare, andopenai-compatibleimage generation.selfie.pyhas agpt-image-*payload branch usingresponse_format: b64_jsonandsize: 1024x1024.config/schema.pyalready hasVisualIdentityConfigandImageGenProviderConfigwith LoRA fields.agent/tools/google_workspace.pyalready wrapsgws; config hasintegrations.google.gws_path,credentials_file, andtools.exec.path_append.observability/metrics.pyandagent/runtime.pyalready give metrics and task checkpoints./logsnow exposes recent bounded checkpoint output through chat and direct CLI agent mode.channels/slash_commands.pyhas/status,/context,/tools,/cron,/memory, and/logs; extend this shared command surface before inventing a second one.
Implementation Slices¶
- Add image proxy parser tests.
- Cover
b64_json, URL fallback, missingdata, missing image keys, and non-JSON HTTP errors. - Target
backend/agent/tests/test_selfie_tool.py. - Improve image error reporting.
- In
SelfieTool._generate_openai_compatible, wrap HTTP errors with endpoint, provider, model, status, and a short response preview. - Do not log API keys.
- Add
gwsdiagnostics. - Extend
GwsClienthelper behavior so errors distinguish:- binary not found
gcloudnot found- auth/config missing
- command failed
- Tests belong beside
test_google_workspace_helpers.pyandtest_gws_client_env.py. - Add log reader.
- Create
observability/log_reader.py. - It should read recent task checkpoints and metrics JSONL first, because those are local and portable.
- Optional later: journal/systemd support.
- Add
/logs. - Extend
channels/slash_commands.py. - Keep output short and HTML-safe for Telegram/WhatsApp.
Do Not Break¶
- Keep
tools.restrict_to_workspaceandtools.allowed_pathsbehavior. - Keep existing
SelfieTooldelivery semantics: when selfie is delivered,AgentLoopsuppresses duplicate follow-up text. - Keep
gws_pathoverride; service environments need explicit binary paths.
First PR Boundary¶
One PR can include:
- image proxy tests and improved error messages
gwsdiagnostics tests/logscommand backed by local checkpoint/metrics summaries
Do not include SQLite session work in this PR.